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

Unified Diff: src/core/SkCanvas.cpp

Issue 355193006: stop calling SkCanvas::getDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: guard gpu code in no-gpu build Created 6 years, 6 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 | « src/animator/SkSnapshot.cpp ('k') | src/utils/SkDeferredCanvas.cpp » ('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 2fb5c951249d54c1905107e0a1c6161e1461281a..059e321654555e4ccdab3b44387a704bd0188939 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -875,12 +875,6 @@ int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
return this->internalSaveLayer(bounds, paint, flags, false, strategy);
}
-static SkBaseDevice* create_compatible_device(SkCanvas* canvas,
- const SkImageInfo& info) {
- SkBaseDevice* device = canvas->getDevice();
- return device ? device->createCompatibleDevice(info) : NULL;
-}
-
int SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags,
bool justForImageFilter, SaveLayerStrategy strategy) {
#ifndef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
@@ -924,7 +918,10 @@ int SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, Save
SkBaseDevice* device;
if (paint && paint->getImageFilter()) {
- device = create_compatible_device(this, info);
+ device = this->getDevice();
+ if (device) {
+ device = device->createCompatibleDevice(info);
+ }
} else {
device = this->createLayerDevice(info);
}
@@ -1402,13 +1399,8 @@ static void clip_path_helper(const SkCanvas* canvas, SkRasterClip* currClip,
currClip->op(clip, op);
}
} else {
- const SkBaseDevice* device = canvas->getDevice();
- if (!device) {
- currClip->setEmpty();
- return;
- }
-
- base.setRect(0, 0, device->width(), device->height());
+ const SkISize size = canvas->getBaseLayerSize();
+ base.setRect(0, 0, size.width(), size.height());
if (SkRegion::kReplace_Op == op) {
currClip->setPath(devPath, base, doAA);
« no previous file with comments | « src/animator/SkSnapshot.cpp ('k') | src/utils/SkDeferredCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698