diff options
-rw-r--r-- | bench/DeferredCanvasBench.cpp | 2 | ||||
-rw-r--r-- | gm/xfermodes.cpp | 4 | ||||
-rw-r--r-- | gm/xfermodes2.cpp | 2 | ||||
-rw-r--r-- | gm/xfermodes3.cpp | 2 | ||||
-rw-r--r-- | samplecode/SampleLayerMask.cpp | 2 | ||||
-rw-r--r-- | samplecode/SampleLayers.cpp | 6 | ||||
-rw-r--r-- | samplecode/SampleXfermodesBlur.cpp | 2 | ||||
-rw-r--r-- | src/animator/SkDrawSaveLayer.cpp | 4 | ||||
-rw-r--r-- | src/core/SkCanvas.cpp | 5 | ||||
-rw-r--r-- | src/core/SkPictureRecord.cpp | 2 | ||||
-rw-r--r-- | src/core/SkPictureStateTree.cpp | 5 | ||||
-rw-r--r-- | src/effects/SkLayerDrawLooper.cpp | 4 | ||||
-rw-r--r-- | tests/DeferredCanvasTest.cpp | 10 | ||||
-rw-r--r-- | tests/ImageFilterTest.cpp | 4 |
14 files changed, 28 insertions, 26 deletions
diff --git a/bench/DeferredCanvasBench.cpp b/bench/DeferredCanvasBench.cpp index b063a9c2dd..6ffd2d2327 100644 --- a/bench/DeferredCanvasBench.cpp +++ b/bench/DeferredCanvasBench.cpp @@ -83,7 +83,7 @@ protected: rect.setXYWH(0, 0, 10, 10); SkPaint paint; for (int i = 0; i < loops; i++) { - canvas->save(SkCanvas::kMatrixClip_SaveFlag); + canvas->save(); canvas->translate(SkIntToScalar(i * 27 % CANVAS_WIDTH), SkIntToScalar(i * 13 % CANVAS_HEIGHT)); canvas->drawRect(rect, paint); canvas->restore(); diff --git a/gm/xfermodes.cpp b/gm/xfermodes.cpp index b5ce8b8ced..24c48ee747 100644 --- a/gm/xfermodes.cpp +++ b/gm/xfermodes.cpp @@ -112,7 +112,7 @@ class XfermodesGM : public GM { break; } case kRectangleWithMask_SrcType: { - canvas->save(SkCanvas::kClip_SaveFlag); + canvas->save(); restoreNeeded = true; SkScalar w = SkIntToScalar(W); SkScalar h = SkIntToScalar(H); @@ -247,7 +247,7 @@ protected: p.setShader(s); canvas->drawRect(r, p); - canvas->saveLayer(&r, NULL, SkCanvas::kARGB_ClipLayer_SaveFlag); + canvas->saveLayer(&r, NULL); draw_mode(canvas, mode, static_cast<SrcType>(sourceType), r.fLeft, r.fTop); canvas->restore(); diff --git a/gm/xfermodes2.cpp b/gm/xfermodes2.cpp index 6202af9a72..1af59d2553 100644 --- a/gm/xfermodes2.cpp +++ b/gm/xfermodes2.cpp @@ -54,7 +54,7 @@ protected: SkRect r = SkRect::MakeWH(w, h); canvas->drawRect(r, p); - canvas->saveLayer(&r, NULL, SkCanvas::kARGB_ClipLayer_SaveFlag); + canvas->saveLayer(&r, NULL); p.setShader(fDst); canvas->drawRect(r, p); diff --git a/gm/xfermodes3.cpp b/gm/xfermodes3.cpp index 76c4b88380..1863a3e610 100644 --- a/gm/xfermodes3.cpp +++ b/gm/xfermodes3.cpp @@ -152,7 +152,7 @@ private: SkCanvas* modeCanvas; if (NULL == layerCanvas) { - canvas->saveLayer(&r, NULL, SkCanvas::kARGB_ClipLayer_SaveFlag); + canvas->saveLayer(&r, NULL); modeCanvas = canvas; } else { modeCanvas = layerCanvas; diff --git a/samplecode/SampleLayerMask.cpp b/samplecode/SampleLayerMask.cpp index b3bbac622f..86a092cd06 100644 --- a/samplecode/SampleLayerMask.cpp +++ b/samplecode/SampleLayerMask.cpp @@ -57,7 +57,7 @@ protected: virtual void onDrawContent(SkCanvas* canvas) { SkRect r; r.set(SkIntToScalar(20), SkIntToScalar(20), SkIntToScalar(120), SkIntToScalar(120)); - canvas->saveLayer(&r, NULL, SkCanvas::kARGB_ClipLayer_SaveFlag); + canvas->saveLayer(&r, NULL); canvas->drawColor(SK_ColorRED); drawMask(canvas, r); canvas->restore(); diff --git a/samplecode/SampleLayers.cpp b/samplecode/SampleLayers.cpp index 430c832f77..3ae543915c 100644 --- a/samplecode/SampleLayers.cpp +++ b/samplecode/SampleLayers.cpp @@ -69,11 +69,11 @@ static void test_fade(SkCanvas* canvas) { canvas->clipRect(r); r.fBottom = SkIntToScalar(20); - canvas->saveLayer(&r, NULL, (SkCanvas::SaveFlags)(SkCanvas::kHasAlphaLayer_SaveFlag | SkCanvas::kFullColorLayer_SaveFlag)); + canvas->saveLayer(&r, NULL); r.fTop = SkIntToScalar(80); r.fBottom = SkIntToScalar(100); - canvas->saveLayer(&r, NULL, (SkCanvas::SaveFlags)(SkCanvas::kHasAlphaLayer_SaveFlag | SkCanvas::kFullColorLayer_SaveFlag)); + canvas->saveLayer(&r, NULL); // now draw the "content" @@ -203,7 +203,7 @@ protected: r.set(SkIntToScalar(0), SkIntToScalar(0), SkIntToScalar(220), SkIntToScalar(60)); - canvas->saveLayer(&r, &p, (SkCanvas::SaveFlags)(SkCanvas::kHasAlphaLayer_SaveFlag | SkCanvas::kFullColorLayer_SaveFlag)); + canvas->saveLayer(&r, &p); r.set(SkIntToScalar(0), SkIntToScalar(0), SkIntToScalar(220), SkIntToScalar(120)); diff --git a/samplecode/SampleXfermodesBlur.cpp b/samplecode/SampleXfermodesBlur.cpp index cae415d9d0..ea9561dfe1 100644 --- a/samplecode/SampleXfermodesBlur.cpp +++ b/samplecode/SampleXfermodesBlur.cpp @@ -180,7 +180,7 @@ protected: p.setShader(s); canvas->drawRect(r, p); - canvas->saveLayer(&r, NULL, SkCanvas::kARGB_ClipLayer_SaveFlag); + canvas->saveLayer(&r, NULL); draw_mode(canvas, mode, twice ? 0x88 : 0xFF, r.fLeft, r.fTop); canvas->restore(); diff --git a/src/animator/SkDrawSaveLayer.cpp b/src/animator/SkDrawSaveLayer.cpp index 4e97a044e5..9623c905c9 100644 --- a/src/animator/SkDrawSaveLayer.cpp +++ b/src/animator/SkDrawSaveLayer.cpp @@ -41,10 +41,10 @@ bool SkSaveLayer::draw(SkAnimateMaker& maker) { SkPaint realPaint; paint->setupPaint(&realPaint); - maker.fCanvas->saveLayer(&bounds->fRect, &realPaint, SkCanvas::kHasAlphaLayer_SaveFlag); + maker.fCanvas->saveLayer(&bounds->fRect, &realPaint); } else - maker.fCanvas->saveLayer(&bounds->fRect, save, SkCanvas::kHasAlphaLayer_SaveFlag); + maker.fCanvas->saveLayer(&bounds->fRect, save); SkPaint local = SkPaint(*maker.fPaint); maker.fPaint = &local; bool result = INHERITED::draw(maker); diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 569e9e59ba..c57ae9ae5f 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -1631,12 +1631,13 @@ void SkCanvas::updateClipConservativelyUsingBounds(const SkRect& bounds, SkRegio SkIRect deviceIBounds; this->getDevice()->getGlobalBounds(&deviceIBounds); deviceBounds = SkRect::Make(deviceIBounds); - this->SkCanvas::save(SkCanvas::kMatrix_SaveFlag); + // set the clip in device space + SkMatrix savedMatrix = this->getTotalMatrix(); this->SkCanvas::setMatrix(SkMatrix::I()); this->SkCanvas::onClipRect(deviceBounds, SkRegion::kReplace_Op, kHard_ClipEdgeStyle); - this->SkCanvas::restore(); //pop the matrix, but keep the clip + this->setMatrix(savedMatrix); break; } default: diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index 0a55e7361c..bea3442084 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -770,7 +770,7 @@ void SkPictureRecord::beginRecording() { // we have to call this *after* our constructor, to ensure that it gets // recorded. This is balanced by restoreToCount() call from endRecording, // which in-turn calls our overridden restore(), so those get recorded too. - fInitialSaveCount = this->save(kMatrixClip_SaveFlag); + fInitialSaveCount = this->save(); } void SkPictureRecord::endRecording() { diff --git a/src/core/SkPictureStateTree.cpp b/src/core/SkPictureStateTree.cpp index ca3032df4f..891d04ca21 100644 --- a/src/core/SkPictureStateTree.cpp +++ b/src/core/SkPictureStateTree.cpp @@ -124,7 +124,7 @@ uint32_t SkPictureStateTree::Iterator::draw() { Node* targetNode = draw->fNode; if (fSave) { - fCanvas->save(SkCanvas::kClip_SaveFlag); + fCanvas->save(); fSave = false; } @@ -162,6 +162,9 @@ uint32_t SkPictureStateTree::Iterator::draw() { fCanvas->restore(); } if (targetNode != ancestor) { + // FIXME: the save below depends on soon-to-be-deprecated + // SaveFlags behavior: it relies on matrix changes persisting + // after restore. fCanvas->save(SkCanvas::kClip_SaveFlag); } } diff --git a/src/effects/SkLayerDrawLooper.cpp b/src/effects/SkLayerDrawLooper.cpp index 5fbb550f75..fa590d2d3f 100644 --- a/src/effects/SkLayerDrawLooper.cpp +++ b/src/effects/SkLayerDrawLooper.cpp @@ -37,7 +37,7 @@ SkLayerDrawLooper::~SkLayerDrawLooper() { } SkLayerDrawLooper::Context* SkLayerDrawLooper::createContext(SkCanvas* canvas, void* storage) const { - canvas->save(SkCanvas::kMatrix_SaveFlag); + canvas->save(); return SkNEW_PLACEMENT_ARGS(storage, LayerDrawLooperContext, (this)); } @@ -140,7 +140,7 @@ bool SkLayerDrawLooper::LayerDrawLooperContext::next(SkCanvas* canvas, ApplyInfo(paint, fCurrRec->fPaint, fCurrRec->fInfo); - canvas->save(SkCanvas::kMatrix_SaveFlag); + canvas->save(); if (fCurrRec->fInfo.fPostTranslate) { postTranslate(canvas, fCurrRec->fInfo.fOffset.fX, fCurrRec->fInfo.fOffset.fY); diff --git a/tests/DeferredCanvasTest.cpp b/tests/DeferredCanvasTest.cpp index 13758a768d..ffcbc23d56 100644 --- a/tests/DeferredCanvasTest.cpp +++ b/tests/DeferredCanvasTest.cpp @@ -290,20 +290,20 @@ static void TestDeferredCanvasFreshFrame(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, canvas->isFreshFrame()); // Verify that clear with saved state triggers a fresh frame - canvas->save(SkCanvas::kMatrixClip_SaveFlag); + canvas->save(); canvas->clear(0x00000000); canvas->restore(); REPORTER_ASSERT(reporter, canvas->isFreshFrame()); // Verify that clear within a layer does NOT trigger a fresh frame - canvas->saveLayer(NULL, NULL, SkCanvas::kARGB_ClipLayer_SaveFlag); + canvas->saveLayer(NULL, NULL); canvas->clear(0x00000000); canvas->restore(); REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); // Verify that a clear with clipping triggers a fresh frame // (clear is not affected by clipping) - canvas->save(SkCanvas::kMatrixClip_SaveFlag); + canvas->save(); canvas->clipRect(partialRect, SkRegion::kIntersect_Op, false); canvas->clear(0x00000000); canvas->restore(); @@ -389,7 +389,7 @@ static void TestDeferredCanvasFreshFrame(skiatest::Reporter* reporter) { // Verify that incomplete coverage due to clipping does not trigger a fresh // frame { - canvas->save(SkCanvas::kMatrixClip_SaveFlag); + canvas->save(); canvas->clipRect(partialRect, SkRegion::kIntersect_Op, false); SkPaint paint; paint.setStyle(SkPaint::kFill_Style); @@ -399,7 +399,7 @@ static void TestDeferredCanvasFreshFrame(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); } { - canvas->save(SkCanvas::kMatrixClip_SaveFlag); + canvas->save(); SkPaint paint; paint.setStyle(SkPaint::kFill_Style); paint.setAlpha(255); diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp index 9748ecfa10..a58c3af5a0 100644 --- a/tests/ImageFilterTest.cpp +++ b/tests/ImageFilterTest.cpp @@ -285,9 +285,7 @@ DEF_TEST(ImageFilterMatrixTest, reporter) { SkAutoTUnref<MatrixTestImageFilter> imageFilter( new MatrixTestImageFilter(reporter, expectedMatrix)); paint.setImageFilter(imageFilter.get()); - SkCanvas::SaveFlags saveFlags = static_cast<SkCanvas::SaveFlags>( - SkCanvas::kHasAlphaLayer_SaveFlag | SkCanvas::kFullColorLayer_SaveFlag); - recordingCanvas->saveLayer(NULL, &paint, saveFlags); + recordingCanvas->saveLayer(NULL, &paint); SkPaint solidPaint; solidPaint.setColor(0xFFFFFFFF); recordingCanvas->save(); |