Changeset 76688 in webkit


Ignore:
Timestamp:
Jan 26, 2011 6:50:19 AM (13 years ago)
Author:
Patrick Gansterer
Message:

2011-01-26 Patrick Gansterer <Patrick Gansterer>

Reviewed by Andreas Kling.

[SKIA] Remove "current path" of GraphicsContext
https://bugs.webkit.org/show_bug.cgi?id=53124

  • platform/graphics/GraphicsContext.h:
  • platform/graphics/skia/GraphicsContextSkia.cpp: (WebCore::GraphicsContext::clipPath): (WebCore::GraphicsContext::fillPath): (WebCore::GraphicsContext::strokePath):
  • platform/graphics/skia/PathSkia.cpp: (WebCore::Path::strokeBoundingRect):
  • platform/graphics/skia/PlatformContextSkia.cpp:
  • platform/graphics/skia/PlatformContextSkia.h:
Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r76686 r76688  
     12011-01-26  Patrick Gansterer  <paroga@webkit.org>
     2
     3        Reviewed by Andreas Kling.
     4
     5        [SKIA] Remove "current path" of GraphicsContext
     6        https://bugs.webkit.org/show_bug.cgi?id=53124
     7
     8        * platform/graphics/GraphicsContext.h:
     9        * platform/graphics/skia/GraphicsContextSkia.cpp:
     10        (WebCore::GraphicsContext::clipPath):
     11        (WebCore::GraphicsContext::fillPath):
     12        (WebCore::GraphicsContext::strokePath):
     13        * platform/graphics/skia/PathSkia.cpp:
     14        (WebCore::Path::strokeBoundingRect):
     15        * platform/graphics/skia/PlatformContextSkia.cpp:
     16        * platform/graphics/skia/PlatformContextSkia.h:
     17
    1182011-01-26  Zalan Bujtas <zbujtas@gmail.com>
    219
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.h

    r76415 r76688  
    370370        CompositeOperator compositeOperation() const;
    371371
    372 #if PLATFORM(SKIA)
    373         void beginPath();
    374         void addPath(const Path&);
    375 #endif
    376 
    377372        void clip(const Path&);
    378373
  • trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp

    r76235 r76688  
    310310}
    311311
    312 void GraphicsContext::addPath(const Path& path)
    313 {
    314     if (paintingDisabled())
    315         return;
    316     platformContext()->addPath(*path.platformPath());
    317 }
    318 
    319 void GraphicsContext::beginPath()
    320 {
    321     if (paintingDisabled())
    322         return;
    323     platformContext()->beginPath();
    324 }
    325 
    326312void GraphicsContext::clearPlatformShadow()
    327313{
     
    432418        platformContext()->gpuCanvas()->clipPath(pathToClip);
    433419
    434     // FIXME: Be smarter about this.
    435     beginPath();
    436     addPath(pathToClip);
    437 
    438     SkPath path = platformContext()->currentPathInLocalCoordinates();
     420    SkPath path = *pathToClip.platformPath();
    439421    if (!isPathSkiaSafe(getCTM(), path))
    440422        return;
     
    739721        return;
    740722
    741     // FIXME: Be smarter about this.
    742     beginPath();
    743     addPath(pathToFill);
    744 
    745723    if (platformContext()->useGPU() && platformContext()->canAccelerate()) {
    746724        platformContext()->prepareForHardwareDraw();
     
    749727    }
    750728
    751     SkPath path = platformContext()->currentPathInLocalCoordinates();
     729    SkPath path = *pathToFill.platformPath();
    752730    if (!isPathSkiaSafe(getCTM(), path))
    753731      return;
     
    12051183        return;
    12061184
    1207     // FIXME: Be smarter about this.
    1208     beginPath();
    1209     addPath(pathToStroke);
    1210 
    1211     SkPath path = platformContext()->currentPathInLocalCoordinates();
     1185    SkPath path = *pathToStroke.platformPath();
    12121186    if (!isPathSkiaSafe(getCTM(), path))
    12131187        return;
  • trunk/Source/WebCore/platform/graphics/skia/PathSkia.cpp

    r69505 r76688  
    228228}
    229229
    230 // Computes the bounding box for the stroke and style currently selected into
    231 // the given bounding box. This also takes into account the stroke width.
    232 static FloatRect boundingBoxForCurrentStroke(const GraphicsContext* context)
    233 {
    234     SkPaint paint;
    235     context->platformContext()->setupPaintForStroking(&paint, 0, 0);
    236     SkPath boundingPath;
    237     paint.getFillPath(context->platformContext()->currentPathInLocalCoordinates(), &boundingPath);
    238     return boundingPath.getBounds();
    239 }
    240 
    241230FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier)
    242231{
    243232    GraphicsContext* scratch = scratchContext();
    244233    scratch->save();
    245     scratch->beginPath();
    246     scratch->addPath(*this);
    247234
    248235    if (applier)
    249236        applier->strokeStyle(scratch);
    250237
    251     FloatRect r = boundingBoxForCurrentStroke(scratch);
     238    SkPaint paint;
     239    scratch->platformContext()->setupPaintForStroking(&paint, 0, 0);
     240    SkPath boundingPath;
     241    paint.getFillPath(*platformPath(), &boundingPath);
     242
     243    FloatRect r = boundingPath.getBounds();
    252244    scratch->restore();
    253245    return r;
  • trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp

    r76235 r76688  
    551551}
    552552
    553 void PlatformContextSkia::beginPath()
    554 {
    555     m_path.reset();
    556 }
    557 
    558 void PlatformContextSkia::addPath(const SkPath& path)
    559 {
    560     m_path.addPath(path, m_canvas->getTotalMatrix());
    561 }
    562 
    563 SkPath PlatformContextSkia::currentPathInLocalCoordinates() const
    564 {
    565     SkPath localPath = m_path;
    566     const SkMatrix& matrix = m_canvas->getTotalMatrix();
    567     SkMatrix inverseMatrix;
    568     if (!matrix.invert(&inverseMatrix))
    569         return SkPath();
    570     localPath.transform(inverseMatrix);
    571     return localPath;
    572 }
    573 
    574553void PlatformContextSkia::canvasClipPath(const SkPath& path)
    575554{
    576555    m_state->m_canvasClipApplied = true;
    577556    m_canvas->clipPath(path);
    578 }
    579 
    580 void PlatformContextSkia::setFillRule(SkPath::FillType fr)
    581 {
    582     m_path.setFillType(fr);
    583557}
    584558
  • trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h

    r76248 r76688  
    119119    void setLineCap(SkPaint::Cap);
    120120    void setLineJoin(SkPaint::Join);
    121     void setFillRule(SkPath::FillType);
    122121    void setXfermodeMode(SkXfermode::Mode);
    123122    void setFillColor(SkColor);
     
    137136    float getAlpha() const;
    138137    int getNormalizedAlpha() const;
    139 
    140     void beginPath();
    141     void addPath(const SkPath&);
    142     SkPath currentPathInLocalCoordinates() const;
    143138
    144139    void canvasClipPath(const SkPath&);
     
    221216    State* m_state;
    222217
    223     // Current path in global coordinates.
    224     SkPath m_path;
    225 
    226218    // Stores image sizes for a hint to compute image resampling modes.
    227219    // Values are used in ImageSkia.cpp
Note: See TracChangeset for help on using the changeset viewer.