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

Unified Diff: src/core/SkCanvas.cpp

Issue 2162883002: Rename variables in SkCanvas::internalSaveLayer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | no next file » | 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 60bda8d36a8786c0db64a45aa966f05d37db3c6c..1999f3109fb8c907509518dfe6fd6b8062b92ac7 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1269,37 +1269,36 @@ void SkCanvas::internalSaveLayer(const SaveLayerRec& rec, SaveLayerStrategy stra
}
}
- SkBaseDevice* device = this->getTopDevice();
- if (nullptr == device) {
+ SkBaseDevice* priorDevice = this->getTopDevice();
+ if (!priorDevice) {
SkDebugf("Unable to find device for layer.");
return;
}
- SkImageInfo info = make_layer_info(device->imageInfo(), ir.width(), ir.height(), isOpaque,
+ SkImageInfo info = make_layer_info(priorDevice->imageInfo(), ir.width(), ir.height(), isOpaque,
paint);
+ SkAutoTUnref<SkBaseDevice> newDevice;
{
const bool preserveLCDText = kOpaque_SkAlphaType == info.alphaType() ||
(saveLayerFlags & kPreserveLCDText_SaveLayerFlag);
const SkBaseDevice::TileUsage usage = SkBaseDevice::kNever_TileUsage;
const SkBaseDevice::CreateInfo createInfo = SkBaseDevice::CreateInfo(info, usage, geo,
preserveLCDText);
- SkBaseDevice* newDev = device->onCreateDevice(createInfo, paint);
- if (nullptr == newDev) {
+ newDevice.reset(priorDevice->onCreateDevice(createInfo, paint));
+ if (!newDevice) {
SkErrorInternals::SetError(kInternalError_SkError,
"Unable to create device for layer.");
return;
}
- device = newDev;
}
- device->setOrigin(ir.fLeft, ir.fTop);
+ newDevice->setOrigin(ir.fLeft, ir.fTop);
if (rec.fBackdrop) {
- draw_filter_into_device(fMCRec->fTopLayer->fDevice, rec.fBackdrop, device, fMCRec->fMatrix);
+ draw_filter_into_device(priorDevice, rec.fBackdrop, newDevice, fMCRec->fMatrix);
}
- DeviceCM* layer = new DeviceCM(device, paint, this, fConservativeRasterClip, stashedMatrix);
- device->unref();
+ DeviceCM* layer = new DeviceCM(newDevice, paint, this, fConservativeRasterClip, stashedMatrix);
layer->fNext = fMCRec->fTopLayer;
fMCRec->fLayer = layer;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698