Title: [158533] trunk/Source
Revision
158533
Author
par...@webkit.org
Date
2013-11-03 09:48:56 -0800 (Sun, 03 Nov 2013)

Log Message

[WINCE] Replace OwnPtr with GDIObject
https://bugs.webkit.org/show_bug.cgi?id=123670

Reviewed by Anders Carlsson.

Source/WebCore:

* page/win/FrameGdiWin.cpp:
(WebCore::imageFromRect):
* platform/graphics/wince/FontPlatformData.cpp:
(WebCore::FixedSizeFontData::create):
(WebCore::FontPlatformData::hfont):
(WebCore::FontPlatformData::getScaledFontHandle):
* platform/graphics/wince/GraphicsContextWinCE.cpp:
(WebCore::createPen):
(WebCore::createBrush):
(WebCore::GraphicsContext::drawRect):
(WebCore::GraphicsContext::drawLine):
(WebCore::GraphicsContext::drawEllipse):
(WebCore::GraphicsContext::drawConvexPolygon):
(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::clip):
(WebCore::GraphicsContext::strokeRect):
(WebCore::GraphicsContext::fillRoundedRect):
(WebCore::GraphicsContext::drawRoundCorner):
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::strokePath):
(WebCore::GraphicsContext::drawText):
* platform/graphics/wince/ImageWinCE.cpp:
(WebCore::BitmapImage::getHBITMAPOfSize):
* platform/graphics/wince/SharedBitmap.cpp:
(WebCore::SharedBitmap::createHandle):
(WebCore::SharedBitmap::draw):
(WebCore::SharedBitmap::clipBitmap):
(WebCore::drawPatternSimple):
(WebCore::SharedBitmap::drawPattern):
(WebCore::SharedBitmap::DCProvider::getDC):
* platform/graphics/wince/SharedBitmap.h:

Source/WebKit/wince:

* WebView.cpp:
(WebView::paint):
(WebView::handlePaint):
* WebView.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (158532 => 158533)


--- trunk/Source/WebCore/ChangeLog	2013-11-03 14:55:47 UTC (rev 158532)
+++ trunk/Source/WebCore/ChangeLog	2013-11-03 17:48:56 UTC (rev 158533)
@@ -1,3 +1,42 @@
+2013-11-03  Patrick Gansterer  <par...@webkit.org>
+
+        [WINCE] Replace OwnPtr with GDIObject
+        https://bugs.webkit.org/show_bug.cgi?id=123670
+
+        Reviewed by Anders Carlsson.
+
+        * page/win/FrameGdiWin.cpp:
+        (WebCore::imageFromRect):
+        * platform/graphics/wince/FontPlatformData.cpp:
+        (WebCore::FixedSizeFontData::create):
+        (WebCore::FontPlatformData::hfont):
+        (WebCore::FontPlatformData::getScaledFontHandle):
+        * platform/graphics/wince/GraphicsContextWinCE.cpp:
+        (WebCore::createPen):
+        (WebCore::createBrush):
+        (WebCore::GraphicsContext::drawRect):
+        (WebCore::GraphicsContext::drawLine):
+        (WebCore::GraphicsContext::drawEllipse):
+        (WebCore::GraphicsContext::drawConvexPolygon):
+        (WebCore::GraphicsContext::fillRect):
+        (WebCore::GraphicsContext::clip):
+        (WebCore::GraphicsContext::strokeRect):
+        (WebCore::GraphicsContext::fillRoundedRect):
+        (WebCore::GraphicsContext::drawRoundCorner):
+        (WebCore::GraphicsContext::fillPath):
+        (WebCore::GraphicsContext::strokePath):
+        (WebCore::GraphicsContext::drawText):
+        * platform/graphics/wince/ImageWinCE.cpp:
+        (WebCore::BitmapImage::getHBITMAPOfSize):
+        * platform/graphics/wince/SharedBitmap.cpp:
+        (WebCore::SharedBitmap::createHandle):
+        (WebCore::SharedBitmap::draw):
+        (WebCore::SharedBitmap::clipBitmap):
+        (WebCore::drawPatternSimple):
+        (WebCore::SharedBitmap::drawPattern):
+        (WebCore::SharedBitmap::DCProvider::getDC):
+        * platform/graphics/wince/SharedBitmap.h:
+
 2013-11-03  Antti Koivisto  <an...@apple.com>
 
         Add helpers for partial descendant traversal to element iterators

