Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: src/core/SkCanvas.cpp

Issue 1567063002: Revert[2] of "add backdrop option to SaveLayerRec" (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add test and fix for svg-savelayer optimization Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samplecode/SampleLayers.cpp ('k') | src/core/SkPictureFlat.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index a4acbdc94d118e2d6fe1b3cee023416f4a9efe28..82ceba4fa9f45978c1440c4420e40f0cbecae97a 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -114,7 +114,6 @@ bool SkCanvas::Internal_Private_GetTreatSpriteAsBitmap() {
// experimental for faster tiled drawing...
//#define SK_ENABLE_CLIP_QUICKREJECT
-
//#define SK_TRACE_SAVERESTORE
#ifdef SK_TRACE_SAVERESTORE
@@ -481,7 +480,7 @@ public:
// Make rawBounds include all paint outsets except for those due to image filters.
rawBounds = &apply_paint_to_bounds_sans_imagefilter(*fPaint, *rawBounds, &storage);
}
- (void)canvas->internalSaveLayer(SkCanvas::SaveLayerRec(rawBounds, &tmp, 0),
+ (void)canvas->internalSaveLayer(SkCanvas::SaveLayerRec(rawBounds, &tmp),
SkCanvas::kFullLayer_SaveLayerStrategy);
fTempLayerForImageFilter = true;
// we remove the imagefilter/xfermode inside doNext()
@@ -1173,7 +1172,8 @@ int SkCanvas::saveLayer(const SaveLayerRec& origRec) {
return this->getSaveCount() - 1;
}
-static void draw_filter_into_device(SkBaseDevice* src, SkImageFilter* filter, SkBaseDevice* dst) {
+static void draw_filter_into_device(SkBaseDevice* src, const SkImageFilter* filter,
+ SkBaseDevice* dst, const SkMatrix& ctm) {
SkBitmap srcBM;
@@ -1198,9 +1198,12 @@ static void draw_filter_into_device(SkBaseDevice* src, SkImageFilter* filter, Sk
SkCanvas c(dst);
+ SkAutoTUnref<SkImageFilter> localF(filter->newWithLocalMatrix(ctm));
SkPaint p;
- p.setImageFilter(filter);
- c.drawBitmap(srcBM, 0, 0, &p);
+ p.setImageFilter(localF);
+ const SkScalar x = SkIntToScalar(src->getOrigin().x());
+ const SkScalar y = SkIntToScalar(src->getOrigin().y());
+ c.drawBitmap(srcBM, x, y, &p);
}
void SkCanvas::internalSaveLayer(const SaveLayerRec& rec, SaveLayerStrategy strategy) {
@@ -1268,11 +1271,10 @@ void SkCanvas::internalSaveLayer(const SaveLayerRec& rec, SaveLayerStrategy stra
}
device = newDev;
}
-
device->setOrigin(ir.fLeft, ir.fTop);
- if (0) {
- draw_filter_into_device(fMCRec->fTopLayer->fDevice, nullptr, device);
+ if (rec.fBackdrop) {
+ draw_filter_into_device(fMCRec->fTopLayer->fDevice, rec.fBackdrop, device, fMCRec->fMatrix);
}
DeviceCM* layer =
« no previous file with comments | « samplecode/SampleLayers.cpp ('k') | src/core/SkPictureFlat.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698