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

Side by Side Diff: src/core/SkCanvas.cpp

Issue 1535993003: hide old SaveFlags (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: aaaaaargh Created 5 years 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 | « include/core/SkCanvas.h ('k') | src/core/SkPicturePlayback.cpp » ('j') | 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 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 fClipStack->clipDevRect(ir, SkRegion::kReplace_Op); 1115 fClipStack->clipDevRect(ir, SkRegion::kReplace_Op);
1116 fMCRec->fRasterClip.setRect(ir); 1116 fMCRec->fRasterClip.setRect(ir);
1117 } 1117 }
1118 1118
1119 if (intersection) { 1119 if (intersection) {
1120 *intersection = ir; 1120 *intersection = ir;
1121 } 1121 }
1122 return true; 1122 return true;
1123 } 1123 }
1124 1124
1125 #ifdef SK_SUPPORT_LEGACY_SAVEFLAGS
1125 uint32_t SkCanvas::SaveFlagsToSaveLayerFlags(SaveFlags flags) { 1126 uint32_t SkCanvas::SaveFlagsToSaveLayerFlags(SaveFlags flags) {
1126 uint32_t layerFlags = 0; 1127 uint32_t layerFlags = 0;
1127 1128
1128 if (0 == (flags & kClipToLayer_SaveFlag)) { 1129 if (0 == (flags & kClipToLayer_SaveFlag)) {
1129 layerFlags |= kDontClipToLayer_PrivateSaveLayerFlag; 1130 layerFlags |= kDontClipToLayer_PrivateSaveLayerFlag;
1130 } 1131 }
1131 if (0 == (flags & kHasAlphaLayer_SaveFlag)) { 1132 if (0 == (flags & kHasAlphaLayer_SaveFlag)) {
1132 layerFlags |= kIsOpaque_SaveLayerFlag; 1133 layerFlags |= kIsOpaque_SaveLayerFlag;
1133 } 1134 }
1134 return layerFlags; 1135 return layerFlags;
1135 } 1136 }
1137 #endif
1136 1138
1137 int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint) { 1139 int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint) {
1138 return this->saveLayer(SaveLayerRec(bounds, paint, 0)); 1140 return this->saveLayer(SaveLayerRec(bounds, paint, 0));
1139 } 1141 }
1140 1142
1143 #ifdef SK_SUPPORT_LEGACY_SAVEFLAGS
1141 int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags fl ags) { 1144 int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags fl ags) {
1142 return this->saveLayer(SaveLayerRec(bounds, paint, SaveFlagsToSaveLayerFlags (flags))); 1145 return this->saveLayer(SaveLayerRec(bounds, paint, SaveFlagsToSaveLayerFlags (flags)));
1143 } 1146 }
1147 #endif
1144 1148
1145 int SkCanvas::saveLayerPreserveLCDTextRequests(const SkRect* bounds, const SkPai nt* paint) { 1149 int SkCanvas::saveLayerPreserveLCDTextRequests(const SkRect* bounds, const SkPai nt* paint) {
1146 return this->saveLayer(SaveLayerRec(bounds, paint, kPreserveLCDText_SaveLaye rFlag)); 1150 return this->saveLayer(SaveLayerRec(bounds, paint, kPreserveLCDText_SaveLaye rFlag));
1147 } 1151 }
1148 1152
1149 int SkCanvas::saveLayer(const SaveLayerRec& origRec) { 1153 int SkCanvas::saveLayer(const SaveLayerRec& origRec) {
1150 SaveLayerRec rec(origRec); 1154 SaveLayerRec rec(origRec);
1151 if (gIgnoreSaveLayerBounds) { 1155 if (gIgnoreSaveLayerBounds) {
1152 rec.fBounds = nullptr; 1156 rec.fBounds = nullptr;
1153 } 1157 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 DeviceCM* layer = 1266 DeviceCM* layer =
1263 new DeviceCM(device, paint, this, fConservativeRasterClip, forceSpri teOnRestore); 1267 new DeviceCM(device, paint, this, fConservativeRasterClip, forceSpri teOnRestore);
1264 device->unref(); 1268 device->unref();
1265 1269
1266 layer->fNext = fMCRec->fTopLayer; 1270 layer->fNext = fMCRec->fTopLayer;
1267 fMCRec->fLayer = layer; 1271 fMCRec->fLayer = layer;
1268 fMCRec->fTopLayer = layer; // this field is NOT an owner of layer 1272 fMCRec->fTopLayer = layer; // this field is NOT an owner of layer
1269 } 1273 }
1270 1274
1271 int SkCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha) { 1275 int SkCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha) {
1272 return this->saveLayerAlpha(bounds, alpha, kARGB_ClipLayer_SaveFlag); 1276 if (0xFF == alpha) {
1277 return this->saveLayer(bounds, nullptr);
1278 } else {
1279 SkPaint tmpPaint;
1280 tmpPaint.setAlpha(alpha);
1281 return this->saveLayer(bounds, &tmpPaint);
1282 }
1273 } 1283 }
1274 1284
1285 #ifdef SK_SUPPORT_LEGACY_SAVEFLAGS
1275 int SkCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha, 1286 int SkCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha,
1276 SaveFlags flags) { 1287 SaveFlags flags) {
1277 if (0xFF == alpha) { 1288 if (0xFF == alpha) {
1278 return this->saveLayer(bounds, nullptr, flags); 1289 return this->saveLayer(bounds, nullptr, flags);
1279 } else { 1290 } else {
1280 SkPaint tmpPaint; 1291 SkPaint tmpPaint;
1281 tmpPaint.setAlpha(alpha); 1292 tmpPaint.setAlpha(alpha);
1282 return this->saveLayer(bounds, &tmpPaint, flags); 1293 return this->saveLayer(bounds, &tmpPaint, flags);
1283 } 1294 }
1284 } 1295 }
1296 #endif
1285 1297
1286 void SkCanvas::internalRestore() { 1298 void SkCanvas::internalRestore() {
1287 SkASSERT(fMCStack.count() != 0); 1299 SkASSERT(fMCStack.count() != 0);
1288 1300
1289 fDeviceCMDirty = true; 1301 fDeviceCMDirty = true;
1290 fCachedLocalClipBoundsDirty = true; 1302 fCachedLocalClipBoundsDirty = true;
1291 1303
1292 fClipStack->restore(); 1304 fClipStack->restore();
1293 1305
1294 // reserve our layer (if any) 1306 // reserve our layer (if any)
(...skipping 1732 matching lines...) Expand 10 before | Expand all | Expand 10 after
3027 } 3039 }
3028 3040
3029 if (matrix) { 3041 if (matrix) {
3030 canvas->concat(*matrix); 3042 canvas->concat(*matrix);
3031 } 3043 }
3032 } 3044 }
3033 3045
3034 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 3046 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
3035 fCanvas->restoreToCount(fSaveCount); 3047 fCanvas->restoreToCount(fSaveCount);
3036 } 3048 }
OLDNEW
« no previous file with comments | « include/core/SkCanvas.h ('k') | src/core/SkPicturePlayback.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698