Changeset 76688 in webkit
- Timestamp:
- Jan 26, 2011 6:50:19 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r76686 r76688 1 2011-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 1 18 2011-01-26 Zalan Bujtas <zbujtas@gmail.com> 2 19 -
trunk/Source/WebCore/platform/graphics/GraphicsContext.h
r76415 r76688 370 370 CompositeOperator compositeOperation() const; 371 371 372 #if PLATFORM(SKIA)373 void beginPath();374 void addPath(const Path&);375 #endif376 377 372 void clip(const Path&); 378 373 -
trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
r76235 r76688 310 310 } 311 311 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 326 312 void GraphicsContext::clearPlatformShadow() 327 313 { … … 432 418 platformContext()->gpuCanvas()->clipPath(pathToClip); 433 419 434 // FIXME: Be smarter about this. 435 beginPath(); 436 addPath(pathToClip); 437 438 SkPath path = platformContext()->currentPathInLocalCoordinates(); 420 SkPath path = *pathToClip.platformPath(); 439 421 if (!isPathSkiaSafe(getCTM(), path)) 440 422 return; … … 739 721 return; 740 722 741 // FIXME: Be smarter about this.742 beginPath();743 addPath(pathToFill);744 745 723 if (platformContext()->useGPU() && platformContext()->canAccelerate()) { 746 724 platformContext()->prepareForHardwareDraw(); … … 749 727 } 750 728 751 SkPath path = platformContext()->currentPathInLocalCoordinates();729 SkPath path = *pathToFill.platformPath(); 752 730 if (!isPathSkiaSafe(getCTM(), path)) 753 731 return; … … 1205 1183 return; 1206 1184 1207 // FIXME: Be smarter about this. 1208 beginPath(); 1209 addPath(pathToStroke); 1210 1211 SkPath path = platformContext()->currentPathInLocalCoordinates(); 1185 SkPath path = *pathToStroke.platformPath(); 1212 1186 if (!isPathSkiaSafe(getCTM(), path)) 1213 1187 return; -
trunk/Source/WebCore/platform/graphics/skia/PathSkia.cpp
r69505 r76688 228 228 } 229 229 230 // Computes the bounding box for the stroke and style currently selected into231 // 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 241 230 FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) 242 231 { 243 232 GraphicsContext* scratch = scratchContext(); 244 233 scratch->save(); 245 scratch->beginPath();246 scratch->addPath(*this);247 234 248 235 if (applier) 249 236 applier->strokeStyle(scratch); 250 237 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(); 252 244 scratch->restore(); 253 245 return r; -
trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
r76235 r76688 551 551 } 552 552 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() const564 {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 574 553 void PlatformContextSkia::canvasClipPath(const SkPath& path) 575 554 { 576 555 m_state->m_canvasClipApplied = true; 577 556 m_canvas->clipPath(path); 578 }579 580 void PlatformContextSkia::setFillRule(SkPath::FillType fr)581 {582 m_path.setFillType(fr);583 557 } 584 558 -
trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h
r76248 r76688 119 119 void setLineCap(SkPaint::Cap); 120 120 void setLineJoin(SkPaint::Join); 121 void setFillRule(SkPath::FillType);122 121 void setXfermodeMode(SkXfermode::Mode); 123 122 void setFillColor(SkColor); … … 137 136 float getAlpha() const; 138 137 int getNormalizedAlpha() const; 139 140 void beginPath();141 void addPath(const SkPath&);142 SkPath currentPathInLocalCoordinates() const;143 138 144 139 void canvasClipPath(const SkPath&); … … 221 216 State* m_state; 222 217 223 // Current path in global coordinates.224 SkPath m_path;225 226 218 // Stores image sizes for a hint to compute image resampling modes. 227 219 // Values are used in ImageSkia.cpp
Note: See TracChangeset
for help on using the changeset viewer.