Remove prePathMatrix from SkDevice::drawPath
Change-Id: Id49d171252cab33378f00021bb395e6ae6991178
Reviewed-on: https://skia-review.googlesource.com/147101
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Mike Reed <reed@google.com>
diff --git a/src/atlastext/SkAtlasTextTarget.cpp b/src/atlastext/SkAtlasTextTarget.cpp
index 60507cf..a31e7ce 100644
--- a/src/atlastext/SkAtlasTextTarget.cpp
+++ b/src/atlastext/SkAtlasTextTarget.cpp
@@ -99,7 +99,7 @@
void addDrawOp(const GrClip&, std::unique_ptr<GrAtlasTextOp> op) override;
void drawPath(const GrClip&, const SkPath&, const SkPaint&, const SkMatrix& viewMatrix,
- const SkMatrix* pathMatrix) override {
+ bool pathIsMutable) override {
SkDebugf("Path glyph??");
}
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 767eff1..7b11980 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -386,7 +386,7 @@
path.addOval(oval);
// call the VIRTUAL version, so any subclasses who do handle drawPath aren't
// required to override drawOval.
- this->drawPath(path, paint, nullptr, true);
+ this->drawPath(path, paint, true);
}
void SkBitmapDevice::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
@@ -396,33 +396,25 @@
path.addRRect(rrect);
// call the VIRTUAL version, so any subclasses who do handle drawPath aren't
// required to override drawRRect.
- this->drawPath(path, paint, nullptr, true);
+ this->drawPath(path, paint, true);
#else
LOOP_TILER( drawRRect(rrect, paint), Bounder(rrect.getBounds(), paint))
#endif
}
void SkBitmapDevice::drawPath(const SkPath& path,
- const SkPaint& paint, const SkMatrix* prePathMatrix,
+ const SkPaint& paint,
bool pathIsMutable) {
const SkRect* bounds = nullptr;
- SkRect storage;
- if (SkDrawTiler::NeedsTiling(this)) {
- if (!path.isInverseFillType()) {
- if (prePathMatrix) {
- prePathMatrix->mapRect(&storage, path.getBounds());
- bounds = &storage;
- } else {
- bounds = &path.getBounds();
- }
- }
+ if (SkDrawTiler::NeedsTiling(this) && !path.isInverseFillType()) {
+ bounds = &path.getBounds();
}
SkDrawTiler tiler(this, bounds ? Bounder(*bounds, paint).bounds() : nullptr);
if (tiler.needsTiling()) {
pathIsMutable = false;
}
while (const SkDraw* draw = tiler.next()) {
- draw->drawPath(path, paint, prePathMatrix, pathIsMutable);
+ draw->drawPath(path, paint, nullptr, pathIsMutable);
}
}
diff --git a/src/core/SkBitmapDevice.h b/src/core/SkBitmapDevice.h
index 74b9349..a578d2c 100644
--- a/src/core/SkBitmapDevice.h
+++ b/src/core/SkBitmapDevice.h
@@ -89,14 +89,8 @@
* non-const pointer and modify it in place (as an optimization). Canvas
* may do this to implement helpers such as drawOval, by placing a temp
* path on the stack to hold the representation of the oval.
- *
- * If prePathMatrix is not null, it should logically be applied before any
- * stroking or other effects. If there are no effects on the paint that
- * affect the geometry/rasterization, then the pre matrix can just be
- * pre-concated with the current matrix.
*/
- void drawPath(const SkPath&, const SkPaint&, const SkMatrix* prePathMatrix,
- bool pathIsMutable) override;
+ void drawPath(const SkPath&, const SkPaint&, bool pathIsMutable) override;
void drawBitmap(const SkBitmap&, SkScalar x, SkScalar y, const SkPaint&) override;
void drawSprite(const SkBitmap&, int x, int y, const SkPaint&) override;
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index 03becd2..41fb9fbac 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -97,7 +97,8 @@
if (isNonTranslate || complexPaint || antiAlias) {
SkPath path;
region.getBoundaryPath(&path);
- return this->drawPath(path, paint, nullptr, false);
+ path.setIsVolatile(true);
+ return this->drawPath(path, paint, true);
}
SkRegion::Iterator it(region);
@@ -124,9 +125,7 @@
path.setFillType(SkPath::kEvenOdd_FillType);
path.setIsVolatile(true);
- const SkMatrix* preMatrix = nullptr;
- const bool pathIsMutable = true;
- this->drawPath(path, paint, preMatrix, pathIsMutable);
+ this->drawPath(path, paint, true);
}
void SkBaseDevice::drawPatch(const SkPoint cubics[12], const SkColor colors[4],
@@ -425,7 +424,7 @@
m.postConcat(*matrix);
}
morphpath(&tmp, *iterPath, meas, m);
- this->drawPath(tmp, iter.getPaint(), nullptr, true);
+ this->drawPath(tmp, iter.getPaint(), true);
}
}
}
diff --git a/src/core/SkDevice.h b/src/core/SkDevice.h
index cac6136..e00ffdd 100644
--- a/src/core/SkDevice.h
+++ b/src/core/SkDevice.h
@@ -180,15 +180,9 @@
* non-const pointer and modify it in place (as an optimization). Canvas
* may do this to implement helpers such as drawOval, by placing a temp
* path on the stack to hold the representation of the oval.
- *
- * If prePathMatrix is not null, it should logically be applied before any
- * stroking or other effects. If there are no effects on the paint that
- * affect the geometry/rasterization, then the pre matrix can just be
- * pre-concated with the current matrix.
*/
virtual void drawPath(const SkPath& path,
const SkPaint& paint,
- const SkMatrix* prePathMatrix = nullptr,
bool pathIsMutable = false) = 0;
virtual void drawBitmap(const SkBitmap& bitmap,
SkScalar x,
@@ -418,7 +412,7 @@
void drawRect(const SkRect&, const SkPaint&) override {}
void drawOval(const SkRect&, const SkPaint&) override {}
void drawRRect(const SkRRect&, const SkPaint&) override {}
- void drawPath(const SkPath&, const SkPaint&, const SkMatrix*, bool) override {}
+ void drawPath(const SkPath&, const SkPaint&, bool) override {}
void drawBitmap(const SkBitmap&, SkScalar x, SkScalar y, const SkPaint&) override {}
void drawSprite(const SkBitmap&, int, int, const SkPaint&) override {}
void drawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkPaint&,
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 177d38f..f5e4a1c 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -534,18 +534,22 @@
SkScalar radius = SkScalarHalf(width);
if (newPaint.getStrokeCap() == SkPaint::kRound_Cap) {
- SkPath path;
- SkMatrix preMatrix;
+ if (device) {
+ for (size_t i = 0; i < count; ++i) {
+ SkRect r = SkRect::MakeLTRB(pts[i].fX - radius, pts[i].fY - radius,
+ pts[i].fX + radius, pts[i].fY + radius);
+ device->drawOval(r, newPaint);
+ }
+ } else {
+ SkPath path;
+ SkMatrix preMatrix;
- path.addCircle(0, 0, radius);
- for (size_t i = 0; i < count; i++) {
- preMatrix.setTranslate(pts[i].fX, pts[i].fY);
- // pass true for the last point, since we can modify
- // then path then
- path.setIsVolatile((count-1) == i);
- if (device) {
- device->drawPath(path, newPaint, &preMatrix, (count-1) == i);
- } else {
+ path.addCircle(0, 0, radius);
+ for (size_t i = 0; i < count; i++) {
+ preMatrix.setTranslate(pts[i].fX, pts[i].fY);
+ // pass true for the last point, since we can modify
+ // then path then
+ path.setIsVolatile((count-1) == i);
this->drawPath(path, newPaint, &preMatrix, (count-1) == i);
}
}
@@ -661,7 +665,7 @@
path.moveTo(pts[i]);
path.lineTo(pts[i+1]);
if (device) {
- device->drawPath(path, p, nullptr, true);
+ device->drawPath(path, p, true);
} else {
this->drawPath(path, p, nullptr, true);
}
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index 4a0f9fe..4d527cb 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -267,41 +267,17 @@
void GrBlurUtils::drawPathWithMaskFilter(GrContext* context,
GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
- const SkPath& origPath,
+ const SkPath& path,
const SkPaint& paint,
- const SkMatrix& origViewMatrix,
- const SkMatrix* prePathMatrix,
+ const SkMatrix& viewMatrix,
bool pathIsMutable) {
if (context->abandoned()) {
return;
}
- SkASSERT(!pathIsMutable || origPath.isVolatile());
+ SkASSERT(!pathIsMutable || path.isVolatile());
GrStyle style(paint);
- // If we have a prematrix, apply it to the path, optimizing for the case
- // where the original path can in fact be modified in place (even though
- // its parameter type is const).
-
- const SkPath* path = &origPath;
- SkTLazy<SkPath> tmpPath;
-
- SkMatrix viewMatrix = origViewMatrix;
-
- if (prePathMatrix) {
- // Styling, blurs, and shading are supposed to be applied *after* the prePathMatrix.
- if (!paint.getMaskFilter() && !paint.getShader() && !style.applies()) {
- viewMatrix.preConcat(*prePathMatrix);
- } else {
- SkPath* result = pathIsMutable ? const_cast<SkPath*>(path) : tmpPath.init();
- pathIsMutable = true;
- path->transform(*prePathMatrix, result);
- path = result;
- result->setIsVolatile(true);
- }
- }
- // at this point we're done with prePathMatrix
- SkDEBUGCODE(prePathMatrix = (const SkMatrix*)0x50FF8001;)
GrPaint grPaint;
if (!SkPaintToGrPaint(context, renderTargetContext->colorSpaceInfo(), paint, viewMatrix,
@@ -313,8 +289,8 @@
if (mf && !mf->hasFragmentProcessor()) {
// The MaskFilter wasn't already handled in SkPaintToGrPaint
draw_path_with_mask_filter(context, renderTargetContext, clip, std::move(grPaint), aa,
- viewMatrix, mf, style, path, pathIsMutable);
+ viewMatrix, mf, style, &path, pathIsMutable);
} else {
- renderTargetContext->drawPath(clip, std::move(grPaint), aa, viewMatrix, *path, style);
+ renderTargetContext->drawPath(clip, std::move(grPaint), aa, viewMatrix, path, style);
}
}
diff --git a/src/gpu/GrBlurUtils.h b/src/gpu/GrBlurUtils.h
index c15ca51..d8648bc 100644
--- a/src/gpu/GrBlurUtils.h
+++ b/src/gpu/GrBlurUtils.h
@@ -37,7 +37,6 @@
const SkPath& origSrcPath,
const SkPaint& paint,
const SkMatrix& origViewMatrix,
- const SkMatrix* prePathMatrix,
bool pathIsMutable);
/**
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 69b092e..787bf7c 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -69,10 +69,9 @@
}
void drawPath(const GrClip& clip, const SkPath& path, const SkPaint& paint,
- const SkMatrix& viewMatrix, const SkMatrix* pathMatrix) override {
+ const SkMatrix& viewMatrix, bool pathIsMutable) override {
GrBlurUtils::drawPathWithMaskFilter(fRenderTargetContext->fContext, fRenderTargetContext,
- clip, path, paint, viewMatrix, pathMatrix,
- false);
+ clip, path, paint, viewMatrix, pathIsMutable);
}
void makeGrPaint(GrMaskFormat maskFormat, const SkPaint& skPaint, const SkMatrix& viewMatrix,
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index bce9275..1fe2ae4 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -383,7 +383,7 @@
path.setIsVolatile(true);
path.addRect(rect);
GrBlurUtils::drawPathWithMaskFilter(fContext.get(), fRenderTargetContext.get(),
- this->clip(), path, paint, this->ctm(), nullptr, true);
+ this->clip(), path, paint, this->ctm(), true);
return;
}
@@ -443,7 +443,7 @@
path.setIsVolatile(true);
path.addRRect(rrect);
GrBlurUtils::drawPathWithMaskFilter(fContext.get(), fRenderTargetContext.get(),
- this->clip(), path, paint, this->ctm(), nullptr, true);
+ this->clip(), path, paint, this->ctm(), true);
return;
}
@@ -487,7 +487,7 @@
path.setFillType(SkPath::kEvenOdd_FillType);
GrBlurUtils::drawPathWithMaskFilter(fContext.get(), fRenderTargetContext.get(), this->clip(),
- path, paint, this->ctm(), nullptr, true);
+ path, paint, this->ctm(), true);
}
@@ -497,7 +497,8 @@
if (paint.getMaskFilter()) {
SkPath path;
region.getBoundaryPath(&path);
- return this->drawPath(path, paint, nullptr, false);
+ path.setIsVolatile(true);
+ return this->drawPath(path, paint, true);
}
GrPaint grPaint;
@@ -605,10 +606,10 @@
}
void SkGpuDevice::drawPath(const SkPath& origSrcPath,
- const SkPaint& paint, const SkMatrix* prePathMatrix,
+ const SkPaint& paint,
bool pathIsMutable) {
ASSERT_SINGLE_OWNER
- if (!origSrcPath.isInverseFillType() && !paint.getPathEffect() && !prePathMatrix) {
+ if (!origSrcPath.isInverseFillType() && !paint.getPathEffect()) {
SkPoint points[2];
if (SkPaint::kStroke_Style == paint.getStyle() && paint.getStrokeWidth() > 0 &&
!paint.getMaskFilter() && SkPaint::kRound_Cap != paint.getStrokeCap() &&
@@ -625,7 +626,7 @@
}
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPath", fContext.get());
- if (!prePathMatrix && !paint.getMaskFilter()) {
+ if (!paint.getMaskFilter()) {
GrPaint grPaint;
if (!SkPaintToGrPaint(this->context(), fRenderTargetContext->colorSpaceInfo(), paint,
this->ctm(), &grPaint)) {
@@ -636,8 +637,7 @@
return;
}
GrBlurUtils::drawPathWithMaskFilter(fContext.get(), fRenderTargetContext.get(), this->clip(),
- origSrcPath, paint, this->ctm(), prePathMatrix,
- pathIsMutable);
+ origSrcPath, paint, this->ctm(), pathIsMutable);
}
static const int kBmpSmallTileSize = 1 << 10;
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index 6cd1ae6..a3233ad 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -73,16 +73,13 @@
const SkPaint& paint) override;
void drawRect(const SkRect& r, const SkPaint& paint) override;
void drawRRect(const SkRRect& r, const SkPaint& paint) override;
- void drawDRRect(const SkRRect& outer, const SkRRect& inner,
- const SkPaint& paint) override;
+ void drawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint) override;
void drawRegion(const SkRegion& r, const SkPaint& paint) override;
void drawOval(const SkRect& oval, const SkPaint& paint) override;
void drawArc(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle,
bool useCenter, const SkPaint& paint) override;
- void drawPath(const SkPath& path, const SkPaint& paint,
- const SkMatrix* prePathMatrix, bool pathIsMutable) override;
- void drawBitmap(const SkBitmap&, SkScalar x, SkScalar y,
- const SkPaint&) override;
+ void drawPath(const SkPath& path, const SkPaint& paint, bool pathIsMutable) override;
+ void drawBitmap(const SkBitmap&, SkScalar x, SkScalar y, const SkPaint&) override;
void drawBitmapRect(const SkBitmap&, const SkRect* srcOrNull, const SkRect& dst,
const SkPaint& paint, SkCanvas::SrcRectConstraint) override;
void drawSprite(const SkBitmap& bitmap, int x, int y,
diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp
index 53b3b4d..bba3328 100644
--- a/src/gpu/text/GrTextBlob.cpp
+++ b/src/gpu/text/GrTextBlob.cpp
@@ -9,6 +9,7 @@
#include "GrBlurUtils.h"
#include "GrClip.h"
#include "GrContext.h"
+#include "GrStyle.h"
#include "GrTextTarget.h"
#include "SkColorFilter.h"
#include "SkGlyphCache.h"
@@ -295,11 +296,31 @@
GrTextBlob::Run::PathGlyph& pathGlyph = run.fPathGlyphs[i];
calculate_translation(pathGlyph.fPreTransformed, viewMatrix, x, y,
fInitialViewMatrix, fInitialX, fInitialY, &transX, &transY);
- const SkMatrix& ctm = pathGlyph.fPreTransformed ? SkMatrix::I() : viewMatrix;
+
+ const SkMatrix* ctm = pathGlyph.fPreTransformed ? &SkMatrix::I() : &viewMatrix;
SkMatrix pathMatrix;
pathMatrix.setScale(pathGlyph.fScale, pathGlyph.fScale);
pathMatrix.postTranslate(pathGlyph.fX + transX, pathGlyph.fY + transY);
- target->drawPath(clip, pathGlyph.fPath, runPaint, ctm, &pathMatrix);
+
+ const SkPath* path = &pathGlyph.fPath;
+ bool pathIsMutable = false;
+ SkTLazy<SkPath> tmpPath;
+
+ GrStyle style(runPaint);
+
+ // Styling, blurs, and shading are supposed to be applied *after* the pathMatrix.
+ if (!runPaint.getMaskFilter() && !runPaint.getShader() && !style.applies()) {
+ pathMatrix.postConcat(*ctm);
+ ctm = &pathMatrix;
+ } else {
+ SkPath* result = tmpPath.init();
+ path->transform(pathMatrix, result);
+ result->setIsVolatile(true);
+ path = result;
+ pathIsMutable = true;
+ }
+
+ target->drawPath(clip, *path, runPaint, *ctm, pathIsMutable);
}
}
diff --git a/src/gpu/text/GrTextTarget.h b/src/gpu/text/GrTextTarget.h
index 3bcbe9a..d220a1a 100644
--- a/src/gpu/text/GrTextTarget.h
+++ b/src/gpu/text/GrTextTarget.h
@@ -31,7 +31,7 @@
virtual void addDrawOp(const GrClip&, std::unique_ptr<GrAtlasTextOp> op) = 0;
virtual void drawPath(const GrClip&, const SkPath&, const SkPaint&,
- const SkMatrix& viewMatrix, const SkMatrix* pathMatrix) = 0;
+ const SkMatrix& viewMatrix, bool pathIsMutable) = 0;
virtual void makeGrPaint(GrMaskFormat, const SkPaint&, const SkMatrix& viewMatrix,
GrPaint*) = 0;
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 43ee5f6..8664e50 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -787,7 +787,7 @@
if (paint.getPathEffect() || paint.getMaskFilter()) {
SkPath path;
path.addRect(r);
- this->drawPath(path, paint, nullptr, true);
+ this->drawPath(path, paint, true);
return;
}
@@ -809,7 +809,7 @@
replace_srcmode_on_opaque_paint(&paint);
SkPath path;
path.addRRect(rrect);
- this->drawPath(path, paint, nullptr, true);
+ this->drawPath(path, paint, true);
}
void SkPDFDevice::drawOval(const SkRect& oval,
@@ -822,28 +822,23 @@
replace_srcmode_on_opaque_paint(&paint);
SkPath path;
path.addOval(oval);
- this->drawPath(path, paint, nullptr, true);
+ this->drawPath(path, paint, true);
}
void SkPDFDevice::drawPath(const SkPath& origPath,
const SkPaint& srcPaint,
- const SkMatrix* prePathMatrix,
bool pathIsMutable) {
- this->internalDrawPath(
- this->cs(), this->ctm(), origPath, srcPaint, prePathMatrix, pathIsMutable);
+ this->internalDrawPath(this->cs(), this->ctm(), origPath, srcPaint, pathIsMutable);
}
void SkPDFDevice::internalDrawPathWithFilter(const SkClipStack& clipStack,
const SkMatrix& ctm,
const SkPath& origPath,
- const SkPaint& origPaint,
- const SkMatrix* prePathMatrix) {
+ const SkPaint& origPaint) {
SkASSERT(origPaint.getMaskFilter());
SkPath path(origPath);
SkTCopyOnFirstWrite<SkPaint> paint(origPaint);
- if (prePathMatrix) {
- path.transform(*prePathMatrix, &path);
- }
+
SkStrokeRec::InitStyle initStyle = paint->getFillPath(path, &path)
? SkStrokeRec::kFill_InitStyle
: SkStrokeRec::kHairline_InitStyle;
@@ -906,7 +901,6 @@
const SkMatrix& ctm,
const SkPath& origPath,
const SkPaint& srcPaint,
- const SkMatrix* prePathMatrix,
bool pathIsMutable) {
if (clipStack.isEmpty(this->bounds())) {
return;
@@ -918,22 +912,11 @@
SkPath* pathPtr = const_cast<SkPath*>(&origPath);
if (paint.getMaskFilter()) {
- this->internalDrawPathWithFilter(clipStack, ctm, origPath, paint, prePathMatrix);
+ this->internalDrawPathWithFilter(clipStack, ctm, origPath, paint);
return;
}
SkMatrix matrix = ctm;
- if (prePathMatrix) {
- if (paint.getPathEffect() || paint.getStyle() != SkPaint::kFill_Style) {
- if (!pathIsMutable) {
- pathPtr = &modifiedPath;
- pathIsMutable = true;
- }
- origPath.transform(*prePathMatrix, pathPtr);
- } else {
- matrix.preConcat(*prePathMatrix);
- }
- }
if (paint.getPathEffect()) {
if (clipStack.isEmpty(this->bounds())) {
@@ -953,7 +936,7 @@
paint.setPathEffect(nullptr);
}
- if (this->handleInversePath(*pathPtr, paint, pathIsMutable, prePathMatrix)) {
+ if (this->handleInversePath(*pathPtr, paint, pathIsMutable)) {
return;
}
if (matrix.getType() & SkMatrix::kPerspective_Mask) {
@@ -1118,7 +1101,7 @@
glyphRun.positions().data(),
&path);
path.offset(offset.x(), offset.y());
- dev->drawPath(path, glyphRun.paint(), nullptr, true);
+ dev->drawPath(path, glyphRun.paint(), true);
}
static bool has_outline_glyph(SkGlyphID gid, SkGlyphCache* cache) {
@@ -1513,8 +1496,8 @@
* in the first place.
*/
bool SkPDFDevice::handleInversePath(const SkPath& origPath,
- const SkPaint& paint, bool pathIsMutable,
- const SkMatrix* prePathMatrix) {
+ const SkPaint& paint,
+ bool pathIsMutable) {
if (!origPath.isInverseFillType()) {
return false;
}
@@ -1539,7 +1522,7 @@
// To be consistent with the raster output, hairline strokes
// are rendered as non-inverted.
modifiedPath.toggleInverseFillType();
- this->drawPath(modifiedPath, paint, nullptr, true);
+ this->drawPath(modifiedPath, paint, true);
return true;
}
}
@@ -1548,9 +1531,7 @@
// (clip bounds are given in device space).
SkMatrix transformInverse;
SkMatrix totalMatrix = this->ctm();
- if (prePathMatrix) {
- totalMatrix.preConcat(*prePathMatrix);
- }
+
if (!totalMatrix.invert(&transformInverse)) {
return false;
}
@@ -1566,7 +1547,7 @@
return false;
}
- this->drawPath(modifiedPath, noInversePaint, prePathMatrix, true);
+ this->drawPath(modifiedPath, noInversePaint, true);
return true;
}
@@ -1772,7 +1753,7 @@
SkPaint filledPaint;
filledPaint.setColor(SK_ColorBLACK);
filledPaint.setStyle(SkPaint::kFill_Style);
- this->internalDrawPath(clipStack, SkMatrix::I(), *shape, filledPaint, nullptr, true);
+ this->internalDrawPath(clipStack, SkMatrix::I(), *shape, filledPaint, true);
this->drawFormXObjectWithMask(this->addXObjectResource(dst.get()),
this->makeFormXObjectFromDevice(),
fExistingClipStack,
@@ -2099,7 +2080,7 @@
paint.setShader(imageSubset.image()->makeShader(&transform));
SkPath path;
path.addRect(dst); // handles non-integral clipping.
- this->internalDrawPath(this->cs(), this->ctm(), path, paint, nullptr, true);
+ this->internalDrawPath(this->cs(), this->ctm(), path, paint, true);
return;
}
transform.postConcat(ctm);
diff --git a/src/pdf/SkPDFDevice.h b/src/pdf/SkPDFDevice.h
index 7bd1a0e..9a91790 100644
--- a/src/pdf/SkPDFDevice.h
+++ b/src/pdf/SkPDFDevice.h
@@ -78,9 +78,7 @@
void drawRect(const SkRect& r, const SkPaint& paint) override;
void drawOval(const SkRect& oval, const SkPaint& paint) override;
void drawRRect(const SkRRect& rr, const SkPaint& paint) override;
- void drawPath(const SkPath& origpath,
- const SkPaint& paint, const SkMatrix* prePathMatrix,
- bool pathIsMutable) override;
+ void drawPath(const SkPath& origpath, const SkPaint& paint, bool pathIsMutable) override;
void drawBitmapRect(const SkBitmap& bitmap, const SkRect* src,
const SkRect& dst, const SkPaint&, SkCanvas::SrcRectConstraint) override;
void drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, const SkPaint&) override;
@@ -255,18 +253,14 @@
const SkMatrix&,
const SkPath&,
const SkPaint&,
- const SkMatrix* prePathMatrix,
bool pathIsMutable);
void internalDrawPathWithFilter(const SkClipStack& clipStack,
const SkMatrix& ctm,
const SkPath& origPath,
- const SkPaint& paint,
- const SkMatrix* prePathMatrix);
+ const SkPaint& paint);
- bool handleInversePath(const SkPath& origPath,
- const SkPaint& paint, bool pathIsMutable,
- const SkMatrix* prePathMatrix = nullptr);
+ bool handleInversePath(const SkPath& origPath, const SkPaint& paint, bool pathIsMutable);
void addSMaskGraphicState(sk_sp<SkPDFDevice> maskDevice, SkDynamicMemoryWStream*);
void clearMaskOnGraphicState(SkDynamicMemoryWStream*);
diff --git a/src/svg/SkSVGDevice.cpp b/src/svg/SkSVGDevice.cpp
index 2a6bd85..1f7ec36 100644
--- a/src/svg/SkSVGDevice.cpp
+++ b/src/svg/SkSVGDevice.cpp
@@ -904,8 +904,7 @@
elem.addPathAttributes(path);
}
-void SkSVGDevice::drawPath(const SkPath& path, const SkPaint& paint,
- const SkMatrix* prePathMatrix, bool pathIsMutable) {
+void SkSVGDevice::drawPath(const SkPath& path, const SkPaint& paint, bool pathIsMutable) {
AutoElement elem("path", fWriter, fResourceBucket.get(), MxCp(this), paint);
elem.addPathAttributes(path);
diff --git a/src/svg/SkSVGDevice.h b/src/svg/SkSVGDevice.h
index 6b8ee4f..452229d 100644
--- a/src/svg/SkSVGDevice.h
+++ b/src/svg/SkSVGDevice.h
@@ -27,7 +27,6 @@
void drawRRect(const SkRRect& rr, const SkPaint& paint) override;
void drawPath(const SkPath& path,
const SkPaint& paint,
- const SkMatrix* prePathMatrix = nullptr,
bool pathIsMutable = false) override;
void drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, const SkPaint& paint) override;
diff --git a/src/xps/SkXPSDevice.cpp b/src/xps/SkXPSDevice.cpp
index ee8e072..ff66e3b 100644
--- a/src/xps/SkXPSDevice.cpp
+++ b/src/xps/SkXPSDevice.cpp
@@ -1185,7 +1185,7 @@
const SkPaint& paint) {
SkPath path;
path.addRRect(rr);
- this->drawPath(path, paint, nullptr, true);
+ this->drawPath(path, paint, true);
}
static SkIRect size(const SkBaseDevice& dev) { return {0, 0, dev.width(), dev.height()}; }
@@ -1204,7 +1204,7 @@
SkPath tmp;
tmp.addRect(r);
tmp.setFillType(SkPath::kWinding_FillType);
- this->drawPath(tmp, paint, nullptr, true);
+ this->drawPath(tmp, paint, true);
return;
}
@@ -1502,7 +1502,6 @@
void SkXPSDevice::drawPath(const SkPath& platonicPath,
const SkPaint& origPaint,
- const SkMatrix* prePathMatrix,
bool pathIsMutable) {
SkTCopyOnFirstWrite<SkPaint> paint(origPaint);
@@ -1519,17 +1518,6 @@
//Apply pre-path matrix [Platonic-path -> Skeletal-path].
SkMatrix matrix = this->ctm();
SkPath* skeletalPath = const_cast<SkPath*>(&platonicPath);
- if (prePathMatrix) {
- if (paintHasPathEffect) {
- if (!pathIsMutable) {
- skeletalPath = &modifiedPath;
- pathIsMutable = true;
- }
- platonicPath.transform(*prePathMatrix, skeletalPath);
- } else {
- matrix.preConcat(*prePathMatrix);
- }
- }
//Apply path effect [Skeletal-path -> Fillable-path].
SkPath* fillablePath = skeletalPath;
@@ -2147,7 +2135,7 @@
void SkXPSDevice::drawOval( const SkRect& o, const SkPaint& p) {
SkPath path;
path.addOval(o);
- this->drawPath(path, p, nullptr, true);
+ this->drawPath(path, p, true);
}
void SkXPSDevice::drawBitmapRect(const SkBitmap& bitmap,
diff --git a/src/xps/SkXPSDevice.h b/src/xps/SkXPSDevice.h
index 03de5f1..c3f27c4 100644
--- a/src/xps/SkXPSDevice.h
+++ b/src/xps/SkXPSDevice.h
@@ -85,7 +85,6 @@
const SkPaint& paint) override;
void drawPath(const SkPath& path,
const SkPaint& paint,
- const SkMatrix* prePathMatrix = NULL,
bool pathIsMutable = false) override;
void drawBitmap(const SkBitmap& bitmap,
SkScalar x,