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

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

Issue 190723004: flag to make kClipToLayer_SaveFlag the default behavior (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: officially ignore the gm that was exercising this (now removed) feature Created 6 years, 9 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/SkCanvas.h ('k') | tests/CanvasStateTest.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 /* 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 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 805
806 return saveCount; 806 return saveCount;
807 } 807 }
808 808
809 int SkCanvas::save(SaveFlags flags) { 809 int SkCanvas::save(SaveFlags flags) {
810 // call shared impl 810 // call shared impl
811 return this->internalSave(flags); 811 return this->internalSave(flags);
812 } 812 }
813 813
814 static bool bounds_affects_clip(SkCanvas::SaveFlags flags) { 814 static bool bounds_affects_clip(SkCanvas::SaveFlags flags) {
815 #ifdef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
815 return (flags & SkCanvas::kClipToLayer_SaveFlag) != 0; 816 return (flags & SkCanvas::kClipToLayer_SaveFlag) != 0;
817 #else
818 return true;
819 #endif
816 } 820 }
817 821
818 bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveFlags flags, 822 bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveFlags flags,
819 SkIRect* intersection, const SkImageFilter* image Filter) { 823 SkIRect* intersection, const SkImageFilter* image Filter) {
820 SkIRect clipBounds; 824 SkIRect clipBounds;
821 SkRegion::Op op = SkRegion::kIntersect_Op; 825 SkRegion::Op op = SkRegion::kIntersect_Op;
822 if (!this->getClipDeviceBounds(&clipBounds)) { 826 if (!this->getClipDeviceBounds(&clipBounds)) {
823 return false; 827 return false;
824 } 828 }
825 829
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 } 869 }
866 870
867 static SkBaseDevice* createCompatibleDevice(SkCanvas* canvas, 871 static SkBaseDevice* createCompatibleDevice(SkCanvas* canvas,
868 const SkImageInfo& info) { 872 const SkImageInfo& info) {
869 SkBaseDevice* device = canvas->getDevice(); 873 SkBaseDevice* device = canvas->getDevice();
870 return device ? device->createCompatibleDevice(info) : NULL; 874 return device ? device->createCompatibleDevice(info) : NULL;
871 } 875 }
872 876
873 int SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, 877 int SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint,
874 SaveFlags flags, bool justForImageFilter) { 878 SaveFlags flags, bool justForImageFilter) {
879 #ifndef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
880 flags = (SaveFlags)(flags | kClipToLayer_SaveFlag);
881 #endif
882
875 // do this before we create the layer. We don't call the public save() since 883 // do this before we create the layer. We don't call the public save() since
876 // that would invoke a possibly overridden virtual 884 // that would invoke a possibly overridden virtual
877 int count = this->internalSave(flags); 885 int count = this->internalSave(flags);
878 886
879 fDeviceCMDirty = true; 887 fDeviceCMDirty = true;
880 888
881 SkIRect ir; 889 SkIRect ir;
882 if (!this->clipRectBounds(bounds, flags, &ir, paint ? paint->getImageFilter( ) : NULL)) { 890 if (!this->clipRectBounds(bounds, flags, &ir, paint ? paint->getImageFilter( ) : NULL)) {
883 return count; 891 return count;
884 } 892 }
(...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after
2451 if (!bitmap.allocPixels(info)) { 2459 if (!bitmap.allocPixels(info)) {
2452 return NULL; 2460 return NULL;
2453 } 2461 }
2454 2462
2455 // should this functionality be moved into allocPixels()? 2463 // should this functionality be moved into allocPixels()?
2456 if (!bitmap.info().isOpaque()) { 2464 if (!bitmap.info().isOpaque()) {
2457 bitmap.eraseColor(0); 2465 bitmap.eraseColor(0);
2458 } 2466 }
2459 return SkNEW_ARGS(SkCanvas, (bitmap)); 2467 return SkNEW_ARGS(SkCanvas, (bitmap));
2460 } 2468 }
OLDNEW
« no previous file with comments | « include/core/SkCanvas.h ('k') | tests/CanvasStateTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698