Changeset 73496 in webkit


Ignore:
Timestamp:
Dec 8, 2010 1:35:04 AM (13 years ago)
Author:
yutak@chromium.org
Message:

2010-12-08 Yuta Kitamura <yutak@chromium.org>

Unreviewed, rolling out r73492.
http://trac.webkit.org/changeset/73492
https://bugs.webkit.org/show_bug.cgi?id=49914

Caused a lot of pixel test failures and broke Windows build.

  • WebCore.xcodeproj/project.pbxproj:
  • platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::createGraphicsContextPrivate): (WebCore::GraphicsContext::destroyGraphicsContextPrivate): (WebCore::GraphicsContext::save): (WebCore::GraphicsContext::restore): (WebCore::GraphicsContext::setStrokeThickness): (WebCore::GraphicsContext::setStrokeStyle): (WebCore::GraphicsContext::setStrokeColor): (WebCore::GraphicsContext::setShadow): (WebCore::GraphicsContext::clearShadow): (WebCore::GraphicsContext::getShadow): (WebCore::GraphicsContext::strokeThickness): (WebCore::GraphicsContext::strokeStyle): (WebCore::GraphicsContext::strokeColor): (WebCore::GraphicsContext::strokeColorSpace): (WebCore::GraphicsContext::fillRule): (WebCore::GraphicsContext::setFillRule): (WebCore::GraphicsContext::setFillColor): (WebCore::GraphicsContext::fillColor): (WebCore::GraphicsContext::fillColorSpace): (WebCore::GraphicsContext::setShouldAntialias): (WebCore::GraphicsContext::shouldAntialias): (WebCore::GraphicsContext::setStrokePattern): (WebCore::GraphicsContext::setFillPattern): (WebCore::GraphicsContext::setStrokeGradient): (WebCore::GraphicsContext::setFillGradient): (WebCore::GraphicsContext::fillGradient): (WebCore::GraphicsContext::strokeGradient): (WebCore::GraphicsContext::fillPattern): (WebCore::GraphicsContext::strokePattern): (WebCore::GraphicsContext::setShadowsIgnoreTransforms): (WebCore::GraphicsContext::updatingControlTints): (WebCore::GraphicsContext::setUpdatingControlTints): (WebCore::GraphicsContext::setPaintingDisabled): (WebCore::GraphicsContext::paintingDisabled): (WebCore::GraphicsContext::textDrawingMode): (WebCore::GraphicsContext::setTextDrawingMode):
  • platform/graphics/GraphicsContext.h:
  • platform/graphics/GraphicsContextPrivate.h: Added. (WebCore::GraphicsContextState::GraphicsContextState): (WebCore::GraphicsContextPrivate::GraphicsContextPrivate):
  • platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::setPlatformFill): (WebCore::setPlatformStroke): (WebCore::drawPathShadow): (WebCore::fillCurrentCairoPath): (WebCore::strokeCurrentCairoPath): (WebCore::GraphicsContext::GraphicsContext): (WebCore::GraphicsContext::~GraphicsContext): (WebCore::GraphicsContext::fillPath): (WebCore::GraphicsContext::strokePath): (WebCore::GraphicsContext::fillRect): (WebCore::GraphicsContext::setPlatformShadow): (WebCore::GraphicsContext::strokeRect): (WebCore::GraphicsContext::setAlpha): (WebCore::GraphicsContext::getAlpha):
  • platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::GraphicsContext::GraphicsContext): (WebCore::GraphicsContext::~GraphicsContext): (WebCore::GraphicsContext::applyStrokePattern): (WebCore::GraphicsContext::applyFillPattern): (WebCore::GraphicsContext::drawPath): (WebCore::GraphicsContext::fillPath): (WebCore::GraphicsContext::strokePath): (WebCore::GraphicsContext::fillRect): (WebCore::GraphicsContext::setPlatformShadow): (WebCore::GraphicsContext::strokeRect):
  • platform/graphics/haiku/GraphicsContextHaiku.cpp: (WebCore::GraphicsContext::GraphicsContext): (WebCore::GraphicsContext::~GraphicsContext):
  • platform/graphics/openvg/GraphicsContextOpenVG.cpp: (WebCore::GraphicsContext::GraphicsContext): (WebCore::GraphicsContext::~GraphicsContext): (WebCore::GraphicsContext::fillPath): (WebCore::GraphicsContext::strokePath): (WebCore::GraphicsContext::clip): (WebCore::GraphicsContext::clipOut): (WebCore::GraphicsContext::addInnerRoundedRectClip):
  • platform/graphics/qt/GraphicsContextQt.cpp: (WebCore::GraphicsContext::GraphicsContext): (WebCore::GraphicsContext::~GraphicsContext): (WebCore::GraphicsContext::fillPath): (WebCore::GraphicsContext::strokePath): (WebCore::GraphicsContext::fillRect): (WebCore::GraphicsContext::setPlatformShadow):
  • platform/graphics/skia/GraphicsContextSkia.cpp: (WebCore::GraphicsContext::GraphicsContext): (WebCore::GraphicsContext::~GraphicsContext): (WebCore::GraphicsContext::fillPath): (WebCore::GraphicsContext::setPlatformShadow):
  • platform/graphics/win/GraphicsContextCGWin.cpp: (WebCore::GraphicsContext::GraphicsContext):
  • platform/graphics/win/GraphicsContextCairoWin.cpp: (WebCore::GraphicsContext::GraphicsContext):
  • platform/graphics/wince/GraphicsContextWinCE.cpp: (WebCore::GraphicsContext::GraphicsContext): (WebCore::GraphicsContext::~GraphicsContext): (WebCore::GraphicsContext::fillPath): (WebCore::GraphicsContext::fillRect):
  • platform/graphics/wx/GraphicsContextWx.cpp: (WebCore::GraphicsContext::GraphicsContext): (WebCore::GraphicsContext::~GraphicsContext):
