Title: [102718] trunk/Source/WebCore
Revision
102718
Author
kev...@webkit.org
Date
2011-12-13 16:00:43 -0800 (Tue, 13 Dec 2011)

Log Message

[wx] Don't make the bitmap transparent when using theme drawing
calls that don't support transparent bitmaps.
https://bugs.webkit.org/show_bug.cgi?id=74319

Reviewed by Kevin Ollivier.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102717 => 102718)


--- trunk/Source/WebCore/ChangeLog	2011-12-13 23:59:24 UTC (rev 102717)
+++ trunk/Source/WebCore/ChangeLog	2011-12-14 00:00:43 UTC (rev 102718)
@@ -1,3 +1,16 @@
+2011-12-13  Robin Dunn  <ro...@alldunn.com>
+
+        Don't make the bitmap transparent when using theme drawing
+        calls that don't support transparent bitmaps.
+        https://bugs.webkit.org/show_bug.cgi?id=74319
+
+        Reviewed by Kevin Ollivier.
+
+        * platform/wx/LocalDC.h:
+        (WebCore::LocalDC::LocalDC):
+        * platform/wx/RenderThemeWx.cpp:
+        (WebCore::RenderThemeWx::paintButton):
+
 2011-12-13  Tony Chang  <t...@chromium.org>
 
         Inline all of initForRegionStyling except for the rarely used part for non-null regions.

Modified: trunk/Source/WebCore/platform/wx/LocalDC.h (102717 => 102718)


--- trunk/Source/WebCore/platform/wx/LocalDC.h	2011-12-13 23:59:24 UTC (rev 102717)
+++ trunk/Source/WebCore/platform/wx/LocalDC.h	2011-12-14 00:00:43 UTC (rev 102718)
@@ -40,15 +40,23 @@
 class LocalDC {
 
 public:
-    LocalDC(wxDC* host, const IntRect& r)
+    LocalDC(wxDC* host, const IntRect& r, bool transparent = false)
     {
 #ifndef __WXMAC__
         m_host = host;
         int width = r.width();
         int height = r.height();
-        m_bitmap = new wxBitmap(width, height, 32);
-        // we scope this to make sure that wxAlphaPixelData isn't holding a ref
-        // to m_bitmap when we create the wxMemoryDC, as this will invoke a copy op.
+        // on MSW, some controls like scrollbars do not always draw properly when
+        // the bitmap is transparent. However, they draw into all pixels so this is
+        // not needed. So only make the bitmap transparent when needed.
+        int depth = 24;
+        if (transparent)
+            depth = 32;
+        m_bitmap = new wxBitmap(width, height, depth);
+        // we need the wxAlphaPixelData code to be in its own scope so that the
+        // pixData is deleted before we assign the bitmap to the wxMemoryDC,
+        // in order to avoid a copy.
+        if (transparent)
         {
             wxAlphaPixelData pixData(*m_bitmap, wxPoint(0,0), wxSize(width, height));
             ASSERT(pixData);
@@ -65,7 +73,6 @@
                 }
             }
         }
-
         m_context = new wxMemoryDC(*m_bitmap);
         m_context->SetDeviceOrigin(-r.x(), -r.y());
         m_rect = r;

Modified: trunk/Source/WebCore/platform/wx/RenderThemeWx.cpp (102717 => 102718)


--- trunk/Source/WebCore/platform/wx/RenderThemeWx.cpp	2011-12-13 23:59:24 UTC (rev 102717)
+++ trunk/Source/WebCore/platform/wx/RenderThemeWx.cpp	2011-12-14 00:00:43 UTC (rev 102718)
@@ -266,7 +266,7 @@
 {
     wxWindow* window = nativeWindowForRenderObject(o);
     wxDC* dc = static_cast<wxDC*>(i.context->platformContext());
-    LocalDC localDC(dc, r);
+    LocalDC localDC(dc, r, /*transparent =*/ true);
 
     int flags = 0;
     
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to