OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |