WebCore:
authorbfulgham@webkit.org <bfulgham@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Jun 2009 01:21:18 +0000 (01:21 +0000)
committerbfulgham@webkit.org <bfulgham@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Jun 2009 01:21:18 +0000 (01:21 +0000)
2009-06-17  Brent Fulgham  <bfulgham@webkit.org>

        Reviewed by Dave Levin.

        https://bugs.webkit.org/show_bug.cgi?id=26425
        Final refactorings, picking up a few places where BitmapInfo
        could be used.

        * page/win/FrameCGWin.cpp:
        (WebCore::imageFromRect):
        * platform/win/CursorWin.cpp:
        (WebCore::Cursor::Cursor):
        * platform/win/PopupMenuWin.cpp:
        (WebCore::PopupMenu::paint):

WebKit/win:

2009-06-18  Brent Fulgham  <bfulgham@gmail.com>

        Reviewed by Dave Levin.

        Remove some boilerplate using the BitmapInfo struct.
        https://bugs.webkit.org/show_bug.cgi?id=26425

        * WebFrame.cpp:
        (WebFrame::spoolPages):
        * WebIconDatabase.cpp:
        (createDIB):
        * WebKit.vcproj/WebKit.sln:
        * WebNodeHighlight.cpp:
        (WebNodeHighlight::update):
        * WebView.cpp:
        (WebView::ensureBackingStore):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@44836 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/page/win/FrameCGWin.cpp
WebCore/platform/win/CursorWin.cpp
WebCore/platform/win/PopupMenuWin.cpp
WebKit/win/ChangeLog
WebKit/win/WebIconDatabase.cpp
WebKit/win/WebNodeHighlight.cpp
WebKit/win/WebView.cpp

index 46fe010..ee4d674 100644 (file)
@@ -1,3 +1,18 @@
+2009-06-17  Brent Fulgham  <bfulgham@webkit.org>
+
+        Reviewed by Dave Levin.
+
+        https://bugs.webkit.org/show_bug.cgi?id=26425
+        Final refactorings, picking up a few places where BitmapInfo
+        could be used.
+
+        * page/win/FrameCGWin.cpp:
+        (WebCore::imageFromRect):
+        * platform/win/CursorWin.cpp:
+        (WebCore::Cursor::Cursor):
+        * platform/win/PopupMenuWin.cpp:
+        (WebCore::PopupMenu::paint):
+
 2009-06-18  Chris Fleizach  <cfleizach@apple.com>
 
         Reviewed by Darin Adler.
index 8b0408d..5c5f5a0 100644 (file)
@@ -55,7 +55,7 @@ static HBITMAP imageFromRect(const Frame* frame, IntRect& ir)
     HDC hdc = CreateCompatibleDC(0);
     int w = ir.width();
     int h = ir.height();
-    BITMAPINFO bmp = { { sizeof(BITMAPINFOHEADER), w, h, 1, 32 } };
+    BitmapInfo bmp = BitmapInfo::create(IntSize(w, h));
 
     HBITMAP hbmp = CreateDIBSection(0, &bmp, DIB_RGB_COLORS, static_cast<void**>(&bits), 0, 0);
     HBITMAP hbmpOld = static_cast<HBITMAP>(SelectObject(hdc, hbmp));
index e91e86b..2bfe7a8 100644 (file)
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "Cursor.h"
 
+#include "BitmapInfo.h"
 #include "Image.h"
 #include "IntPoint.h"
 