Modified: trunk/Source/WebCore/page/win/FrameGdiWin.cpp (158532 => 158533)


--- trunk/Source/WebCore/page/win/FrameGdiWin.cpp	2013-11-03 14:55:47 UTC (rev 158532)
+++ trunk/Source/WebCore/page/win/FrameGdiWin.cpp	2013-11-03 17:48:56 UTC (rev 158533)
@@ -30,13 +30,13 @@
 #include "Frame.h"
 #include "FrameView.h"
 #include "GraphicsContext.h"
-#include <windows.h>
+#include <wtf/win/GDIObject.h>
 
 namespace WebCore {
 
 extern HDC g_screenDC;
 
-PassOwnPtr<HBITMAP> imageFromRect(Frame* frame, IntRect& ir)
+GDIObject<HBITMAP> imageFromRect(Frame* frame, IntRect& ir)
 {
     int w;
     int h;
@@ -51,21 +51,21 @@
         h = ir.height();
     }
 
-    OwnPtr<HDC> bmpDC = adoptPtr(CreateCompatibleDC(g_screenDC));
-    OwnPtr<HBITMAP> hBmp = adoptPtr(CreateCompatibleBitmap(g_screenDC, w, h));
+    auto bmpDC = adoptGDIObject(::CreateCompatibleDC(g_screenDC));
+    auto hBmp = adoptGDIObject(::CreateCompatibleBitmap(g_screenDC, w, h));
     if (!hBmp)
         return nullptr;
 
-    HGDIOBJ hbmpOld = SelectObject(bmpDC.get(), hBmp.get());
+    HGDIOBJ hbmpOld = ::SelectObject(bmpDC.get(), hBmp.get());
 
     {
         GraphicsContext gc(bmpDC.get());
         view->paint(&gc, ir);
     }
 
-    SelectObject(bmpDC.get(), hbmpOld);
+    ::SelectObject(bmpDC.get(), hbmpOld);
 
-    return hBmp.release();
+    return hBmp;
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/wince/FontPlatformData.cpp (158532 => 158533)


--- trunk/Source/WebCore/platform/graphics/wince/FontPlatformData.cpp	2013-11-03 14:55:47 UTC (rev 158532)
+++ trunk/Source/WebCore/platform/graphics/wince/FontPlatformData.cpp	2013-11-03 17:48:56 UTC (rev 158533)
@@ -26,10 +26,10 @@
 #include "FontData.h"
 #include "SimpleFontData.h"
 #include "UnicodeRange.h"
-#include "wtf/OwnPtr.h"
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/StringHash.h>
 #include <wtf/text/WTFString.h>
+#include <wtf/win/GDIObject.h>
 
 #include <windows.h>
 #include <mlang.h>
@@ -94,7 +94,7 @@
 class FixedSizeFontData: public RefCounted<FixedSizeFontData> {
 public:
     LOGFONT m_font;
-    OwnPtr<HFONT> m_hfont;
+    GDIObject<HFONT> m_hfont;
     TEXTMETRIC m_metrics;
     DWORD m_codePages;
     unsigned m_weight;
@@ -257,7 +257,7 @@
     wmemcpy(winFont.lfFaceName, family.characters(), len);
     winFont.lfFaceName[len] = L'\0';
 
-    fontData->m_hfont = adoptPtr(CreateFontIndirect(&winFont));
+    fontData->m_hfont = adoptGDIObject(::CreateFontIndirect(&winFont));
 
     HGDIOBJ oldFont = SelectObject(g_screenDC, fontData->m_hfont.get());
 
@@ -305,7 +305,7 @@
     RefPtr<FixedSizeFontData> m_rootFontData;
     AtomicString m_family;
     FontDescription m_fontDescription;
-    OwnPtr<HFONT> m_hfontScaled;
+    GDIObject<HFONT> m_hfontScaled;
     int m_size;
     long m_fontScaledWidth;
     long m_fontScaledHeight;
@@ -385,7 +385,7 @@
         return 0;
 
     if (!m_private->m_rootFontData->m_hfont)
-        m_private->m_rootFontData->m_hfont = adoptPtr(CreateFontIndirect(&m_private->m_rootFontData->m_font));
+        m_private->m_rootFontData->m_hfont = adoptGDIObject(::CreateFontIndirect(&m_private->m_rootFontData->m_font));
 
     return m_private->m_rootFontData->m_hfont.get();
 }
@@ -401,7 +401,7 @@
         LOGFONT font = m_private->m_rootFontData->m_font;
         font.lfHeight = -height;
         font.lfWidth = width;
-        m_private->m_hfontScaled = adoptPtr(CreateFontIndirect(&font));
+        m_private->m_hfontScaled = adoptGDIObject(::CreateFontIndirect(&font));
     }
 
     return m_private->m_hfontScaled.get();

