| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 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 "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 /** | 975 /** |
| 976 * A canvas that records the number of clip commands. | 976 * A canvas that records the number of clip commands. |
| 977 */ | 977 */ |
| 978 class ClipCountingCanvas : public SkCanvas { | 978 class ClipCountingCanvas : public SkCanvas { |
| 979 public: | 979 public: |
| 980 explicit ClipCountingCanvas(int width, int height) | 980 explicit ClipCountingCanvas(int width, int height) |
| 981 : INHERITED(width, height) | 981 : INHERITED(width, height) |
| 982 , fClipCount(0){ | 982 , fClipCount(0){ |
| 983 } | 983 } |
| 984 | 984 |
| 985 virtual bool clipRect(const SkRect& r, SkRegion::Op op, bool doAA) | 985 virtual void onClipRect(const SkRect& r, |
| 986 SK_OVERRIDE { | 986 SkRegion::Op op, |
| 987 ClipEdgeStyle edgeStyle) SK_OVERRIDE { |
| 987 fClipCount += 1; | 988 fClipCount += 1; |
| 988 return this->INHERITED::clipRect(r, op, doAA); | 989 this->INHERITED::onClipRect(r, op, edgeStyle); |
| 989 } | 990 } |
| 990 | 991 |
| 991 virtual bool clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) | 992 virtual void onClipRRect(const SkRRect& rrect, |
| 992 SK_OVERRIDE { | 993 SkRegion::Op op, |
| 994 ClipEdgeStyle edgeStyle)SK_OVERRIDE { |
| 993 fClipCount += 1; | 995 fClipCount += 1; |
| 994 return this->INHERITED::clipRRect(rrect, op, doAA); | 996 this->INHERITED::onClipRRect(rrect, op, edgeStyle); |
| 995 } | 997 } |
| 996 | 998 |
| 997 virtual bool clipPath(const SkPath& path, SkRegion::Op op, bool doAA) | 999 virtual void onClipPath(const SkPath& path, |
| 998 SK_OVERRIDE { | 1000 SkRegion::Op op, |
| 1001 ClipEdgeStyle edgeStyle) SK_OVERRIDE { |
| 999 fClipCount += 1; | 1002 fClipCount += 1; |
| 1000 return this->INHERITED::clipPath(path, op, doAA); | 1003 this->INHERITED::onClipPath(path, op, edgeStyle); |
| 1004 } |
| 1005 |
| 1006 virtual void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) SK_OVE
RRIDE { |
| 1007 fClipCount += 1; |
| 1008 this->INHERITED::onClipRegion(deviceRgn, op); |
| 1001 } | 1009 } |
| 1002 | 1010 |
| 1003 unsigned getClipCount() const { return fClipCount; } | 1011 unsigned getClipCount() const { return fClipCount; } |
| 1004 | 1012 |
| 1005 private: | 1013 private: |
| 1006 unsigned fClipCount; | 1014 unsigned fClipCount; |
| 1007 | 1015 |
| 1008 typedef SkCanvas INHERITED; | 1016 typedef SkCanvas INHERITED; |
| 1009 }; | 1017 }; |
| 1010 | 1018 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 picture.endRecording(); | 1122 picture.endRecording(); |
| 1115 } | 1123 } |
| 1116 | 1124 |
| 1117 DEF_TEST(Canvas_EmptyBitmap, r) { | 1125 DEF_TEST(Canvas_EmptyBitmap, r) { |
| 1118 SkBitmap dst; | 1126 SkBitmap dst; |
| 1119 dst.allocN32Pixels(10, 10); | 1127 dst.allocN32Pixels(10, 10); |
| 1120 SkCanvas canvas(dst); | 1128 SkCanvas canvas(dst); |
| 1121 | 1129 |
| 1122 test_draw_bitmaps(&canvas); | 1130 test_draw_bitmaps(&canvas); |
| 1123 } | 1131 } |
| OLD | NEW |