OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "gm.h" | 8 #include "gm.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 105 } |
106 | 106 |
107 typedef GM INHERITED; | 107 typedef GM INHERITED; |
108 }; | 108 }; |
109 | 109 |
110 ////////////////////////////////////////////////////////////////////////////// | 110 ////////////////////////////////////////////////////////////////////////////// |
111 | 111 |
112 class CanvasLayerStateGM : public GM { | 112 class CanvasLayerStateGM : public GM { |
113 public: | 113 public: |
114 CanvasLayerStateGM() { | 114 CanvasLayerStateGM() { |
| 115 fRedPaint.setColor(SK_ColorRED); |
| 116 fRedPaint.setStyle(SkPaint::kFill_Style); |
| 117 |
115 fBluePaint.setColor(SK_ColorBLUE); | 118 fBluePaint.setColor(SK_ColorBLUE); |
116 fBluePaint.setStyle(SkPaint::kFill_Style); | 119 fBluePaint.setStyle(SkPaint::kFill_Style); |
117 | 120 |
118 fRect = SkRect::MakeXYWH(SPACER, SPACER, WIDTH-(2*SPACER), (HEIGHT-(2*SP
ACER)) / 7); | 121 fRect = SkRect::MakeXYWH(SPACER, SPACER, WIDTH-(2*SPACER), (HEIGHT-(2*SP
ACER)) / 7); |
119 } | 122 } |
120 | 123 |
121 protected: | 124 protected: |
122 virtual SkString onShortName() SK_OVERRIDE { | 125 virtual SkString onShortName() SK_OVERRIDE { |
123 return SkString("canvas-layer-state"); | 126 return SkString("canvas-layer-state"); |
124 } | 127 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 canvas->drawRect(fRect, fBluePaint); | 160 canvas->drawRect(fRect, fBluePaint); |
158 canvas->restore(); | 161 canvas->restore(); |
159 } | 162 } |
160 | 163 |
161 enum { | 164 enum { |
162 WIDTH = 400, | 165 WIDTH = 400, |
163 HEIGHT = 400, | 166 HEIGHT = 400, |
164 SPACER = 10, | 167 SPACER = 10, |
165 }; | 168 }; |
166 | 169 |
| 170 SkPaint fRedPaint; |
167 SkPaint fBluePaint; | 171 SkPaint fBluePaint; |
168 SkRect fRect; | 172 SkRect fRect; |
169 | 173 |
170 typedef GM INHERITED; | 174 typedef GM INHERITED; |
171 }; | 175 }; |
172 | 176 |
173 ////////////////////////////////////////////////////////////////////////////// | 177 ////////////////////////////////////////////////////////////////////////////// |
174 | 178 |
175 DEF_GM( return SkNEW(CanvasStateGM); ) | 179 DEF_GM( return SkNEW(CanvasStateGM); ) |
176 DEF_GM( return SkNEW(CanvasLayerStateGM); ) | 180 DEF_GM( return SkNEW(CanvasLayerStateGM); ) |
177 | 181 |
178 } // end namespace | 182 } // end namespace |
OLD | NEW |