diff options
author | robertphillips <robertphillips@google.com> | 2016-07-19 05:10:40 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-19 05:10:40 -0700 |
commit | 5139e501c5ac3a511e35c78395c907a176113451 (patch) | |
tree | 57324065bc6dfe016afdb9f459d06912dafa40c4 /src | |
parent | 718aab1e3f02f57f79072f70906acab866ace155 (diff) |
Rename variables in SkCanvas::internalSaveLayer
This is split out of https://codereview.chromium.org/2145343005/ (Recast draw_filter_into_device as drawDevice) to, hopefully, make it easier to integrate that CL
TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2162883002
Review-Url: https://codereview.chromium.org/2162883002
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkCanvas.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 60bda8d36a..1999f3109f 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; |