@@ -54,13 +55,8 @@ static inline bool supportsAlphaCursors()
 Cursor::Cursor(Image* img, const IntPoint& hotspot) 
 { 
     static bool doAlpha = supportsAlphaCursors();
-    BITMAPINFO cursorImage = {0};
-    cursorImage.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-    cursorImage.bmiHeader.biWidth = img->width();
-    cursorImage.bmiHeader.biHeight = img->height();
-    cursorImage.bmiHeader.biPlanes = 1;
-    cursorImage.bmiHeader.biBitCount = 32;
-    cursorImage.bmiHeader.biCompression = BI_RGB;
+    BitmapInfo cursorImage = BitmapInfo::create(IntSize(img->width(), img->height()));
+
     HDC dc = GetDC(0);
     HDC workingDC = CreateCompatibleDC(dc);
     if (doAlpha) {
index c8d7ba7..dd09173 100644 (file)
@@ -452,7 +452,7 @@ void PopupMenu::paint(const IntRect& damageRect, HDC hdc)
         }
     }
     if (!m_bmp) {
-        BITMAPINFO bitmapInfo = BitmapInfo::createBottomUp(clientRect().size());
+        BitmapInfo bitmapInfo = BitmapInfo::createBottomUp(clientRect().size());
 
         void* pixels = 0;
         m_bmp = ::CreateDIBSection(m_DC, &bitmapInfo, DIB_RGB_COLORS, &pixels, 0, 0);
index af63f1d..93f794d 100644 (file)
@@ -1,3 +1,20 @@
+2009-06-18  Brent Fulgham  <bfulgham@gmail.com>
+
+        Reviewed by Dave Levin.
+
+        Remove some boilerplate using the BitmapInfo struct.
+        https://bugs.webkit.org/show_bug.cgi?id=26425
+
+        * WebFrame.cpp:
+        (WebFrame::spoolPages):
+        * WebIconDatabase.cpp:
+        (createDIB):
+        * WebKit.vcproj/WebKit.sln:
+        * WebNodeHighlight.cpp:
+        (WebNodeHighlight::update):
+        * WebView.cpp:
+        (WebView::ensureBackingStore):
+
 2009-06-17  Steve Falkenburg  <sfalken@apple.com>
 
         Consolidate WebKit COM interfaces.
index 237438c..8aab6af 100644 (file)
@@ -32,6 +32,7 @@
 #include "WebPreferences.h"
 #include "WebNotificationCenter.h"
 #pragma warning(push, 0)
+#include <WebCore/BitmapInfo.h>
 #include <WebCore/BString.h>
 #include <WebCore/FileSystem.h>
 #include <WebCore/IconDatabase.h>
@@ -262,18 +263,10 @@ HRESULT STDMETHODCALLTYPE WebIconDatabase::setEnabled(
 
 HBITMAP createDIB(LPSIZE size)
 {
-    HBITMAP result;
-
-    BITMAPINFO bmInfo = {0};
-    bmInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-    bmInfo.bmiHeader.biWidth = size->cx;
-    bmInfo.bmiHeader.biHeight = size->cy;
-    bmInfo.bmiHeader.biPlanes = 1;
-    bmInfo.bmiHeader.biBitCount = 32;
-    bmInfo.bmiHeader.biCompression = BI_RGB;
+    BitmapInfo bmInfo = BitmapInfo::create(IntSize(*size));
 
     HDC dc = GetDC(0);
-    result = CreateDIBSection(dc, &bmInfo, DIB_RGB_COLORS, 0, 0, 0);
+    HBITMAP result = CreateDIBSection(dc, &bmInfo, DIB_RGB_COLORS, 0, 0, 0);
     ReleaseDC(0, dc);
 
     return result;
index 274eb82..c4bf181 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "WebView.h"
 #pragma warning(push, 0)
+#include <WebCore/BitmapInfo.h>
 #include <WebCore/Color.h>
 #include <WebCore/GraphicsContext.h>
 #include <WebCore/InspectorController.h>
@@ -146,18 +147,7 @@ void WebNodeHighlight::update()
     size.cx = webViewRect.right - webViewRect.left;
     size.cy = webViewRect.bottom - webViewRect.top;
 
-    BITMAPINFO bitmapInfo;
-    bitmapInfo.bmiHeader.biSize          = sizeof(BITMAPINFOHEADER);
-    bitmapInfo.bmiHeader.biWidth         = size.cx;
-    bitmapInfo.bmiHeader.biHeight        = -size.cy;
-    bitmapInfo.bmiHeader.biPlanes        = 1;
-    bitmapInfo.bmiHeader.biBitCount      = 32;
-    bitmapInfo.bmiHeader.biCompression   = BI_RGB;
-    bitmapInfo.bmiHeader.biSizeImage     = 0;
-    bitmapInfo.bmiHeader.biXPelsPerMeter = 0;
-    bitmapInfo.bmiHeader.biYPelsPerMeter = 0;
-    bitmapInfo.bmiHeader.biClrUsed       = 0;
-    bitmapInfo.bmiHeader.biClrImportant  = 0;
+    BitmapInfo bitmapInfo = BitmapInfo::createBottomUp(IntSize(size));
 
     void* pixels = 0;
     OwnPtr<HBITMAP> hbmp(::CreateDIBSection(hdc, &bitmapInfo, DIB_RGB_COLORS, &pixels, 0, 0));
index 9081a71..c6e6037 100644 (file)
@@ -53,6 +53,7 @@
 #pragma warning( push, 0 )
 #include <WebCore/ApplicationCacheStorage.h>
 #include <WebCore/AXObjectCache.h>
+#include <WebCore/BitmapInfo.h>
 #include <WebCore/BString.h>
 #include <WebCore/Cache.h>
 #include <WebCore/ContextMenu.h>
@@ -687,18 +688,7 @@ bool WebView::ensureBackingStore()
 
         m_backingStoreSize.cx = width;
         m_backingStoreSize.cy = height;
-        BITMAPINFO bitmapInfo;
-        bitmapInfo.bmiHeader.biSize          = sizeof(BITMAPINFOHEADER);
-        bitmapInfo.bmiHeader.biWidth         = width; 
-        bitmapInfo.bmiHeader.biHeight        = -height;
-        bitmapInfo.bmiHeader.biPlanes        = 1;
-        bitmapInfo.bmiHeader.biBitCount      = 32;
-        bitmapInfo.bmiHeader.biCompression   = BI_RGB;
-        bitmapInfo.bmiHeader.biSizeImage     = 0;
-        bitmapInfo.bmiHeader.biXPelsPerMeter = 0;
-        bitmapInfo.bmiHeader.biYPelsPerMeter = 0;
-        bitmapInfo.bmiHeader.biClrUsed       = 0;
-        bitmapInfo.bmiHeader.biClrImportant  = 0;
+        BitmapInfo bitmapInfo = BitmapInfo::createBottomUp(IntSize(m_backingStoreSize));
 
         void* pixels = NULL;
         m_backingStoreBitmap.set(::CreateDIBSection(NULL, &bitmapInfo, DIB_RGB_COLORS, &pixels, NULL, 0));