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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCanvasPriv.h" 10 #include "SkCanvasPriv.h"
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 bool isOpaque = SkToBool(saveLayerFlags & kIsOpaque_SaveLayerFlag); 1262 bool isOpaque = SkToBool(saveLayerFlags & kIsOpaque_SaveLayerFlag);
1263 SkPixelGeometry geo = fProps.pixelGeometry(); 1263 SkPixelGeometry geo = fProps.pixelGeometry();
1264 if (paint) { 1264 if (paint) {
1265 // TODO: perhaps add a query to filters so we might preserve opaqueness. .. 1265 // TODO: perhaps add a query to filters so we might preserve opaqueness. ..
1266 if (paint->getImageFilter() || paint->getColorFilter()) { 1266 if (paint->getImageFilter() || paint->getColorFilter()) {
1267 isOpaque = false; 1267 isOpaque = false;
1268 geo = kUnknown_SkPixelGeometry; 1268 geo = kUnknown_SkPixelGeometry;
1269 } 1269 }
1270 } 1270 }
1271 1271
1272 SkBaseDevice* device = this->getTopDevice(); 1272 SkBaseDevice* priorDevice = this->getTopDevice();
1273 if (nullptr == device) { 1273 if (!priorDevice) {
1274 SkDebugf("Unable to find device for layer."); 1274 SkDebugf("Unable to find device for layer.");
1275 return; 1275 return;
1276 } 1276 }
1277 1277
1278 SkImageInfo info = make_layer_info(device->imageInfo(), ir.width(), ir.heigh t(), isOpaque, 1278 SkImageInfo info = make_layer_info(priorDevice->imageInfo(), ir.width(), ir. height(), isOpaque,
1279 paint); 1279 paint);
1280 1280
1281 SkAutoTUnref<SkBaseDevice> newDevice;
1281 { 1282 {
1282 const bool preserveLCDText = kOpaque_SkAlphaType == info.alphaType() || 1283 const bool preserveLCDText = kOpaque_SkAlphaType == info.alphaType() ||
1283 (saveLayerFlags & kPreserveLCDText_SaveLaye rFlag); 1284 (saveLayerFlags & kPreserveLCDText_SaveLaye rFlag);
1284 const SkBaseDevice::TileUsage usage = SkBaseDevice::kNever_TileUsage; 1285 const SkBaseDevice::TileUsage usage = SkBaseDevice::kNever_TileUsage;
1285 const SkBaseDevice::CreateInfo createInfo = SkBaseDevice::CreateInfo(inf o, usage, geo, 1286 const SkBaseDevice::CreateInfo createInfo = SkBaseDevice::CreateInfo(inf o, usage, geo,
1286 pre serveLCDText); 1287 pre serveLCDText);
1287 SkBaseDevice* newDev = device->onCreateDevice(createInfo, paint); 1288 newDevice.reset(priorDevice->onCreateDevice(createInfo, paint));
1288 if (nullptr == newDev) { 1289 if (!newDevice) {
1289 SkErrorInternals::SetError(kInternalError_SkError, 1290 SkErrorInternals::SetError(kInternalError_SkError,
1290 "Unable to create device for layer."); 1291 "Unable to create device for layer.");
1291 return; 1292 return;
1292 } 1293 }
1293 device = newDev;
1294 } 1294 }
1295 device->setOrigin(ir.fLeft, ir.fTop); 1295 newDevice->setOrigin(ir.fLeft, ir.fTop);
1296 1296
1297 if (rec.fBackdrop) { 1297 if (rec.fBackdrop) {
1298 draw_filter_into_device(fMCRec->fTopLayer->fDevice, rec.fBackdrop, devic e, fMCRec->fMatrix); 1298 draw_filter_into_device(priorDevice, rec.fBackdrop, newDevice, fMCRec->f Matrix);
1299 } 1299 }
1300 1300
1301 DeviceCM* layer = new DeviceCM(device, paint, this, fConservativeRasterClip, stashedMatrix); 1301 DeviceCM* layer = new DeviceCM(newDevice, paint, this, fConservativeRasterCl ip, stashedMatrix);
1302 device->unref();
1303 1302
1304 layer->fNext = fMCRec->fTopLayer; 1303 layer->fNext = fMCRec->fTopLayer;
1305 fMCRec->fLayer = layer; 1304 fMCRec->fLayer = layer;
1306 fMCRec->fTopLayer = layer; // this field is NOT an owner of layer 1305 fMCRec->fTopLayer = layer; // this field is NOT an owner of layer
1307 } 1306 }
1308 1307
1309 int SkCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha) { 1308 int SkCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha) {
1310 if (0xFF == alpha) { 1309 if (0xFF == alpha) {
1311 return this->saveLayer(bounds, nullptr); 1310 return this->saveLayer(bounds, nullptr);
1312 } else { 1311 } else {
(...skipping 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after
3119 3118
3120 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 3119 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
3121 fCanvas->restoreToCount(fSaveCount); 3120 fCanvas->restoreToCount(fSaveCount);
3122 } 3121 }
3123 3122
3124 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API 3123 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API
3125 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) { 3124 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) {
3126 return this->makeSurface(info, props).release(); 3125 return this->makeSurface(info, props).release();
3127 } 3126 }
3128 #endif 3127 #endif
OLDNEW
« 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