OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
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 #ifndef SkCanvasStack_DEFINED | 9 #ifndef SkCanvasStack_DEFINED |
10 #define SkCanvasStack_DEFINED | 10 #define SkCanvasStack_DEFINED |
11 | 11 |
12 #include "SkNWayCanvas.h" | 12 #include "SkNWayCanvas.h" |
13 #include "SkTArray.h" | 13 #include "SkTArray.h" |
14 | 14 |
15 class SkCanvasStack : public SkNWayCanvas { | 15 class SkCanvasStack : public SkNWayCanvas { |
16 public: | 16 public: |
17 SkCanvasStack(int width, int height); | 17 SkCanvasStack(int width, int height); |
18 virtual ~SkCanvasStack(); | 18 virtual ~SkCanvasStack(); |
19 | 19 |
20 void pushCanvas(SkCanvas* canvas, const SkIPoint& origin); | 20 void pushCanvas(SkCanvas* canvas, const SkIPoint& origin); |
21 virtual void removeAll() SK_OVERRIDE; | 21 virtual void removeAll() SK_OVERRIDE; |
22 | 22 |
23 /* | 23 /* |
24 * The following add/remove canvas methods are overrides from SkNWayCanvas | 24 * The following add/remove canvas methods are overrides from SkNWayCanvas |
25 * that do not make sense in the context of our CanvasStack, but since we | 25 * that do not make sense in the context of our CanvasStack, but since we |
26 * can share most of the other implementation of NWay we override those | 26 * can share most of the other implementation of NWay we override those |
27 * methods to be no-ops. | 27 * methods to be no-ops. |
28 */ | 28 */ |
29 virtual void addCanvas(SkCanvas*) SK_OVERRIDE { SkASSERT(!"Invalid Op"); } | 29 virtual void addCanvas(SkCanvas*) SK_OVERRIDE { SkDEBUGFAIL("Invalid Op"); } |
30 virtual void removeCanvas(SkCanvas*) SK_OVERRIDE { SkASSERT(!"Invalid Op");
} | 30 virtual void removeCanvas(SkCanvas*) SK_OVERRIDE { SkDEBUGFAIL("Invalid Op")
; } |
31 | 31 |
32 virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE; | 32 virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE; |
33 virtual bool clipRect(const SkRect&, SkRegion::Op, bool) SK_OVERRIDE; | 33 virtual bool clipRect(const SkRect&, SkRegion::Op, bool) SK_OVERRIDE; |
34 virtual bool clipRRect(const SkRRect&, SkRegion::Op, bool) SK_OVERRIDE; | 34 virtual bool clipRRect(const SkRRect&, SkRegion::Op, bool) SK_OVERRIDE; |
35 virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE; | 35 virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE; |
36 virtual bool clipRegion(const SkRegion& deviceRgn, | 36 virtual bool clipRegion(const SkRegion& deviceRgn, |
37 SkRegion::Op) SK_OVERRIDE; | 37 SkRegion::Op) SK_OVERRIDE; |
38 | 38 |
39 private: | 39 private: |
40 void clipToZOrderedBounds(); | 40 void clipToZOrderedBounds(); |
41 | 41 |
42 struct CanvasData { | 42 struct CanvasData { |
43 SkIPoint origin; | 43 SkIPoint origin; |
44 SkRegion requiredClip; | 44 SkRegion requiredClip; |
45 }; | 45 }; |
46 | 46 |
47 SkTArray<CanvasData> fCanvasData; | 47 SkTArray<CanvasData> fCanvasData; |
48 | 48 |
49 typedef SkNWayCanvas INHERITED; | 49 typedef SkNWayCanvas INHERITED; |
50 }; | 50 }; |
51 | 51 |
52 #endif | 52 #endif |
OLD | NEW |