Modified: trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp (158532 => 158533)


--- trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp	2013-11-03 14:55:47 UTC (rev 158532)
+++ trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp	2013-11-03 17:48:56 UTC (rev 158533)
@@ -345,7 +345,7 @@
     Vector<GraphicsContextPlatformPrivateData> m_backupData;
 };
 
-static PassOwnPtr<HPEN> createPen(const Color& col, double fWidth, StrokeStyle style)
+static GDIObject<HPEN> createPen(const Color& col, double fWidth, StrokeStyle style)
 {
     int width = stableRound(fWidth);
     if (width < 1)
@@ -369,12 +369,12 @@
             break;
     }
 
-    return adoptPtr(CreatePen(penStyle, width, RGB(col.red(), col.green(), col.blue())));
+    return adoptGDIObject(::CreatePen(penStyle, width, RGB(col.red(), col.green(), col.blue())));
 }
 
-static inline PassOwnPtr<HBRUSH> createBrush(const Color& col)
+static inline GDIObject<HBRUSH> createBrush(const Color& col)
 {
-    return adoptPtr(CreateSolidBrush(RGB(col.red(), col.green(), col.blue())));
+    return adoptGDIObject(::CreateSolidBrush(RGB(col.red(), col.green(), col.blue())));
 }
 
 template <typename PixelType, bool Is16bit> static void _rotateBitmap(SharedBitmap* destBmp, const SharedBitmap* sourceBmp, const RotationTransform& transform)
@@ -642,7 +642,7 @@
         return;
     trRect.move(transparentDC.toShift());
 
-    OwnPtr<HBRUSH> brush;
+    GDIObject<HBRUSH> brush;
     HGDIOBJ oldBrush;
     if (fillColor().alpha()) {
         brush = createBrush(fillColor());
@@ -650,7 +650,7 @@
     } else
         oldBrush = SelectObject(dc, GetStockObject(NULL_BRUSH));
 
