[webkit-reviews] review denied: [Bug 16979] Patch to conditionalize
some CG/Cairo support in win32 : [Attachment 18613] Initial
patch to WebKit to support building without CG/CF.
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Jan 23 06:21:07 PST 2008
Alp Toker <alp at atoker.com> has denied 's request for review:
Bug 16979: Patch to conditionalize some CG/Cairo support in win32
http://bugs.webkit.org/show_bug.cgi?id=16979
Attachment 18613: Initial patch to WebKit to support building without CG/CF.
http://bugs.webkit.org/attachment.cgi?id=18613&action=edit
------- Additional Comments from Alp Toker <alp at atoker.com>
This is looking good. One issue with your approach to conditional that I think
needs cleanup described below. I'd also like a quick second opinion from a Win
port hacker before landing this since I don't maintain this module.
>Index: platform/graphics/win/GraphicsContextWin.cpp
>===================================================================
>--- platform/graphics/win/GraphicsContextWin.cpp (revision 29726)
>+++ platform/graphics/win/GraphicsContextWin.cpp (working copy)
>@@ -29,11 +29,15 @@
> #include "AffineTransform.h"
> #include "NotImplemented.h"
> #include "Path.h"
>-#include <CoreGraphics/CGBitmapContext.h>
>-#include <WebKitSystemInterface/WebKitSystemInterface.h>
> #include <wtf/MathExtras.h>
>
>+#if PLATFORM(CG)
>+#include <CoreGraphics/CGBitmapContext.h>
>+#include <WebKitSystemInterface/WebKitSystemInterface.h>
> #include "GraphicsContextPlatformPrivate.h"
>+#else
>+#include <cairo-win32.h>
>+#endif
Please make this #elif PLATFORM(CAIRO)
>
> using namespace std;
>
>@@ -41,6 +45,7 @@ namespace WebCore {
>
> class SVGResourceImage;
>
>+#if PLATFORM(CG)
> static CGContextRef CGContextWithHDC(HDC hdc)
> {
> HBITMAP bitmap = (HBITMAP)GetCurrentObject(hdc, OBJ_BITMAP);
>@@ -76,9 +81,11 @@ GraphicsContext::GraphicsContext(HDC hdc
> setPlatformStrokeColor(strokeColor());
> }
> }
>+#endif
>
> HDC GraphicsContext::getWindowsContext(const IntRect& dstRect, bool
supportAlphaBlend)
> {
>+#if PLATFORM(CG)
> if (inTransparencyLayer()) {
> if (dstRect.isEmpty())
> return 0;
>@@ -132,12 +139,37 @@ HDC GraphicsContext::getWindowsContext(c
> CGContextFlush(platformContext());
> m_data->save();
> return m_data->m_hdc;
>+#else
>+ // This is probably wrong, and definitely out of date. Pulled from old
SVN
>+ cairo_surface_t* surface = cairo_get_target(platformContext());
>+ HDC hdc = cairo_win32_surface_get_dc(surface);
>+ SaveDC(hdc);
>+
>+ // FIXME: We need to make sure a clip is really set on the HDC.
>+ // Call SetWorldTransform to honor the current Cairo transform.
>+ SetGraphicsMode(hdc, GM_ADVANCED); // We need this call for themes to
honor world transforms.
>+ cairo_matrix_t mat;
>+ cairo_get_matrix(platformContext(), &mat);
>+ XFORM xform;
>+ xform.eM11 = mat.xx;
>+ xform.eM12 = mat.xy;
>+ xform.eM21 = mat.yx;
>+ xform.eM22 = mat.yy;
>+ xform.eDx = mat.x0;
>+ xform.eDy = mat.y0;
>+ SetWorldTransform(hdc, &xform);
>+
>+ return hdc;
>+#endif
#elif PLATFORM(CAIRO) again. In this case, also add _another_ #else with a
notImplemented() after the CAIRO case.
> }
>
>+#if PLATFORM(CG)
> bool GraphicsContext::inTransparencyLayer() const { return
m_data->m_transparencyCount; }
>+#endif
>
> void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect& dstRect,
bool supportAlphaBlend)
> {
>+#if PLATFORM(CG)
> if (hdc && inTransparencyLayer()) {
> if (dstRect.isEmpty())
> return;
>@@ -169,8 +201,15 @@ void GraphicsContext::releaseWindowsCont
> }
>
> m_data->restore();
>+#else
>+ cairo_surface_t* surface = cairo_get_target(platformContext());
>+ HDC hdc2 = cairo_win32_surface_get_dc(surface);
>+ RestoreDC(hdc2, -1);
>+ cairo_surface_mark_dirty(surface);
>+#endif
Ditto here and all the other places.
More information about the webkit-reviews
mailing list