Changeset 30513 in webkit


Ignore:
Timestamp:
Feb 22, 2008 8:18:40 PM (16 years ago)
Author:
mrowe@apple.com
Message:

Roll out r30500 as it breaks non-Windows use of Cairo.

Location:
trunk/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r30512 r30513  
    146146        * platform/win/BString.h:
    147147        * platform/win/PasteboardWin.cpp:
    148 
    149 2008-02-22  Brent Fulgham  <bfulgham@gmail.com>
    150 
    151         Reviewed by Adam Roben.
    152 
    153         http://bugs.webkit.org/show_bug.cgi?id=17442
    154         Correct the Windows Cairo implementation of GraphicsContext so
    155         that Windows 'WorldTransform' is kept in sync with the Cairo
    156         transformations.
    157 
    158         Also corrects an uninitialized variable in the Cairo Windows
    159         image drag handler.
    160 
    161         * platform/graphics/cairo/GraphicsContextCairo.cpp:  Modify
    162           methods to call GraphicsContextPlatformPrivate calls, just
    163           as is done for the CoreGraphics version.  These calls are
    164           nop's for everything but Windows.
    165         (WebCore::GraphicsContext::savePlatformState):
    166         (WebCore::GraphicsContext::restorePlatformState):
    167         (WebCore::GraphicsContext::clip):
    168         (WebCore::GraphicsContext::drawLineForMisspellingOrBadGrammar):
    169         (WebCore::GraphicsContext::translate):
    170         (WebCore::GraphicsContext::concatCTM): Re-enable for Windows
    171         (WebCore::GraphicsContext::beginTransparencyLayer):
    172         (WebCore::GraphicsContext::endTransparencyLayer):
    173         (WebCore::GraphicsContext::rotate):
    174         (WebCore::GraphicsContext::scale):
    175         * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h:
    176         * platform/graphics/win/GraphicsContextCGWin.cpp:  Move common
    177           code for handling WorldTransform calls to parent class.
    178         * platform/graphics/win/GraphicsContextCairoWin.cpp:  Add common
    179           code for handling WorldTransform calls.
    180           (WebCore::GraphicsContextPlatformPrivate::concatCTM):  Change
    181           implementation so that it only handles WorldTransform.  The
    182           Cairo update is done in GraphicsContextCairo.cpp
    183         * platform/graphics/win/GraphicsContextWin.cpp:  Call platform-private
    184           methods to keep WorldTransform in sync.
    185         (WebCore::GraphicsContextPlatformPrivate::save):
    186         (WebCore::GraphicsContextPlatformPrivate::restore):
    187         (WebCore::GraphicsContextPlatformPrivate::clip):
    188         (WebCore::GraphicsContextPlatformPrivate::scale):
    189         (WebCore::GraphicsContextPlatformPrivate::rotate):
    190         (WebCore::GraphicsContextPlatformPrivate::translate):
    191         * platform/win/DragImageCairoWin.cpp:
    192         (WebCore::createDragImageFromImage):  Correct uninitialized value
    193148
    1941492008-02-22  Sam Weinig  <sam@webkit.org>
  • trunk/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp

    r30500 r30513  
    104104{
    105105    cairo_save(m_data->cr);
    106     m_data->save();
    107106}
    108107
     
    110109{
    111110    cairo_restore(m_data->cr);
    112     m_data->restore();
    113111}
    114112
     
    383381    cairo_clip(cr);
    384382    cairo_set_fill_rule(cr, savedFillRule);
    385     m_data->clip(rect);
    386383}
    387384
     
    435432        return;
    436433
     434#if PLATFORM(GTK)
    437435    cairo_t* cr = m_data->cr;
    438436    cairo_save(cr);
     
    445443        cairo_set_source_rgb(cr, 1, 0, 0);
    446444
    447 #if PLATFORM(GTK)
    448445    // We ignore most of the provided constants in favour of the platform style
    449446    pango_cairo_show_error_underline(cr, origin.x(), origin.y(), width, cMisspellingLineThickness);
     447
     448    cairo_restore(cr);
    450449#else
    451450    notImplemented();
    452451#endif
    453 
    454     cairo_restore(cr);
    455452}
    456453
     
    485482    cairo_t* cr = m_data->cr;
    486483    cairo_translate(cr, x, y);
    487     m_data->translate(x, y);
    488484}
    489485
     
    549545}
    550546
     547#if PLATFORM(GTK)
     548// FIXME:  This should be moved to something like GraphicsContextCairoGTK.cpp,
     549// as there is a Windows implementation in platform/graphics/win/GraphicsContextCairoWin.cpp
    551550void GraphicsContext::concatCTM(const AffineTransform& transform)
    552551{
     
    557556    const cairo_matrix_t* matrix = reinterpret_cast<const cairo_matrix_t*>(&transform);
    558557    cairo_transform(cr, matrix);
    559     m_data->concatCTM(transform);
    560 }
     558}
     559#endif
    561560
    562561void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness)
     
    602601    cairo_push_group(cr);
    603602    m_data->layers.append(opacity);
    604     m_data->beginTransparencyLayer();
    605603}
    606604
     
    615613    cairo_paint_with_alpha(cr, m_data->layers.last());
    616614    m_data->layers.removeLast();
    617     m_data->endTransparencyLayer();
    618615}
    619616
     
    777774    cairo_clip(cr);
    778775    cairo_set_fill_rule(cr, savedFillRule);
    779     m_data->clip(path);
    780776}
    781777
     
    803799
    804800    cairo_rotate(m_data->cr, radians);
    805     m_data->rotate(radians);
    806801}
    807802
     
    812807
    813808    cairo_scale(m_data->cr, size.width(), size.height());
    814     m_data->scale(size);
    815809}
    816810
  • trunk/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h

    r30500 r30513  
    6363#if PLATFORM(WIN)
    6464    // On Windows, we need to update the HDC for form controls to draw in the right place.
    65     void save();
    66     void restore();
    67     void clip(const IntRect&);
    68     void clip(const Path&);
    69     void scale(const FloatSize&);
    70     void rotate(float);
    71     void translate(float, float);
    72     void concatCTM(const AffineTransform&);
    7365    void beginTransparencyLayer() { m_transparencyCount++; }
    7466    void endTransparencyLayer() { m_transparencyCount--; }
  • trunk/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp

    r30500 r30513  
    169169}
    170170
     171void GraphicsContextPlatformPrivate::save()
     172{
     173    if (!m_hdc)
     174        return;
     175    SaveDC(m_hdc);
     176}
     177
     178void GraphicsContextPlatformPrivate::restore()
     179{
     180    if (!m_hdc)
     181        return;
     182    RestoreDC(m_hdc, -1);
     183}
     184
     185void GraphicsContextPlatformPrivate::clip(const IntRect& clipRect)
     186{
     187    if (!m_hdc)
     188        return;
     189    IntersectClipRect(m_hdc, clipRect.x(), clipRect.y(), clipRect.right(), clipRect.bottom());
     190}
     191
     192void GraphicsContextPlatformPrivate::clip(const Path&)
     193{
     194    notImplemented();
     195}
     196
     197void GraphicsContextPlatformPrivate::scale(const FloatSize& size)
     198{
     199    if (!m_hdc)
     200        return;
     201    XFORM xform;
     202    xform.eM11 = size.width();
     203    xform.eM12 = 0.0f;
     204    xform.eM21 = 0.0f;
     205    xform.eM22 = size.height();
     206    xform.eDx = 0.0f;
     207    xform.eDy = 0.0f;
     208    ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY);
     209}
     210
     211static const double deg2rad = 0.017453292519943295769; // pi/180
     212
     213void GraphicsContextPlatformPrivate::rotate(float degreesAngle)
     214{
     215    float radiansAngle = degreesAngle * deg2rad;
     216    float cosAngle = cosf(radiansAngle);
     217    float sinAngle = sinf(radiansAngle);
     218    XFORM xform;
     219    xform.eM11 = cosAngle;
     220    xform.eM12 = -sinAngle;
     221    xform.eM21 = sinAngle;
     222    xform.eM22 = cosAngle;
     223    xform.eDx = 0.0f;
     224    xform.eDy = 0.0f;
     225    ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY);
     226}
     227
     228void GraphicsContextPlatformPrivate::translate(float x , float y)
     229{
     230    if (!m_hdc)
     231        return;
     232    XFORM xform;
     233    xform.eM11 = 1.0f;
     234    xform.eM12 = 0.0f;
     235    xform.eM21 = 0.0f;
     236    xform.eM22 = 1.0f;
     237    xform.eDx = x;
     238    xform.eDy = y;
     239    ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY);
     240}
     241
    171242void GraphicsContextPlatformPrivate::concatCTM(const AffineTransform& transform)
    172243{
  • trunk/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp

    r30500 r30513  
    9393}
    9494
    95 void GraphicsContextPlatformPrivate::concatCTM(const AffineTransform& transform)
     95void GraphicsContext::concatCTM(const AffineTransform& transform)
    9696{
    97     cairo_surface_t* surface = cairo_get_target(cr);
     97    cairo_surface_t* surface = cairo_get_target(platformContext());
    9898    HDC hdc = cairo_win32_surface_get_dc(surface);   
    9999    SaveDC(hdc);
    100100
    101     const cairo_matrix_t* matrix = reinterpret_cast<const cairo_matrix_t*>(&transform);
    102 
     101    cairo_matrix_t mat;
     102    cairo_get_matrix(platformContext(), &mat);
    103103    XFORM xform;
    104     xform.eM11 = matrix->xx;
    105     xform.eM12 = matrix->xy;
    106     xform.eM21 = matrix->yx;
    107     xform.eM22 = matrix->yy;
    108     xform.eDx = matrix->x0;
    109     xform.eDy = matrix->y0;
     104    xform.eM11 = mat.xx;
     105    xform.eM12 = mat.xy;
     106    xform.eM21 = mat.yx;
     107    xform.eM22 = mat.yy;
     108    xform.eDx = mat.x0;
     109    xform.eDy = mat.y0;
    110110
    111111    ModifyWorldTransform(hdc, &xform, MWT_LEFTMULTIPLY);
  • trunk/WebCore/platform/graphics/win/GraphicsContextWin.cpp

    r30500 r30513  
    2727#include "GraphicsContext.h"
    2828
    29 #if PLATFORM(CG)
    30 #include "GraphicsContextPlatformPrivateCG.h"
    31 #elif PLATFORM(CAIRO)
    32 #include "GraphicsContextPlatformPrivateCairo.h"
    33 #endif
    34 
    3529#include "AffineTransform.h"
    3630#include "NotImplemented.h"
     
    4438class SVGResourceImage;
    4539
    46 void GraphicsContextPlatformPrivate::save()
    47 {
    48     if (!m_hdc)
    49         return;
    50     SaveDC(m_hdc);
    51 }
    52 
    53 void GraphicsContextPlatformPrivate::restore()
    54 {
    55     if (!m_hdc)
    56         return;
    57     RestoreDC(m_hdc, -1);
    58 }
    59 
    60 void GraphicsContextPlatformPrivate::clip(const IntRect& clipRect)
    61 {
    62     if (!m_hdc)
    63         return;
    64     IntersectClipRect(m_hdc, clipRect.x(), clipRect.y(), clipRect.right(), clipRect.bottom());
    65 }
    66 
    67 void GraphicsContextPlatformPrivate::clip(const Path&)
    68 {
    69     notImplemented();
    70 }
    71 
    72 void GraphicsContextPlatformPrivate::scale(const FloatSize& size)
    73 {
    74     if (!m_hdc)
    75         return;
    76     XFORM xform;
    77     xform.eM11 = size.width();
    78     xform.eM12 = 0.0f;
    79     xform.eM21 = 0.0f;
    80     xform.eM22 = size.height();
    81     xform.eDx = 0.0f;
    82     xform.eDy = 0.0f;
    83     ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY);
    84 }
    85 
    86 static const double deg2rad = 0.017453292519943295769; // pi/180
    87 
    88 void GraphicsContextPlatformPrivate::rotate(float degreesAngle)
    89 {
    90     float radiansAngle = degreesAngle * deg2rad;
    91     float cosAngle = cosf(radiansAngle);
    92     float sinAngle = sinf(radiansAngle);
    93     XFORM xform;
    94     xform.eM11 = cosAngle;
    95     xform.eM12 = -sinAngle;
    96     xform.eM21 = sinAngle;
    97     xform.eM22 = cosAngle;
    98     xform.eDx = 0.0f;
    99     xform.eDy = 0.0f;
    100     ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY);
    101 }
    102 
    103 void GraphicsContextPlatformPrivate::translate(float x , float y)
    104 {
    105     if (!m_hdc)
    106         return;
    107     XFORM xform;
    108     xform.eM11 = 1.0f;
    109     xform.eM12 = 0.0f;
    110     xform.eM21 = 0.0f;
    111     xform.eM22 = 1.0f;
    112     xform.eDx = x;
    113     xform.eDy = y;
    114     ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY);
    115 }
    116 
    11740#if ENABLE(SVG)
    11841GraphicsContext* contextForImage(SVGResourceImage*)
  • trunk/WebCore/platform/win/DragImageCairoWin.cpp

    r30500 r30513  
    4848    notImplemented();
    4949
    50     return 0;
     50    DragImageRef temp;
     51    return temp;
    5152}
    5253   
Note: See TracChangeset for help on using the changeset viewer.