-    OwnPtr<HPEN> pen;
+    GDIObject<HPEN> pen;
     HGDIOBJ oldPen;
     if (strokeStyle() != NoStroke) {
         pen = createPen(strokeColor(), strokeThickness(), strokeStyle());
@@ -692,7 +692,7 @@
     trPoint1 += transparentDC.toShift();
     trPoint2 += transparentDC.toShift();
 
-    OwnPtr<HPEN> pen = createPen(strokeColor(), strokeThickness(), strokeStyle());
+    auto pen = createPen(strokeColor(), strokeThickness(), strokeStyle());
     HGDIOBJ oldPen = SelectObject(dc, pen.get());
 
     MoveToEx(dc, trPoint1.x(), trPoint1.y(), 0);
@@ -717,7 +717,7 @@
         return;
     trRect.move(transparentDC.toShift());
 
-    OwnPtr<HBRUSH> brush;
+    GDIObject<HBRUSH> brush;
     HGDIOBJ oldBrush;
     if (fillColor().alpha()) {
         brush = createBrush(fillColor());
@@ -725,7 +725,7 @@
     } else
         oldBrush = SelectObject(dc, GetStockObject(NULL_BRUSH));
 
-    OwnPtr<HPEN> pen;
+    GDIObject<HPEN> pen;
     HGDIOBJ oldPen = 0;
     if (strokeStyle() != NoStroke) {
         pen = createPen(strokeColor(), strokeThickness(), strokeStyle());
@@ -824,7 +824,7 @@
         winPoints[i].y += transparentDC.toShift().height();
     }
 
-    OwnPtr<HBRUSH> brush;
+    GDIObject<HBRUSH> brush;
     HGDIOBJ oldBrush;
     if (fillColor().alpha()) {
         brush = createBrush(fillColor());
@@ -832,7 +832,7 @@
     } else
         oldBrush = SelectObject(dc, GetStockObject(NULL_BRUSH));
 
-    OwnPtr<HPEN> pen;
+    GDIObject<HPEN> pen;
     HGDIOBJ oldPen;
     if (strokeStyle() != NoStroke) {
         pen = createPen(strokeColor(), strokeThickness(), strokeStyle());
@@ -877,7 +877,7 @@
     if (!transparentDC.hdc())
         return;
 
-    OwnPtr<HBRUSH> hbrush = adoptPtr(CreateSolidBrush(RGB(color.red(), color.green(), color.blue())));
+    auto hbrush = adoptGDIObject(::CreateSolidBrush(RGB(color.red(), color.green(), color.blue())));
     FillRect(transparentDC.hdc(), &transparentDC.rect(), hbrush.get());
 }
 
@@ -891,11 +891,11 @@
 
     IntRect trRect = enclosingIntRect(m_data->mapRect(rect));
 
-    OwnPtr<HRGN> clipRgn = adoptPtr(CreateRectRgn(0, 0, 0, 0));
+    auto clipRgn = adoptGDIObject(::CreateRectRgn(0, 0, 0, 0));
     if (GetClipRgn(m_data->m_dc, clipRgn.get()) > 0)
         IntersectClipRect(m_data->m_dc, trRect.x(), trRect.y(), trRect.maxX(), trRect.maxY());
     else {
-        clipRgn = adoptPtr(CreateRectRgn(trRect.x(), trRect.y(), trRect.maxX(), trRect.maxY()));
+        clipRgn = adoptGDIObject(::CreateRectRgn(trRect.x(), trRect.y(), trRect.maxX(), trRect.maxY()));
         SelectClipRgn(m_data->m_dc, clipRgn.get());
     }
 }
@@ -1027,7 +1027,7 @@
         return;
     trRect.move(transparentDC.toShift());
 
-    OwnPtr<HPEN> pen = createPen(strokeColor(), strokeThickness(), strokeStyle());
+    auto pen = createPen(strokeColor(), strokeThickness(), strokeStyle());
     HGDIOBJ oldPen = SelectObject(dc, pen.get());
 
     int right = trRect.maxX() - 1;
@@ -1179,7 +1179,7 @@
 
     RECT rectWin = dstRect;
 
-    OwnPtr<HBRUSH> brush = createBrush(shadowColor);
+    auto brush = createBrush(shadowColor);
     HGDIOBJ oldBrush = SelectObject(dc, brush.get());
 
     SelectObject(dc, GetStockObject(NULL_PEN));
@@ -1190,9 +1190,9 @@
     clipRect.right = centerPoint.x();
     clipRect.bottom = centerPoint.y();
 
-    OwnPtr<HRGN> clipRgn = adoptPtr(CreateRectRgn(0, 0, 0, 0));
+    auto clipRgn = adoptGDIObject(::CreateRectRgn(0, 0, 0, 0));
     bool needsNewClip = (GetClipRgn(dc, clipRgn.get()) <= 0);
-    
+
     drawRoundCorner(needsNewClip, clipRect, rectWin, dc, stableRound(newTopLeft.width() * 2), stableRound(newTopLeft.height() * 2));
 
     // Draw top right
@@ -1225,9 +1225,9 @@
     if (!dc)
         return;
 
-    OwnPtr<HRGN> clipRgn = adoptPtr(CreateRectRgn(0, 0, 0, 0));
+    auto clipRgn = adoptGDIObject(::CreateRectRgn(0, 0, 0, 0));
     if (needsNewClip) {
-        clipRgn = adoptPtr(CreateRectRgn(clipRect.left, clipRect.top, clipRect.right, clipRect.bottom));
+        clipRgn = adoptGDIObject(::CreateRectRgn(clipRect.left, clipRect.top, clipRect.right, clipRect.bottom));
         SelectClipRgn(dc, clipRgn.get());
     } else
         IntersectClipRect(dc, clipRect.left, clipRect.top, clipRect.right, clipRect.bottom);
@@ -1277,7 +1277,7 @@
     if (!m_data->m_dc)
         return;
 
