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

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

Issue 246023008: Deprecate SaveFlags use in the public SkCanvas API. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « include/core/SkPostConfig.h ('k') | 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 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 fClipStack.save(); 849 fClipStack.save();
850 } 850 }
851 851
852 return saveCount; 852 return saveCount;
853 } 853 }
854 854
855 void SkCanvas::willSave(SaveFlags) { 855 void SkCanvas::willSave(SaveFlags) {
856 // Do nothing. Subclasses may do something. 856 // Do nothing. Subclasses may do something.
857 } 857 }
858 858
859 int SkCanvas::save() {
860 this->willSave(kMatrixClip_SaveFlag);
861 return this->internalSave(kMatrixClip_SaveFlag);
862 }
863
859 int SkCanvas::save(SaveFlags flags) { 864 int SkCanvas::save(SaveFlags flags) {
860 this->willSave(flags); 865 this->willSave(flags);
861 // call shared impl 866 // call shared impl
862 return this->internalSave(flags); 867 return this->internalSave(flags);
863 } 868 }
864 869
865 static bool bounds_affects_clip(SkCanvas::SaveFlags flags) { 870 static bool bounds_affects_clip(SkCanvas::SaveFlags flags) {
866 #ifdef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG 871 #ifdef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
867 return (flags & SkCanvas::kClipToLayer_SaveFlag) != 0; 872 return (flags & SkCanvas::kClipToLayer_SaveFlag) != 0;
868 #else 873 #else
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 } 918 }
914 return true; 919 return true;
915 } 920 }
916 921
917 SkCanvas::SaveLayerStrategy SkCanvas::willSaveLayer(const SkRect*, const SkPaint *, SaveFlags) { 922 SkCanvas::SaveLayerStrategy SkCanvas::willSaveLayer(const SkRect*, const SkPaint *, SaveFlags) {
918 923
919 // Do nothing. Subclasses may do something. 924 // Do nothing. Subclasses may do something.
920 return kFullLayer_SaveLayerStrategy; 925 return kFullLayer_SaveLayerStrategy;
921 } 926 }
922 927
928 int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint) {
929 // Overriding classes may return false to signal that we don't need to creat e a layer.
mtklein 2014/04/23 17:43:12 ...return kNoLayer_SaveLayerStrategy...? Or just
f(malita) 2014/04/24 20:39:23 Done.
930 SaveLayerStrategy strategy = this->willSaveLayer(bounds, paint, kARGB_ClipLa yer_SaveFlag);
931 return this->internalSaveLayer(bounds, paint, kARGB_ClipLayer_SaveFlag, fals e, strategy);
932 }
933
923 int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint, 934 int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
924 SaveFlags flags) { 935 SaveFlags flags) {
925 // Overriding classes may return false to signal that we don't need to creat e a layer. 936 // Overriding classes may return false to signal that we don't need to creat e a layer.
926 SaveLayerStrategy strategy = this->willSaveLayer(bounds, paint, flags); 937 SaveLayerStrategy strategy = this->willSaveLayer(bounds, paint, flags);
927 return this->internalSaveLayer(bounds, paint, flags, false, strategy); 938 return this->internalSaveLayer(bounds, paint, flags, false, strategy);
928 } 939 }
929 940
930 static SkBaseDevice* create_compatible_device(SkCanvas* canvas, 941 static SkBaseDevice* create_compatible_device(SkCanvas* canvas,
931 const SkImageInfo& info) { 942 const SkImageInfo& info) {
932 SkBaseDevice* device = canvas->getDevice(); 943 SkBaseDevice* device = canvas->getDevice();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 device->unref(); 1001 device->unref();
991 1002
992 layer->fNext = fMCRec->fTopLayer; 1003 layer->fNext = fMCRec->fTopLayer;
993 fMCRec->fLayer = layer; 1004 fMCRec->fLayer = layer;
994 fMCRec->fTopLayer = layer; // this field is NOT an owner of layer 1005 fMCRec->fTopLayer = layer; // this field is NOT an owner of layer
995 1006
996 fSaveLayerCount += 1; 1007 fSaveLayerCount += 1;
997 return count; 1008 return count;
998 } 1009 }
999 1010
1011 int SkCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha) {
1012 return this->saveLayerAlpha(bounds, alpha, kARGB_ClipLayer_SaveFlag);
1013 }
1014
1000 int SkCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha, 1015 int SkCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha,
1001 SaveFlags flags) { 1016 SaveFlags flags) {
1002 if (0xFF == alpha) { 1017 if (0xFF == alpha) {
1003 return this->saveLayer(bounds, NULL, flags); 1018 return this->saveLayer(bounds, NULL, flags);
1004 } else { 1019 } else {
1005 SkPaint tmpPaint; 1020 SkPaint tmpPaint;
1006 tmpPaint.setAlpha(alpha); 1021 tmpPaint.setAlpha(alpha);
1007 return this->saveLayer(bounds, &tmpPaint, flags); 1022 return this->saveLayer(bounds, &tmpPaint, flags);
1008 } 1023 }
1009 } 1024 }
(...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after
2667 if (!supported_for_raster_canvas(info)) { 2682 if (!supported_for_raster_canvas(info)) {
2668 return NULL; 2683 return NULL;
2669 } 2684 }
2670 2685
2671 SkBitmap bitmap; 2686 SkBitmap bitmap;
2672 if (!bitmap.installPixels(info, pixels, rowBytes)) { 2687 if (!bitmap.installPixels(info, pixels, rowBytes)) {
2673 return NULL; 2688 return NULL;
2674 } 2689 }
2675 return SkNEW_ARGS(SkCanvas, (bitmap)); 2690 return SkNEW_ARGS(SkCanvas, (bitmap));
2676 } 2691 }
OLDNEW
« no previous file with comments | « include/core/SkPostConfig.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698