Location:
trunk/WebCore
Files:
1 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r73494 r73496  
     12010-12-08  Yuta Kitamura  <yutak@chromium.org>
     2
     3        Unreviewed, rolling out r73492.
     4        http://trac.webkit.org/changeset/73492
     5        https://bugs.webkit.org/show_bug.cgi?id=49914
     6
     7        Caused a lot of pixel test failures and broke Windows build.
     8
     9        * WebCore.xcodeproj/project.pbxproj:
     10        * platform/graphics/GraphicsContext.cpp:
     11        (WebCore::GraphicsContext::createGraphicsContextPrivate):
     12        (WebCore::GraphicsContext::destroyGraphicsContextPrivate):
     13        (WebCore::GraphicsContext::save):
     14        (WebCore::GraphicsContext::restore):
     15        (WebCore::GraphicsContext::setStrokeThickness):
     16        (WebCore::GraphicsContext::setStrokeStyle):
     17        (WebCore::GraphicsContext::setStrokeColor):
     18        (WebCore::GraphicsContext::setShadow):
     19        (WebCore::GraphicsContext::clearShadow):
     20        (WebCore::GraphicsContext::getShadow):
     21        (WebCore::GraphicsContext::strokeThickness):
     22        (WebCore::GraphicsContext::strokeStyle):
     23        (WebCore::GraphicsContext::strokeColor):
     24        (WebCore::GraphicsContext::strokeColorSpace):
     25        (WebCore::GraphicsContext::fillRule):
     26        (WebCore::GraphicsContext::setFillRule):
     27        (WebCore::GraphicsContext::setFillColor):
     28        (WebCore::GraphicsContext::fillColor):
     29        (WebCore::GraphicsContext::fillColorSpace):
     30        (WebCore::GraphicsContext::setShouldAntialias):
     31        (WebCore::GraphicsContext::shouldAntialias):
     32        (WebCore::GraphicsContext::setStrokePattern):
     33        (WebCore::GraphicsContext::setFillPattern):
     34        (WebCore::GraphicsContext::setStrokeGradient):
     35        (WebCore::GraphicsContext::setFillGradient):
     36        (WebCore::GraphicsContext::fillGradient):
     37        (WebCore::GraphicsContext::strokeGradient):
     38        (WebCore::GraphicsContext::fillPattern):
     39        (WebCore::GraphicsContext::strokePattern):
     40        (WebCore::GraphicsContext::setShadowsIgnoreTransforms):
     41        (WebCore::GraphicsContext::updatingControlTints):
     42        (WebCore::GraphicsContext::setUpdatingControlTints):
     43        (WebCore::GraphicsContext::setPaintingDisabled):
     44        (WebCore::GraphicsContext::paintingDisabled):
     45        (WebCore::GraphicsContext::textDrawingMode):
     46        (WebCore::GraphicsContext::setTextDrawingMode):
     47        * platform/graphics/GraphicsContext.h:
     48        * platform/graphics/GraphicsContextPrivate.h: Added.
     49        (WebCore::GraphicsContextState::GraphicsContextState):
     50        (WebCore::GraphicsContextPrivate::GraphicsContextPrivate):
     51        * platform/graphics/cairo/GraphicsContextCairo.cpp:
     52        (WebCore::setPlatformFill):
     53        (WebCore::setPlatformStroke):
     54        (WebCore::drawPathShadow):
     55        (WebCore::fillCurrentCairoPath):
     56        (WebCore::strokeCurrentCairoPath):
     57        (WebCore::GraphicsContext::GraphicsContext):
     58        (WebCore::GraphicsContext::~GraphicsContext):
     59        (WebCore::GraphicsContext::fillPath):
     60        (WebCore::GraphicsContext::strokePath):
     61        (WebCore::GraphicsContext::fillRect):
     62        (WebCore::GraphicsContext::setPlatformShadow):
     63        (WebCore::GraphicsContext::strokeRect):
     64        (WebCore::GraphicsContext::setAlpha):
     65        (WebCore::GraphicsContext::getAlpha):
     66        * platform/graphics/cg/GraphicsContextCG.cpp:
     67        (WebCore::GraphicsContext::GraphicsContext):
     68        (WebCore::GraphicsContext::~GraphicsContext):
     69        (WebCore::GraphicsContext::applyStrokePattern):
     70        (WebCore::GraphicsContext::applyFillPattern):
     71        (WebCore::GraphicsContext::drawPath):
     72        (WebCore::GraphicsContext::fillPath):
     73        (WebCore::GraphicsContext::strokePath):
     74        (WebCore::GraphicsContext::fillRect):
     75        (WebCore::GraphicsContext::setPlatformShadow):
     76        (WebCore::GraphicsContext::strokeRect):
     77        * platform/graphics/haiku/GraphicsContextHaiku.cpp:
     78        (WebCore::GraphicsContext::GraphicsContext):
     79        (WebCore::GraphicsContext::~GraphicsContext):
     80        * platform/graphics/openvg/GraphicsContextOpenVG.cpp:
     81        (WebCore::GraphicsContext::GraphicsContext):
     82        (WebCore::GraphicsContext::~GraphicsContext):
     83        (WebCore::GraphicsContext::fillPath):
     84        (WebCore::GraphicsContext::strokePath):
     85        (WebCore::GraphicsContext::clip):
     86        (WebCore::GraphicsContext::clipOut):
     87        (WebCore::GraphicsContext::addInnerRoundedRectClip):
     88        * platform/graphics/qt/GraphicsContextQt.cpp:
     89        (WebCore::GraphicsContext::GraphicsContext):
     90        (WebCore::GraphicsContext::~GraphicsContext):
     91        (WebCore::GraphicsContext::fillPath):
     92        (WebCore::GraphicsContext::strokePath):
     93        (WebCore::GraphicsContext::fillRect):
     94        (WebCore::GraphicsContext::setPlatformShadow):
     95        * platform/graphics/skia/GraphicsContextSkia.cpp:
     96        (WebCore::GraphicsContext::GraphicsContext):
     97        (WebCore::GraphicsContext::~GraphicsContext):
     98        (WebCore::GraphicsContext::fillPath):
     99        (WebCore::GraphicsContext::setPlatformShadow):
     100        * platform/graphics/win/GraphicsContextCGWin.cpp:
     101        (WebCore::GraphicsContext::GraphicsContext):
     102        * platform/graphics/win/GraphicsContextCairoWin.cpp:
     103        (WebCore::GraphicsContext::GraphicsContext):
     104        * platform/graphics/wince/GraphicsContextWinCE.cpp:
     105        (WebCore::GraphicsContext::GraphicsContext):
     106        (WebCore::GraphicsContext::~GraphicsContext):
     107        (WebCore::GraphicsContext::fillPath):
     108        (WebCore::GraphicsContext::fillRect):
     109        * platform/graphics/wx/GraphicsContextWx.cpp:
     110        (WebCore::GraphicsContext::GraphicsContext):
     111        (WebCore::GraphicsContext::~GraphicsContext):
     112
    11132010-12-08  Dai Mikurube  <dmikurube@google.com>
    2114
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r73492 r73496  
    39273927                A8F5C0B80F9285AC0098E06B /* RenderSVGModelObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A8F5C0B60F9285AC0098E06B /* RenderSVGModelObject.h */; };
    39283928                A8F5C0B90F9285AC0098E06B /* RenderSVGModelObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8F5C0B70F9285AC0098E06B /* RenderSVGModelObject.cpp */; };
    3929                 A8FA6E5D0E4CFDED00D5CF49 /* Pattern.h in Headers */ = {isa = PBXBuildFile; fileRef = A8FA6E5B0E4CFDED00D5CF49 /* Pattern.h */; settings = {ATTRIBUTES = (Private, ); }; };
     3929                A8FA6E5D0E4CFDED00D5CF49 /* Pattern.h in Headers */ = {isa = PBXBuildFile; fileRef = A8FA6E5B0E4CFDED00D5CF49 /* Pattern.h */; };
    39303930                A8FA6E5E0E4CFDED00D5CF49 /* Pattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8FA6E5C0E4CFDED00D5CF49 /* Pattern.cpp */; };
    39313931                A9C6E4E30D745E05006442E9 /* DOMMimeType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9C6E4E10D745E05006442E9 /* DOMMimeType.cpp */; };
  • trunk/WebCore/platform/graphics/GraphicsContext.cpp

    r73492 r73496  
    3030#include "Font.h"
    3131#include "Generator.h"
     32#include "GraphicsContextPrivate.h"
    3233#include "ImageBuffer.h"
    3334
     
    7475};
    7576
    76 GraphicsContext::GraphicsContext(PlatformGraphicsContext* platformGraphicsContext)
    77 {
    78     platformInit(platformGraphicsContext);
    79 }
    80 
    81 GraphicsContext::~GraphicsContext()
    82 {
    83     platformDestroy();
     77GraphicsContextPrivate* GraphicsContext::createGraphicsContextPrivate()
     78{
     79    return new GraphicsContextPrivate;
     80}
     81
     82void GraphicsContext::destroyGraphicsContextPrivate(GraphicsContextPrivate* deleteMe)
     83{
     84    delete deleteMe;
    8485}
    8586
     
    8990        return;
    9091
    91     m_stack.append(m_state);
     92    m_common->stack.append(m_common->state);
    9293
    9394    savePlatformState();
     
    99100        return;
    100101
    101     if (m_stack.isEmpty()) {
     102    if (m_common->stack.isEmpty()) {
    102103        LOG_ERROR("ERROR void GraphicsContext::restore() stack is empty");
    103104        return;
    104105    }
    105     m_state = m_stack.last();
    106     m_stack.removeLast();
     106    m_common->state = m_common->stack.last();
     107    m_common->stack.removeLast();
    107108
    108109    restorePlatformState();
     
    111112void GraphicsContext::setStrokeThickness(float thickness)
    112113{
    113     m_state.strokeThickness = thickness;
     114    m_common->state.strokeThickness = thickness;
    114115    setPlatformStrokeThickness(thickness);
    115116}
     
    117118void GraphicsContext::setStrokeStyle(const StrokeStyle& style)
    118119{
    119     m_state.strokeStyle = style;
     120    m_common->state.strokeStyle = style;
    120121    setPlatformStrokeStyle(style);
    121122}
     
    123124void GraphicsContext::setStrokeColor(const Color& color, ColorSpace colorSpace)
    124125{
    125     m_state.strokeColor = color;
    126     m_state.strokeColorSpace = colorSpace;
    127     m_state.strokeGradient.clear();
    128     m_state.strokePattern.clear();
     126    m_common->state.strokeColor = color;
     127    m_common->state.strokeColorSpace = colorSpace;
     128    m_common->state.strokeGradient.clear();
     129    m_common->state.strokePattern.clear();
    129130    setPlatformStrokeColor(color, colorSpace);
    130131}
     
    132133void GraphicsContext::setShadow(const FloatSize& offset, float blur, const Color& color, ColorSpace colorSpace)
    133134{
    134     m_state.shadowOffset = offset;
    135     m_state.shadowBlur = blur;
    136     m_state.shadowColor = color;
     135    m_common->state.shadowOffset = offset;
     136    m_common->state.shadowBlur = blur;
     137    m_common->state.shadowColor = color;
    137138    setPlatformShadow(offset, blur, color, colorSpace);
    138139}
     
    140141void GraphicsContext::clearShadow()
    141142{
    142     m_state.shadowOffset = FloatSize();
    143     m_state.shadowBlur = 0;
    144     m_state.shadowColor = Color();
     143    m_common->state.shadowOffset = FloatSize();
     144    m_common->state.shadowBlur = 0;
     145    m_common->state.shadowColor = Color();
    145146    clearPlatformShadow();
    146147}
     
    148149bool GraphicsContext::getShadow(FloatSize& offset, float& blur, Color& color) const
    149150{
    150     offset = m_state.shadowOffset;
    151     blur = m_state.shadowBlur;
    152     color = m_state.shadowColor;
     151    offset = m_common->state.shadowOffset;
     152    blur = m_common->state.shadowBlur;
     153    color = m_common->state.shadowColor;
    153154
    154155    return color.isValid() && color.alpha() && (blur || offset.width() || offset.height());
     
    157158float GraphicsContext::strokeThickness() const
    158159{
    159     return m_state.strokeThickness;
     160    return m_common->state.strokeThickness;
    160161}
    161162
    162163StrokeStyle GraphicsContext::strokeStyle() const
    163164{
    164     return m_state.strokeStyle;
     165    return m_common->state.strokeStyle;
    165166}
    166167
    167168Color GraphicsContext::strokeColor() const
    168169{
    169     return m_state.strokeColor;
     170    return m_common->state.strokeColor;
    170171}
    171172
    172173ColorSpace GraphicsContext::strokeColorSpace() const
    173174{
    174     return m_state.strokeColorSpace;
     175    return m_common->state.strokeColorSpace;
    175176}
    176177
    177178WindRule GraphicsContext::fillRule() const
    178179{
    179     return m_state.fillRule;
     180    return m_common->state.fillRule;
    180181}
    181182
    182183void GraphicsContext::setFillRule(WindRule fillRule)
    183184{
    184     m_state.fillRule = fillRule;
     185    m_common->state.fillRule = fillRule;
    185186}
    186187
    187188void GraphicsContext::setFillColor(const Color& color, ColorSpace colorSpace)
    188189{
    189     m_state.fillColor = color;
    190     m_state.fillColorSpace = colorSpace;
    191     m_state.fillGradient.clear();
    192     m_state.fillPattern.clear();
     190    m_common->state.fillColor = color;
     191    m_common->state.fillColorSpace = colorSpace;
     192    m_common->state.fillGradient.clear();
     193    m_common->state.fillPattern.clear();
    193194    setPlatformFillColor(color, colorSpace);
    194195}
     
    196197Color GraphicsContext::fillColor() const
    197198{
    198     return m_state.fillColor;
     199    return m_common->state.fillColor;
    199200}
    200201
    201202ColorSpace GraphicsContext::fillColorSpace() const
    202203{
    203     return m_state.fillColorSpace;
     204    return m_common->state.fillColorSpace;
    204205}
    205206
    206207void GraphicsContext::setShouldAntialias(bool b)
    207208{
    208     m_state.shouldAntialias = b;
     209    m_common->state.shouldAntialias = b;
    209210    setPlatformShouldAntialias(b);
    210211}
     
    212213bool GraphicsContext::shouldAntialias() const
    213214{
    214     return m_state.shouldAntialias;
    215 }
    216 
    217 const GraphicsContextState& GraphicsContext::state() const
    218 {
    219     return m_state;
     215    return m_common->state.shouldAntialias;
    220216}
    221217
     
    227223        return;
    228224    }
    229     m_state.strokeGradient.clear();
    230     m_state.strokePattern = pattern;
    231     setPlatformStrokePattern(m_state.strokePattern.get());
     225    m_common->state.strokeGradient.clear();
     226    m_common->state.strokePattern = pattern;
     227    setPlatformStrokePattern(m_common->state.strokePattern.get());
    232228}
    233229
     
    239235        return;
    240236    }
    241     m_state.fillGradient.clear();
    242     m_state.fillPattern = pattern;
    243     setPlatformFillPattern(m_state.fillPattern.get());
     237    m_common->state.fillGradient.clear();
     238    m_common->state.fillPattern = pattern;
     239    setPlatformFillPattern(m_common->state.fillPattern.get());
    244240}
    245241
     
    251247        return;
    252248    }
    253     m_state.strokeGradient = gradient;
    254     m_state.strokePattern.clear();
    255     setPlatformStrokeGradient(m_state.strokeGradient.get());
     249    m_common->state.strokeGradient = gradient;
     250    m_common->state.strokePattern.clear();
     251    setPlatformStrokeGradient(m_common->state.strokeGradient.get());
    256252}
    257253
     
    263259        return;
    264260    }
    265     m_state.fillGradient = gradient;
    266     m_state.fillPattern.clear();
    267     setPlatformFillGradient(m_state.fillGradient.get());
     261    m_common->state.fillGradient = gradient;
     262    m_common->state.fillPattern.clear();
     263    setPlatformFillGradient(m_common->state.fillGradient.get());
    268264}
    269265
    270266Gradient* GraphicsContext::fillGradient() const
    271267{
    272     return m_state.fillGradient.get();
     268    return m_common->state.fillGradient.get();
    273269}
    274270
    275271Gradient* GraphicsContext::strokeGradient() const
    276272{
    277     return m_state.strokeGradient.get();
     273    return m_common->state.strokeGradient.get();
    278274}
    279275
    280276Pattern* GraphicsContext::fillPattern() const
    281277{
    282     return m_state.fillPattern.get();
     278    return m_common->state.fillPattern.get();
    283279}
    284280
    285281Pattern* GraphicsContext::strokePattern() const
    286282{
    287     return m_state.strokePattern.get();
     283    return m_common->state.strokePattern.get();
    288284}
    289285
    290286void GraphicsContext::setShadowsIgnoreTransforms(bool ignoreTransforms)
    291287{
    292     m_state.shadowsIgnoreTransforms = ignoreTransforms;
     288    m_common->state.shadowsIgnoreTransforms = ignoreTransforms;
    293289}
    294290
    295291bool GraphicsContext::updatingControlTints() const
    296292{
    297     return m_updatingControlTints;
     293    return m_common->m_updatingControlTints;
    298294}
    299295
     
    301297{
    302298    setPaintingDisabled(b);
    303     m_updatingControlTints = b;
     299    m_common->m_updatingControlTints = b;
    304300}
    305301
    306302void GraphicsContext::setPaintingDisabled(bool f)
    307303{
    308     m_state.paintingDisabled = f;
     304    m_common->state.paintingDisabled = f;
    309305}
    310306
    311307bool GraphicsContext::paintingDisabled() const
    312308{
    313     return m_state.paintingDisabled;
     309    return m_common->state.paintingDisabled;
    314310}
    315311
     
    533529TextDrawingModeFlags GraphicsContext::textDrawingMode() const
    534530{
    535     return m_state.textDrawingMode;
     531    return m_common->state.textDrawingMode;
    536532}
    537533
    538534void GraphicsContext::setTextDrawingMode(TextDrawingModeFlags mode)
    539535{
    540     m_state.textDrawingMode = mode;
     536    m_common->state.textDrawingMode = mode;
    541537    if (paintingDisabled())
    542538        return;
  • trunk/WebCore/platform/graphics/GraphicsContext.h

    r73492 r73496  
    3131#include "DashArray.h"
    3232#include "FloatRect.h"
    33 #include "Gradient.h"
    3433#include "Image.h"
    3534#include "IntRect.h"
    3635#include "Path.h"
    37 #include "Pattern.h"
    3836#include "TextDirection.h"
    3937#include <wtf/Noncopyable.h>
     
    120118    class Font;
    121119    class Generator;
     120    class Gradient;
    122121    class GraphicsContextPlatformPrivate;
     122    class GraphicsContextPrivate;
    123123    class ImageBuffer;
    124124    class KURL;
     125    class Pattern;
    125126    class SharedGraphicsContext3D;
    126127    class TextRun;
     
    149150    };
    150151
    151     struct GraphicsContextState {
    152         GraphicsContextState()
    153             : strokeThickness(0)
    154             , shadowBlur(0)
    155 #if PLATFORM(CAIRO)
    156             , globalAlpha(1)
    157 #endif
    158             , textDrawingMode(TextModeFill)
    159             , strokeColor(Color::black)
    160             , fillColor(Color::black)
    161             , strokeStyle(SolidStroke)
    162             , fillRule(RULE_NONZERO)
    163             , strokeColorSpace(ColorSpaceDeviceRGB)
    164             , fillColorSpace(ColorSpaceDeviceRGB)
    165             , shouldAntialias(true)
    166             , paintingDisabled(false)
    167             , shadowsIgnoreTransforms(false)
    168         {
    169         }
    170 
    171         RefPtr<Gradient> strokeGradient;
    172         RefPtr<Pattern> strokePattern;
    173        
    174         RefPtr<Gradient> fillGradient;
    175         RefPtr<Pattern> fillPattern;
    176 
    177         FloatSize shadowOffset;
    178 
    179         float strokeThickness;
    180         float shadowBlur;
    181 
    182 #if PLATFORM(CAIRO)
    183         float globalAlpha;
    184 #endif
    185         TextDrawingModeFlags textDrawingMode;
    186 
    187         Color strokeColor;
    188         Color fillColor;
    189         Color shadowColor;
    190 
    191         StrokeStyle strokeStyle;
    192         WindRule fillRule;
    193 
    194         ColorSpace strokeColorSpace;
    195         ColorSpace fillColorSpace;
    196 
    197         bool shouldAntialias;
    198         bool paintingDisabled;
    199         bool shadowsIgnoreTransforms;
    200     };
    201 
    202152    class GraphicsContext : public Noncopyable {
    203153    public:
     
    239189        void setShouldAntialias(bool);
    240190        bool shouldAntialias() const;
    241 
    242         const GraphicsContextState& state() const;
    243191
    244192#if PLATFORM(CG)
     
    394342        void drawRoundCorner(bool newClip, RECT clipRect, RECT rectWin, HDC dc, int width, int height);
    395343#elif PLATFORM(WIN)
    396         void platformInit(HDC, bool hasAlpha = false);
     344        GraphicsContext(HDC, bool hasAlpha = false); // FIXME: To be removed.
    397345        bool inTransparencyLayer() const;
    398346        HDC getWindowsContext(const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true); // The passed in rect is used to create a bitmap for compositing inside transparency layers.
     
    471419
    472420    private:
    473         void platformInit(PlatformGraphicsContext*);
    474         void platformDestroy();
    475 
    476421        void savePlatformState();
    477422        void restorePlatformState();
     
    497442        static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, const StrokeStyle&);
    498443
    499         GraphicsContextPlatformPrivate* m_data;
    500 
    501         GraphicsContextState m_state;
    502         Vector<GraphicsContextState> m_stack;
    503         bool m_updatingControlTints;
     444        static GraphicsContextPrivate* createGraphicsContextPrivate();
     445        static void destroyGraphicsContextPrivate(GraphicsContextPrivate*);
     446
     447        GraphicsContextPrivate* m_common;
     448        GraphicsContextPlatformPrivate* m_data; // Deprecated; m_commmon can just be downcasted. To be removed.
    504449    };
    505450
  • trunk/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp

    r73492 r73496  
    4242#include "Font.h"
    4343#include "GraphicsContextPlatformPrivateCairo.h"
     44#include "GraphicsContextPrivate.h"
    4445#include "OwnPtrCairo.h"
    4546#include "IntRect.h"
     
    6970namespace WebCore {
    7071
    71 static inline void setPlatformFill(GraphicsContext* context, cairo_t* cr)
     72static inline void setPlatformFill(GraphicsContext* context, cairo_t* cr, GraphicsContextPrivate* gcp)
    7273{
    7374    cairo_pattern_t* pattern = 0;
    7475    cairo_save(cr);
    75    
    76     const GraphicsContextState& state = context->state();
    77     if (state.fillPattern) {
     76    if (gcp->state.fillPattern) {
    7877        AffineTransform affine;
    79         pattern = state.fillPattern->createPlatformPattern(affine);
     78        pattern = gcp->state.fillPattern->createPlatformPattern(affine);
    8079        cairo_set_source(cr, pattern);
    81     } else if (state.fillGradient)
    82         cairo_set_source(cr, state.fillGradient->platformGradient());
     80    } else if (gcp->state.fillGradient)
     81        cairo_set_source(cr, gcp->state.fillGradient->platformGradient());
    8382    else
    8483        setSourceRGBAFromColor(cr, context->fillColor());
    8584    cairo_clip_preserve(cr);
    86     cairo_paint_with_alpha(cr, state.globalAlpha);
     85    cairo_paint_with_alpha(cr, gcp->state.globalAlpha);
    8786    cairo_restore(cr);
    8887    if (pattern)
     
    9089}
    9190
    92 static inline void setPlatformStroke(GraphicsContext* context, cairo_t* cr)
     91static inline void setPlatformStroke(GraphicsContext* context, cairo_t* cr, GraphicsContextPrivate* gcp)
    9392{
    9493    cairo_pattern_t* pattern = 0;
    9594    cairo_save(cr);
    96    
    97     const GraphicsContextState& state = context->state();
    98     if (state.strokePattern) {
     95    if (gcp->state.strokePattern) {
    9996        AffineTransform affine;
    100         pattern = state.strokePattern->createPlatformPattern(affine);
     97        pattern = gcp->state.strokePattern->createPlatformPattern(affine);
    10198        cairo_set_source(cr, pattern);
    102     } else if (state.strokeGradient)
    103         cairo_set_source(cr, state.strokeGradient->platformGradient());
     99    } else if (gcp->state.strokeGradient)
     100        cairo_set_source(cr, gcp->state.strokeGradient->platformGradient());
    104101    else  {
    105         Color strokeColor = colorWithOverrideAlpha(context->strokeColor().rgb(), context->strokeColor().alpha() / 255.f * state.globalAlpha);
     102        Color strokeColor = colorWithOverrideAlpha(context->strokeColor().rgb(), context->strokeColor().alpha() / 255.f * gcp->state.globalAlpha);
    106103        setSourceRGBAFromColor(cr, strokeColor);
    107104    }
    108     if (state.globalAlpha < 1.0f && (state.strokePattern || state.strokeGradient)) {
     105    if (gcp->state.globalAlpha < 1.0f && (gcp->state.strokePattern || gcp->state.strokeGradient)) {
    109106        cairo_push_group(cr);
    110         cairo_paint_with_alpha(cr, state.globalAlpha);
     107        cairo_paint_with_alpha(cr, gcp->state.globalAlpha);
    111108        cairo_pop_group_to_source(cr);
    112109    }
     
    140137};
    141138
    142 static inline void drawPathShadow(GraphicsContext* context, PathDrawingStyle drawingStyle)
     139static inline void drawPathShadow(GraphicsContext* context, GraphicsContextPrivate* contextPrivate, PathDrawingStyle drawingStyle)
    143140{
    144141    ContextShadow* shadow = context->contextShadow();
     
    176173
    177174    if (drawingStyle & Fill)
    178         setPlatformFill(context, shadowContext);
     175        setPlatformFill(context, shadowContext, contextPrivate);
    179176    if (drawingStyle & Stroke)
    180         setPlatformStroke(context, shadowContext);
     177        setPlatformStroke(context, shadowContext, contextPrivate);
    181178
    182179    shadow->endShadowLayer(cairoContext);
    183180}
    184181
    185 static void fillCurrentCairoPath(GraphicsContext* context, cairo_t* cairoContext)
     182static void fillCurrentCairoPath(GraphicsContext* context, GraphicsContextPrivate* gcp, cairo_t* cairoContext)
    186183{
    187184    cairo_set_fill_rule(cairoContext, context->fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
    188     drawPathShadow(context, Fill);
    189 
    190     setPlatformFill(context, cairoContext);
     185    drawPathShadow(context, gcp, Fill);
     186
     187    setPlatformFill(context, cairoContext, gcp);
    191188    cairo_new_path(cairoContext);
    192189}
    193190
    194 static void strokeCurrentCairoPath(GraphicsContext* context, cairo_t* cairoContext)
    195 {
    196     drawPathShadow(context, Stroke);
    197     setPlatformStroke(context, cairoContext);
     191static void strokeCurrentCairoPath(GraphicsContext* context, GraphicsContextPrivate* gcp, cairo_t* cairoContext)
     192{
     193    drawPathShadow(context, gcp, Stroke);
     194    setPlatformStroke(context, cairoContext, gcp);
    198195    cairo_new_path(cairoContext);
    199196}
    200197
    201 void GraphicsContext::platformInit(PlatformGraphicsContext* cr)
    202 {
    203     m_data = new GraphicsContextPlatformPrivate;
     198GraphicsContext::GraphicsContext(PlatformGraphicsContext* cr)
     199    : m_common(createGraphicsContextPrivate())
     200    , m_data(new GraphicsContextPlatformPrivate)
     201{
    204202    m_data->cr = cairo_reference(cr);
    205203    m_data->syncContext(cr);
     
    207205}
    208206
    209 void GraphicsContext::platformDestroy()
    210 {
     207GraphicsContext::~GraphicsContext()
     208{
     209    destroyGraphicsContextPrivate(m_common);
    211210    delete m_data;
    212211}
     
    534533    cairo_t* cr = m_data->cr;
    535534    setPathOnCairoContext(cr, path.platformPath()->context());
    536     fillCurrentCairoPath(this, cr);
     535    fillCurrentCairoPath(this, m_common, cr);
    537536}
    538537
     
    544543    cairo_t* cr = m_data->cr;
    545544    setPathOnCairoContext(cr, path.platformPath()->context());
    546     strokeCurrentCairoPath(this, cr);
     545    strokeCurrentCairoPath(this, m_common, cr);
    547546}
    548547
     
    555554    cairo_save(cr);
    556555    cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
    557     fillCurrentCairoPath(this, cr);
     556    fillCurrentCairoPath(this, m_common, cr);
    558557    cairo_restore(cr);
    559558}
     
    865864{
    866865    // Cairo doesn't support shadows natively, they are drawn manually in the draw* functions
    867     if (m_state.shadowsIgnoreTransforms) {
     866    if (m_common->state.shadowsIgnoreTransforms) {
    868867        // Meaning that this graphics context is associated with a CanvasRenderingContext
    869868        // We flip the height since CG and HTML5 Canvas have opposite Y axis
    870         m_state.shadowOffset = FloatSize(size.width(), -size.height());
     869        m_common->state.shadowOffset = FloatSize(size.width(), -size.height());
    871870        m_data->shadow = ContextShadow(color, blur, FloatSize(size.width(), -size.height()));
    872871    } else
     
    931930    cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
    932931    cairo_set_line_width(cr, width);
    933     strokeCurrentCairoPath(this, cr);
     932    strokeCurrentCairoPath(this, m_common, cr);
    934933    cairo_restore(cr);
    935934}
     
    990989void GraphicsContext::setAlpha(float alpha)
    991990{
    992     m_state.globalAlpha = alpha;
     991    m_common->state.globalAlpha = alpha;
    993992}
    994993
    995994float GraphicsContext::getAlpha()
    996995{
    997     return m_state.globalAlpha;
     996    return m_common->state.globalAlpha;
    998997}
    999998
  • trunk/WebCore/platform/graphics/cg/GraphicsContextCG.cpp

    r73492 r73496  
    3232#include "FloatConversion.h"
    3333#include "GraphicsContextPlatformPrivateCG.h"
     34#include "GraphicsContextPrivate.h"
    3435#include "ImageBuffer.h"
    3536#include "KURL.h"
     
    108109}
    109110
    110 void GraphicsContext::platformInit(CGContextRef cgContext)
    111 {
    112     m_data = new GraphicsContextPlatformPrivate(cgContext);
     111GraphicsContext::GraphicsContext(CGContextRef cgContext)
     112    : m_common(createGraphicsContextPrivate())
     113    , m_data(new GraphicsContextPlatformPrivate(cgContext))
     114{
    113115    setPaintingDisabled(!cgContext);
    114116    if (cgContext) {
     
    119121}
    120122
    121 void GraphicsContext::platformDestroy()
    122 {
     123GraphicsContext::~GraphicsContext()
     124{
     125    destroyGraphicsContextPrivate(m_common);
    123126    delete m_data;
    124127}
     
    451454    CGContextRef cgContext = platformContext();
    452455
    453     RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_state.strokePattern->createPlatformPattern(getCTM()));
     456    RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_common->state.strokePattern->createPlatformPattern(getCTM()));
    454457    if (!platformPattern)
    455458        return;
     
    466469    CGContextRef cgContext = platformContext();
    467470
    468     RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_state.fillPattern->createPlatformPattern(getCTM()));
     471    RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_common->state.fillPattern->createPlatformPattern(getCTM()));
    469472    if (!platformPattern)
    470473        return;
     
    510513
    511514    CGContextRef context = platformContext();
    512     const GraphicsContextState& state = m_state;
     515    const GraphicsContextState& state = m_common->state;
    513516
    514517    if (state.fillGradient || state.strokeGradient) {
     
    551554    CGContextAddPath(context, path.platformPath());
    552555
    553     if (m_state.fillGradient) {
     556    if (m_common->state.fillGradient) {
    554557        CGContextSaveGState(context);
    555558        if (fillRule() == RULE_EVENODD)
     
    557560        else
    558561            CGContextClip(context);
    559         CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform());
    560         m_state.fillGradient->paint(this);
     562        CGContextConcatCTM(context, m_common->state.fillGradient->gradientSpaceTransform());
     563        m_common->state.fillGradient->paint(this);
    561564        CGContextRestoreGState(context);
    562565        return;
    563566    }
    564567
    565     if (m_state.fillPattern)
     568    if (m_common->state.fillPattern)
    566569        applyFillPattern();
    567570    fillPathWithFillRule(context, fillRule());
     
    578581    CGContextAddPath(context, path.platformPath());
    579582
    580     if (m_state.strokeGradient) {
     583    if (m_common->state.strokeGradient) {
    581584        CGContextSaveGState(context);
    582585        CGContextReplacePathWithStrokedPath(context);
    583586        CGContextClip(context);
    584         CGContextConcatCTM(context, m_state.strokeGradient->gradientSpaceTransform());
    585         m_state.strokeGradient->paint(this);
     587        CGContextConcatCTM(context, m_common->state.strokeGradient->gradientSpaceTransform());
     588        m_common->state.strokeGradient->paint(this);
    586589        CGContextRestoreGState(context);
    587590        return;
    588591    }
    589592
    590     if (m_state.strokePattern)
     593    if (m_common->state.strokePattern)
    591594        applyStrokePattern();
    592595    CGContextStrokePath(context);
     
    600603    CGContextRef context = platformContext();
    601604
    602     if (m_state.fillGradient) {
     605    if (m_common->state.fillGradient) {
    603606        CGContextSaveGState(context);
    604607        CGContextClipToRect(context, rect);
    605         CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform());
    606         m_state.fillGradient->paint(this);
     608        CGContextConcatCTM(context, m_common->state.fillGradient->gradientSpaceTransform());
     609        m_common->state.fillGradient->paint(this);
    607610        CGContextRestoreGState(context);
    608611        return;
    609612    }
    610613
    611     if (m_state.fillPattern)
     614    if (m_common->state.fillPattern)
    612615        applyFillPattern();
    613616    CGContextFillRect(context, rect);
     
    739742    CGContextRef context = platformContext();
    740743
    741     if (!m_state.shadowsIgnoreTransforms) {
     744    if (!m_common->state.shadowsIgnoreTransforms) {
    742745        CGAffineTransform userToBaseCTM = wkGetUserToBaseCTM(context);
    743746
     
    814817    CGContextRef context = platformContext();
    815818
    816     if (m_state.strokeGradient) {
     819    if (m_common->state.strokeGradient) {
    817820        CGContextSaveGState(context);
    818821        setStrokeThickness(lineWidth);
     
    820823        CGContextReplacePathWithStrokedPath(context);
    821824        CGContextClip(context);
    822         m_state.strokeGradient->paint(this);
     825        m_common->state.strokeGradient->paint(this);
    823826        CGContextRestoreGState(context);
    824827        return;
    825828    }
    826829
    827     if (m_state.strokePattern)
     830    if (m_common->state.strokePattern)
    828831        applyStrokePattern();
    829832    CGContextStrokeRectWithWidth(context, r, lineWidth);
  • trunk/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp

    r73492 r73496  
    6363}
    6464
    65 void GraphicsContext::platformInit(PlatformGraphicsContext* context)
    66 {
    67     m_data = new GraphicsContextPlatformPrivate(context);
     65GraphicsContext::GraphicsContext(PlatformGraphicsContext* context)
     66    : m_common(createGraphicsContextPrivate())
     67    , m_data(new GraphicsContextPlatformPrivate(context))
     68{
    6869    setPaintingDisabled(!context);
    6970}
    7071
    71 void GraphicsContext::platformDestroy()
    72 {
     72GraphicsContext::~GraphicsContext()
     73{
     74    destroyGraphicsContextPrivate(m_common);
    7375    delete m_data;
    7476}
  • trunk/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp

    r73492 r73496  
    2222
    2323#include "AffineTransform.h"
     24#include "GraphicsContextPrivate.h"
    2425#include "KURL.h"
    2526#include "NotImplemented.h"
     
    4950};
    5051
    51 void GraphicsContext::platformInit(SurfaceOpenVG* surface)
    52 {
    53     m_data = surface ? new GraphicsContextPlatformPrivate(surface) : 0;
     52GraphicsContext::GraphicsContext(SurfaceOpenVG* surface)
     53    : m_common(createGraphicsContextPrivate())
     54    , m_data(surface ? new GraphicsContextPlatformPrivate(surface) : 0)
     55{
    5456    setPaintingDisabled(!surface);
    5557}
    5658
    57 void GraphicsContext::platformDestroy()
    58 {
     59GraphicsContext::~GraphicsContext()
     60{
     61    destroyGraphicsContextPrivate(m_common);
    5962    delete m_data;
    6063}
     
    142145        return;
    143146
    144     m_data->drawPath(path, VG_FILL_PATH, m_state.fillRule);
     147    m_data->drawPath(path, VG_FILL_PATH, m_common->state.fillRule);
    145148}
    146149
     
    150153        return;
    151154
    152     m_data->drawPath(path, VG_STROKE_PATH, m_state.fillRule);
     155    m_data->drawPath(path, VG_STROKE_PATH, m_common->state.fillRule);
    153156}
    154157
     
    378381        return;
    379382
    380     m_data->clipPath(path, PainterOpenVG::IntersectClip, m_state.fillRule);
     383    m_data->clipPath(path, PainterOpenVG::IntersectClip, m_common->state.fillRule);
    381384}
    382385
     
    391394        return;
    392395
    393     m_data->clipPath(path, PainterOpenVG::SubtractClip, m_state.fillRule);
     396    m_data->clipPath(path, PainterOpenVG::SubtractClip, m_common->state.fillRule);
    394397}
    395398
     
    425428    Path path;
    426429    path.addRect(rect);
    427     m_data->clipPath(path, PainterOpenVG::SubtractClip, m_state.fillRule);
     430    m_data->clipPath(path, PainterOpenVG::SubtractClip, m_common->state.fillRule);
    428431}
    429432
     
    448451        rect.width() - (thickness * 2), rect.height() - (thickness * 2)));
    449452
    450     m_data->clipPath(path, PainterOpenVG::IntersectClip, m_state.fillRule);
     453    m_data->clipPath(path, PainterOpenVG::IntersectClip, m_common->state.fillRule);
    451454}
    452455
  • trunk/WebCore/platform/graphics/qt/GraphicsContextQt.cpp

    r73492 r73496  
    4747#include "FloatConversion.h"
    4848#include "Font.h"
     49#include "GraphicsContextPrivate.h"
    4950#include "ImageBuffer.h"
    5051#include "NotImplemented.h"
     
    224225};
    225226
     227
    226228GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(QPainter* p, const QColor& initialSolidColor)
    227229    : antiAliasingForRectsAndLines(false)
     
    252254}
    253255
    254 void GraphicsContext::platformInit(PlatformGraphicsContext* painter)
    255 {
    256     m_data = new GraphicsContextPlatformPrivate(painter, fillColor());
    257 
     256GraphicsContext::GraphicsContext(PlatformGraphicsContext* painter)
     257    : m_common(createGraphicsContextPrivate())
     258    , m_data(new GraphicsContextPlatformPrivate(painter, fillColor()))
     259{
    258260    setPaintingDisabled(!painter);
    259261
     
    270272}
    271273
    272 void GraphicsContext::platformDestroy()
     274GraphicsContext::~GraphicsContext()
    273275{
    274276    while (!m_data->layers.isEmpty())
    275277        endTransparencyLayer();
    276278
     279    destroyGraphicsContextPrivate(m_common);
    277280    delete m_data;
    278281}
     
    508511        ContextShadow* shadow = contextShadow();
    509512        if (shadow->m_type != ContextShadow::BlurShadow
    510             && !m_state.fillPattern && !m_state.fillGradient)
     513            && !m_common->state.fillPattern && !m_common->state.fillGradient)
    511514        {
    512515            QPointF offset = shadow->offset();
     
    535538
    536539    }
    537     if (m_state.fillPattern) {
     540    if (m_common->state.fillPattern) {
    538541        AffineTransform affine;
    539         p->fillPath(platformPath, QBrush(m_state.fillPattern->createPlatformPattern(affine)));
    540     } else if (m_state.fillGradient) {
    541         QBrush brush(*m_state.fillGradient->platformGradient());
    542         brush.setTransform(m_state.fillGradient->gradientSpaceTransform());
     542        p->fillPath(platformPath, QBrush(m_common->state.fillPattern->createPlatformPattern(affine)));
     543    } else if (m_common->state.fillGradient) {
     544        QBrush brush(*m_common->state.fillGradient->platformGradient());
     545        brush.setTransform(m_common->state.fillGradient->gradientSpaceTransform());
    543546        p->fillPath(platformPath, brush);
    544547    } else
     
    560563
    561564        if (shadow->m_type != ContextShadow::BlurShadow
    562             && !m_state.strokePattern && !m_state.strokeGradient)
     565            && !m_common->state.strokePattern && !m_common->state.strokeGradient)
    563566        {
    564567            QPen shadowPen(pen);
     
    591594    }
    592595
    593     if (m_state.strokePattern) {
     596    if (m_common->state.strokePattern) {
    594597        AffineTransform affine;
    595         pen.setBrush(QBrush(m_state.strokePattern->createPlatformPattern(affine)));
     598        pen.setBrush(QBrush(m_common->state.strokePattern->createPlatformPattern(affine)));
    596599        p->setPen(pen);
    597600        p->strokePath(platformPath, pen);
    598     } else if (m_state.strokeGradient) {
    599         QBrush brush(*m_state.strokeGradient->platformGradient());
    600         brush.setTransform(m_state.strokeGradient->gradientSpaceTransform());
     601    } else if (m_common->state.strokeGradient) {
     602        QBrush brush(*m_common->state.strokeGradient->platformGradient());
     603        brush.setTransform(m_common->state.strokeGradient->gradientSpaceTransform());
    601604        pen.setBrush(brush);
    602605        p->setPen(pen);
     
    682685    ContextShadow* shadow = contextShadow();
    683686
    684     if (m_state.fillPattern) {
     687    if (m_common->state.fillPattern) {
    685688        AffineTransform affine;
    686         QBrush brush(m_state.fillPattern->createPlatformPattern(affine));
    687         QPixmap* image = m_state.fillPattern->tileImage()->nativeImageForCurrentFrame();
     689        QBrush brush(m_common->state.fillPattern->createPlatformPattern(affine));
     690        QPixmap* image = m_common->state.fillPattern->tileImage()->nativeImageForCurrentFrame();
    688691        QPainter* shadowPainter = m_data->hasShadow() ? shadow->beginShadowLayer(p, normalizedRect) : 0;
    689692        if (shadowPainter) {
    690             drawRepeatPattern(shadowPainter, image, normalizedRect, m_state.fillPattern->repeatX(), m_state.fillPattern->repeatY());
     693            drawRepeatPattern(shadowPainter, image, normalizedRect, m_common->state.fillPattern->repeatX(), m_common->state.fillPattern->repeatY());
    691694            shadowPainter->setCompositionMode(QPainter::CompositionMode_SourceIn);
    692695            shadowPainter->fillRect(normalizedRect, shadow->m_color);
    693696            shadow->endShadowLayer(p);
    694697        }
    695         drawRepeatPattern(p, image, normalizedRect, m_state.fillPattern->repeatX(), m_state.fillPattern->repeatY());
    696     } else if (m_state.fillGradient) {
    697         QBrush brush(*m_state.fillGradient->platformGradient());
    698         brush.setTransform(m_state.fillGradient->gradientSpaceTransform());
     698        drawRepeatPattern(p, image, normalizedRect, m_common->state.fillPattern->repeatX(), m_common->state.fillPattern->repeatY());
     699    } else if (m_common->state.fillGradient) {
     700        QBrush brush(*m_common->state.fillGradient->platformGradient());
     701        brush.setTransform(m_common->state.fillGradient->gradientSpaceTransform());
    699702        QPainter* shadowPainter = m_data->hasShadow() ? shadow->beginShadowLayer(p, normalizedRect) : 0;
    700703        if (shadowPainter) {
     
    967970    // functions
    968971
    969     if (m_state.shadowsIgnoreTransforms) {
     972    if (m_common->state.shadowsIgnoreTransforms) {
    970973        // Meaning that this graphics context is associated with a CanvasRenderingContext
    971974        // We flip the height since CG and HTML5 Canvas have opposite Y axis
    972         m_state.shadowOffset = FloatSize(size.width(), -size.height());
     975        m_common->state.shadowOffset = FloatSize(size.width(), -size.height());
    973976        m_data->shadow = ContextShadow(color, blur, FloatSize(size.width(), -size.height()));
    974977    } else {
  • trunk/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp

    r73492 r73496  
    3838#include "Gradient.h"
    3939#include "GraphicsContextPlatformPrivate.h"
     40#include "GraphicsContextPrivate.h"
    4041#include "ImageBuffer.h"
    4142#include "IntRect.h"
     
    219220// This may be called with a NULL pointer to create a graphics context that has
    220221// no painting.
    221 void GraphicsContext::platformInit(PlatformGraphicsContext* gc)
    222 {
    223     m_data = new GraphicsContextPlatformPrivate(gc);
     222GraphicsContext::GraphicsContext(PlatformGraphicsContext* gc)
     223    : m_common(createGraphicsContextPrivate())
     224    , m_data(new GraphicsContextPlatformPrivate(gc))
     225{
    224226    setPaintingDisabled(!gc || !platformContext()->canvas());
    225227}
    226228
    227 void GraphicsContext::platformDestroy()
     229GraphicsContext::~GraphicsContext()
    228230{
    229231    delete m_data;
     232    this->destroyGraphicsContextPrivate(m_common);
    230233}
    231234
     
    740743    platformContext()->prepareForSoftwareDraw();
    741744
    742     const GraphicsContextState& state = m_state;
     745    const GraphicsContextState& state = m_common->state;
    743746    path.setFillType(state.fillRule == RULE_EVENODD ?
    744747        SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType);
     
    10691072    // TODO(tc): This still does not address the issue that shadows
    10701073    // within canvas elements should ignore transforms.
    1071     if (m_state.shadowsIgnoreTransforms)  {
     1074    if (m_common->state.shadowsIgnoreTransforms)  {
    10721075        // Currently only the GraphicsContext associated with the
    10731076        // CanvasRenderingContext for HTMLCanvasElement have shadows ignore
  • trunk/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp

    r73492 r73496  
    6262}
    6363
    64 void GraphicsContext::platformInit(HDC hdc, bool hasAlpha)
    65 {
    66     m_data = new GraphicsContextPlatformPrivate(CGContextWithHDC(hdc, hasAlpha));
     64GraphicsContext::GraphicsContext(HDC hdc, bool hasAlpha)
     65    : m_common(createGraphicsContextPrivate())
     66    , m_data(new GraphicsContextPlatformPrivate(CGContextWithHDC(hdc, hasAlpha)))
     67{
    6768    CGContextRelease(m_data->m_cgContext.get());
    6869    m_data->m_hdc = hdc;
  • trunk/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp

    r73492 r73496  
    6565}
    6666
    67 void GraphicsContext::platformInit(HDC dc, bool hasAlpha)
     67GraphicsContext::GraphicsContext(HDC dc, bool hasAlpha)
     68    : m_common(createGraphicsContextPrivate())
     69    , m_data(new GraphicsContextPlatformPrivate)
    6870{
    69     m_data = new GraphicsContextPlatformPrivate;
    70 
    7171    if (dc) {
    7272        m_data->cr = createCairoContextWithHDC(dc, hasAlpha);
  • trunk/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp

    r73492 r73496  
    2929#include "GlyphBuffer.h"
    3030#include "Gradient.h"
     31#include "GraphicsContextPrivate.h"
    3132#include "NotImplemented.h"
    3233#include "Path.h"
     
    580581
    581582
    582 void GraphicsContext::platformInit(PlatformGraphicsContext* dc)
    583 {
    584     m_data = new GraphicsContextPlatformPrivate(dc);
    585 }
    586 
    587 void GraphicsContext::platformDestroy()
    588 {
     583GraphicsContext::GraphicsContext(PlatformGraphicsContext* dc)
     584: m_common(createGraphicsContextPrivate())
     585, m_data(new GraphicsContextPlatformPrivate(dc))
     586{
     587}
     588
     589GraphicsContext::~GraphicsContext()
     590{
     591    destroyGraphicsContextPrivate(m_common);
    589592    delete m_data;
    590593}
     
    13141317void GraphicsContext::fillPath(const Path& path)
    13151318{
    1316     Color c = m_state.fillGradient
    1317         ? gradientAverageColor(m_state.fillGradient.get())
     1319    Color c = m_common->state.fillGradient
     1320        ? gradientAverageColor(m_common->state.fillGradient.get())
    13181321        : fillColor();
    13191322
     
    14851488    savePlatformState();
    14861489
    1487     if (m_state.fillGradient)
    1488         fillRect(rect, m_state.fillGradient.get());
     1490    if (m_common->state.fillGradient)
     1491        fillRect(rect, m_common->state.fillGradient.get());
    14891492    else
    14901493        fillRect(rect, fillColor(), ColorSpaceDeviceRGB);
  • trunk/WebCore/platform/graphics/wx/GraphicsContextWx.cpp

    r73492 r73496  
    113113
    114114
    115 void GraphicsContext::platformInit(PlatformGraphicsContext* context)
    116 {
    117     m_data = new GraphicsContextPlatformPrivate;
     115GraphicsContext::GraphicsContext(PlatformGraphicsContext* context)
     116    : m_common(createGraphicsContextPrivate())
     117    , m_data(new GraphicsContextPlatformPrivate)
     118{   
    118119    setPaintingDisabled(!context);
    119 
    120120    if (context) {
    121121        // Make sure the context starts in sync with our state.
     
    130130}
    131131
    132 void GraphicsContext::platformDestroy()
    133 {
     132GraphicsContext::~GraphicsContext()
     133{
     134    destroyGraphicsContextPrivate(m_common);
    134135    delete m_data;
    135136}
Note: See TracChangeset for help on using the changeset viewer.