-    OwnPtr<HBRUSH> brush = createBrush(c);
+    auto brush = createBrush(c);
 
     if (m_data->m_opacity < 1.0f || m_data->hasAlpha()) {
         IntRect trRect = enclosingIntRect(m_data->mapRect(path.boundingRect()));
@@ -1312,7 +1312,7 @@
     if (!m_data->m_dc)
         return;
 
-    OwnPtr<HPEN> pen = createPen(strokeColor(), strokeThickness(), strokeStyle());
+    auto pen = createPen(strokeColor(), strokeThickness(), strokeStyle());
 
     if (m_data->m_opacity < 1.0f || m_data->hasAlpha()) {
         IntRect trRect = enclosingIntRect(m_data->mapRect(path.boundingRect()));
@@ -1566,7 +1566,7 @@
 
         offset += width;
 
-        OwnPtr<HPEN> hPen = adoptPtr(CreatePen(PS_DASH, 1, fontColor));
+        auto hPen = adoptGDIObject(::CreatePen(PS_DASH, 1, fontColor));
         HGDIOBJ oldPen = SelectObject(m_data->m_dc, hPen.get());
 
         MoveToEx(m_data->m_dc, stableRound(trPoint.x()), y, 0);

Modified: trunk/Source/WebCore/platform/graphics/wince/ImageWinCE.cpp (158532 => 158533)


--- trunk/Source/WebCore/platform/graphics/wince/ImageWinCE.cpp	2013-11-03 14:55:47 UTC (rev 158532)
+++ trunk/Source/WebCore/platform/graphics/wince/ImageWinCE.cpp	2013-11-03 17:48:56 UTC (rev 158533)
@@ -34,11 +34,9 @@
 #include "SharedBuffer.h"
 #include "TransformationMatrix.h"
 #include "WinceGraphicsExtras.h"
-#include <wtf/OwnPtr.h>
 #include <wtf/text/WTFString.h>
+#include <wtf/win/GDIObject.h>
 
-#include <windows.h>
-
 namespace WebCore {
 
 PassNativeImagePtr ImageFrame::asNewNativeImage() const
@@ -70,7 +68,7 @@
     ASSERT(bmpInfo.bmBitsPixel == 32);
     int bufferSize = bmpInfo.bmWidthBytes * bmpInfo.bmHeight;
 
-    OwnPtr<HDC> hdc = adoptPtr(CreateCompatibleDC(0));
+    auto hdc = adoptGDIObject(::CreateCompatibleDC(0));
     HGDIOBJ hOldBmp = SelectObject(hdc.get(), bmp);
 
     {

Modified: trunk/Source/WebCore/platform/graphics/wince/SharedBitmap.cpp (158532 => 158533)


--- trunk/Source/WebCore/platform/graphics/wince/SharedBitmap.cpp	2013-11-03 14:55:47 UTC (rev 158532)
+++ trunk/Source/WebCore/platform/graphics/wince/SharedBitmap.cpp	2013-11-03 17:48:56 UTC (rev 158533)
@@ -186,7 +186,7 @@
     return false;
 }
 
-PassOwnPtr<HBITMAP> SharedBitmap::createHandle(void** pixels, BitmapInfo* bmpInfo, int height, bool use16bit) const
+GDIObject<HBITMAP> SharedBitmap::createHandle(void** pixels, BitmapInfo* bmpInfo, int height, bool use16bit) const
 {
     if (!m_pixels)
         return nullptr;
@@ -195,19 +195,19 @@
         height = this->height();
     *bmpInfo = BitmapInfo::createBottomUp(IntSize(width(), height), (use16bit || is16bit()) ? BitmapInfo::BitCount16 : BitmapInfo::BitCount32);
 
-    OwnPtr<HBITMAP> hbmp = adoptPtr(CreateDIBSection(0, bmpInfo, DIB_RGB_COLORS, pixels, 0, 0));
+    auto hbmp = adoptGDIObject(::CreateDIBSection(0, bmpInfo, DIB_RGB_COLORS, pixels, 0, 0));
 
     if (!hbmp)
         return nullptr;
 
-    OwnPtr<HDC> bmpDC = adoptPtr(CreateCompatibleDC(0));
+    auto bmpDC = adoptGDIObject(::CreateCompatibleDC(0));
     HGDIOBJ hOldBmp = SelectObject(bmpDC.get(), hbmp.get());
 
     StretchDIBits(bmpDC.get(), 0, 0, width(), height, 0, 0, width(), height, m_pixels, &m_bmpInfo, DIB_RGB_COLORS, SRCCOPY);
 
     SelectObject(bmpDC.get(), hOldBmp);
 
-    return hbmp.release();
+    return hbmp;
 }
 
 bool SharedBitmap::ensureHandle()
@@ -251,7 +251,7 @@
         return;
 
     HBITMAP hbitmap = 0;
-    OwnPtr<HBITMAP> hTempBitmap;
+    GDIObject<HBITMAP> hTempBitmap;
     bool usingHandle = compositeOp == CompositeSourceOver && (hasAlpha() && hasAlphaBlendSupport() || usesTransparentColor());
 
     if (usingHandle) {
@@ -276,7 +276,7 @@
         return;
     }
 
-    OwnPtr<HDC> hmemdc = adoptPtr(CreateCompatibleDC(hdc));
+    auto hmemdc = adoptGDIObject(::CreateCompatibleDC(hdc));
     HGDIOBJ hOldBmp = SelectObject(hmemdc.get(), hbitmap);
 
     if (!usesTransparentColor() && hasAlphaBlendSupport()) {
@@ -292,7 +292,7 @@
     SelectObject(hmemdc.get(), hOldBmp);
 }
 
-PassOwnPtr<HBITMAP> SharedBitmap::clipBitmap(const IntRect& rect, bool useAlpha, BitmapInfo& bmpInfo, void*& pixels)
+GDIObject<HBITMAP> SharedBitmap::clipBitmap(const IntRect& rect, bool useAlpha, BitmapInfo& bmpInfo, void*& pixels)
 {
     if (!bytes())
         return nullptr;
@@ -305,19 +305,19 @@
         return nullptr;
 
     bmpInfo = BitmapInfo::createBottomUp(IntSize(copyWidth, copyHeight), (useAlpha && is32bit()) ? BitmapInfo::BitCount32 : BitmapInfo::BitCount16);
-    OwnPtr<HBITMAP> newBmp = adoptPtr(CreateDIBSection(0, &bmpInfo, DIB_RGB_COLORS, &pixels, 0, 0));
+    auto newBmp = adoptGDIObject(::CreateDIBSection(0, &bmpInfo, DIB_RGB_COLORS, &pixels, 0, 0));
 
     if (!newBmp)
         return nullptr;
 
-    OwnPtr<HDC> dcNew = adoptPtr(CreateCompatibleDC(0));
+    auto dcNew = adoptGDIObject(::CreateCompatibleDC(0));
     HGDIOBJ tmpNew = SelectObject(dcNew.get(), newBmp.get());
 
     StretchDIBits(dcNew.get(), 0, 0, copyWidth, copyHeight, rect.x(), rect.y(), copyWidth, copyHeight,
         bytes(), &bitmapInfo(), DIB_RGB_COLORS, SRCCOPY);
 
     SelectObject(dcNew.get(), tmpNew);
-    return newBmp.release();
+    return newBmp;
 }
 
 PassRefPtr<SharedBitmap> SharedBitmap::clipBitmap(const IntRect& rect, bool useAlpha)
@@ -344,7 +344,7 @@
 
 static void drawPatternSimple(HDC hdc, const RECT& destRect, HBITMAP hbmp, const POINT& phase)
 {
-    OwnPtr<HBRUSH> hBrush = adoptPtr(CreatePatternBrush(hbmp));
+    auto hBrush = adoptGDIObject(::CreatePatternBrush(hbmp));
     if (!hBrush)
         return;
 
@@ -431,7 +431,7 @@
         tileRect.setHeight(temp);
     }
 
-    OwnPtr<HBITMAP> clippedBmp;
+    GDIObject<HBITMAP> clippedBmp;
 
     if (tileRect.x() || tileRect.y() || tileRect.width() != bmpWidth || tileRect.height() != bmpHeight) {
         BitmapInfo patternBmpInfo;
@@ -453,7 +453,7 @@
     if (clipType == SIMPLEREGION)
         trRect.intersect(FloatRect(clipBox.left, clipBox.top, clipBox.right - clipBox.left, clipBox.bottom - clipBox.top));
     else if (clipType == COMPLEXREGION) {
-        OwnPtr<HRGN> clipRgn = adoptPtr(CreateRectRgn(0, 0, 0, 0));
+        auto clipRgn = adoptGDIObject(::CreateRectRgn(0, 0, 0, 0));
         if (GetClipRgn(hdc, clipRgn.get()) > 0) {
             DWORD regionDataSize = GetRegionData(clipRgn.get(), sizeof(RGNDATA), 0);
             if (regionDataSize) {
@@ -504,12 +504,12 @@
 
     BitmapInfo bmpInfo = BitmapInfo::createBottomUp(IntSize(srcRectWin.right, srcRectWin.bottom), useAlpha ? BitmapInfo::BitCount32 : BitmapInfo::BitCount16);
     void* pixels;
-    OwnPtr<HBITMAP> hbmpTemp = adoptPtr(CreateDIBSection(0, &bmpInfo, DIB_RGB_COLORS, &pixels, 0, 0));
+    auto hbmpTemp = adoptGDIObject(::CreateDIBSection(0, &bmpInfo, DIB_RGB_COLORS, &pixels, 0, 0));
 
     if (!hbmpTemp)
         return;
 
-    OwnPtr<HDC> hmemdc = adoptPtr(CreateCompatibleDC(hdc));
+    auto hmemdc = adoptGDIObject(::CreateCompatibleDC(hdc));
     HGDIOBJ oldBmp = SelectObject(hmemdc.get(), hbmpTemp.get());
     if (clippedBmp)
         drawPatternSimple(hmemdc.get(), srcRectWin, clippedBmp.get(), phaseWin);
@@ -520,7 +520,7 @@
     else {
         void* pixels;
         BitmapInfo bmpInfo;
-        OwnPtr<HBITMAP> hbmp = createHandle(&pixels, &bmpInfo, -1, false);
+        auto hbmp = createHandle(&pixels, &bmpInfo, -1, false);
         if (hbmp)
             drawPatternSimple(hmemdc.get(), srcRectWin, hbmp.get(), phaseWin);
         else {
@@ -564,7 +564,7 @@
 
     *key = reinterpret_cast<unsigned>(SelectObject(hdc, bmp->getHandle()));
     RECT rect = { 0, 0, bmp->width(), bmp->height() };
-    OwnPtr<HRGN> clipRgn = adoptPtr(CreateRectRgnIndirect(&rect));
+    auto clipRgn = adoptGDIObject(::CreateRectRgnIndirect(&rect));
     SelectClipRgn(hdc, clipRgn.get());
 
     return hdc;

Modified: trunk/Source/WebCore/platform/graphics/wince/SharedBitmap.h (158532 => 158533)


--- trunk/Source/WebCore/platform/graphics/wince/SharedBitmap.h	2013-11-03 14:55:47 UTC (rev 158532)
+++ trunk/Source/WebCore/platform/graphics/wince/SharedBitmap.h	2013-11-03 17:48:56 UTC (rev 158533)
@@ -30,7 +30,7 @@
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
-#include <wingdi.h>
+#include <wtf/win/GDIObject.h>
 
 namespace WebCore {
 
@@ -67,7 +67,7 @@
     void setHasAlpha(bool alpha) { m_hasAlpha = alpha; }
     bool ensureHandle();
     HBITMAP getHandle() { return m_hbitmap.get(); }
-    PassOwnPtr<HBITMAP> createHandle(void** pixels, BitmapInfo* bmpInfo, int h = -1, bool use16bit = true) const;
+    GDIObject<HBITMAP> createHandle(void** pixels, BitmapInfo* bmpInfo, int h = -1, bool use16bit = true) const;
     bool usesTransparentColor() const { return m_usesTransparentColor; }
     COLORREF transparentColor() const { return m_transparentColor; }
     void setTransparentColor(COLORREF c)
@@ -77,7 +77,7 @@
     }
     bool canUseDIBits() const { return !hasAlpha() && !usesTransparentColor(); }
 
-    PassOwnPtr<HBITMAP> clipBitmap(const IntRect& rect, bool useAlpha, BitmapInfo& bmpInfo, void*& pixels);
+    GDIObject<HBITMAP> clipBitmap(const IntRect&, bool useAlpha, BitmapInfo&, void*& pixels);
 
     PassRefPtr<SharedBitmap> clipBitmap(const IntRect& rect, bool useAlpha);
 
@@ -130,7 +130,7 @@
 private:
     SharedBitmap(const IntSize&, BitmapInfo::BitCount, bool initPixels);
     BitmapInfo m_bmpInfo;
-    OwnPtr<HBITMAP> m_hbitmap;
+    GDIObject<HBITMAP> m_hbitmap;
     void* m_pixels;
     std::unique_ptr<unsigned[]> m_pixelData;
     COLORREF m_transparentColor;

Modified: trunk/Source/WebKit/wince/ChangeLog (158532 => 158533)


--- trunk/Source/WebKit/wince/ChangeLog	2013-11-03 14:55:47 UTC (rev 158532)
+++ trunk/Source/WebKit/wince/ChangeLog	2013-11-03 17:48:56 UTC (rev 158533)
@@ -1,3 +1,15 @@
+2013-11-03  Patrick Gansterer  <par...@webkit.org>
+
+        [WINCE] Replace OwnPtr with GDIObject
+        https://bugs.webkit.org/show_bug.cgi?id=123670
+
+        Reviewed by Anders Carlsson.
+
+        * WebView.cpp:
+        (WebView::paint):
+        (WebView::handlePaint):
+        * WebView.h:
+
 2013-11-02  Patrick Gansterer  <par...@webkit.org>
 
         Add OVERRIDE keyword to WebCoreSupport classes

Modified: trunk/Source/WebKit/wince/WebView.cpp (158532 => 158533)


--- trunk/Source/WebKit/wince/WebView.cpp	2013-11-03 14:55:47 UTC (rev 158532)
+++ trunk/Source/WebKit/wince/WebView.cpp	2013-11-03 17:48:56 UTC (rev 158533)
@@ -240,7 +240,7 @@
     if (!frameView)
         return;
 
-    OwnPtr<HRGN> clipRgn = adoptPtr(CreateRectRgn(clipRect.x(), clipRect.y(), clipRect.maxX(), clipRect.maxY()));
+    auto clipRgn = adoptGDIObject(::CreateRectRgn(clipRect.x(), clipRect.y(), clipRect.maxX(), clipRect.maxY()));
     SelectClipRgn(hDC, clipRgn.get());
 
     frameView->updateLayoutAndStyleIfNeededRecursive();
@@ -265,8 +265,8 @@
             RECT rcClient;
             GetClientRect(m_windowHandle, &rcClient);
 
-            m_doubleBufferDC = adoptPtr(CreateCompatibleDC(hDC));
-            m_doubleBufferBitmap = adoptPtr(CreateCompatibleBitmap(hDC, rcClient.right, rcClient.bottom));
+            m_doubleBufferDC = adoptGDIObject(::CreateCompatibleDC(hDC));
+            m_doubleBufferBitmap = adoptGDIObject(::CreateCompatibleBitmap(hDC, rcClient.right, rcClient.bottom));
             SelectObject(m_doubleBufferDC.get(), m_doubleBufferBitmap.get());
         }
 

Modified: trunk/Source/WebKit/wince/WebView.h (158532 => 158533)


--- trunk/Source/WebKit/wince/WebView.h	2013-11-03 14:55:47 UTC (rev 158532)
+++ trunk/Source/WebKit/wince/WebView.h	2013-11-03 17:48:56 UTC (rev 158533)
@@ -27,8 +27,8 @@
 
 #include "IntRect.h"
 #include <windows.h>
-#include <wtf/OwnPtr.h>
 #include <wtf/PassRefPtr.h>
+#include <wtf/win/GDIObject.h>
 
 namespace WTF {
 class String;
@@ -94,8 +94,8 @@
     HWND m_parentWindowHandle;
     HWND m_windowHandle;
     bool m_enableDoubleBuffer;
-    OwnPtr<HDC> m_doubleBufferDC;
-    OwnPtr<HBITMAP> m_doubleBufferBitmap;
+    GDIObject<HDC> m_doubleBufferDC;
+    GDIObject<HBITMAP> m_doubleBufferBitmap;
 };
 
 #endif // WebView_h
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to