aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode/SamplePathText.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'samplecode/SamplePathText.cpp')
-rw-r--r--samplecode/SamplePathText.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/samplecode/SamplePathText.cpp b/samplecode/SamplePathText.cpp
index 31b0a7d8b9..b6a730f6d7 100644
--- a/samplecode/SamplePathText.cpp
+++ b/samplecode/SamplePathText.cpp
@@ -66,14 +66,13 @@ public:
void onDrawContent(SkCanvas* canvas) override {
if (fDoClip) {
- SkMatrix oldMatrix = canvas->getTotalMatrix();
- canvas->setMatrix(SkMatrix::MakeScale(this->width(), this->height()));
+ SkPath deviceSpaceClipPath = fClipPath;
+ deviceSpaceClipPath.transform(SkMatrix::MakeScale(this->width(), this->height()));
canvas->save();
- canvas->clipPath(fClipPath, SkClipOp::kDifference, true);
+ canvas->clipPath(deviceSpaceClipPath, SkClipOp::kDifference, true);
canvas->clear(SK_ColorBLACK);
canvas->restore();
- canvas->clipPath(fClipPath, SkClipOp::kIntersect, true);
- canvas->setMatrix(oldMatrix);
+ canvas->clipPath(deviceSpaceClipPath, SkClipOp::kIntersect, true);
}
this->drawGlyphs(canvas);
}