OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkShader.h" | 10 #include "SkShader.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 147 } |
148 default: | 148 default: |
149 break; | 149 break; |
150 } | 150 } |
151 | 151 |
152 if (restoreNeeded) { | 152 if (restoreNeeded) { |
153 canvas->restore(); | 153 canvas->restore(); |
154 } | 154 } |
155 } | 155 } |
156 | 156 |
157 virtual void onOnceBeforeDraw() SK_OVERRIDE { | 157 void onOnceBeforeDraw() SK_OVERRIDE { |
158 fBG.installPixels(SkImageInfo::Make(2, 2, kARGB_4444_SkColorType, | 158 fBG.installPixels(SkImageInfo::Make(2, 2, kARGB_4444_SkColorType, |
159 kOpaque_SkAlphaType), | 159 kOpaque_SkAlphaType), |
160 gData, 4); | 160 gData, 4); |
161 | 161 |
162 make_bitmaps(W, H, &fSrcB, &fDstB, &fTransparent); | 162 make_bitmaps(W, H, &fSrcB, &fDstB, &fTransparent); |
163 } | 163 } |
164 | 164 |
165 public: | 165 public: |
166 const static int W = 64; | 166 const static int W = 64; |
167 const static int H = 64; | 167 const static int H = 64; |
168 XfermodesGM() {} | 168 XfermodesGM() {} |
169 | 169 |
170 protected: | 170 protected: |
171 virtual SkString onShortName() SK_OVERRIDE { | 171 SkString onShortName() SK_OVERRIDE { |
172 return SkString("xfermodes"); | 172 return SkString("xfermodes"); |
173 } | 173 } |
174 | 174 |
175 virtual SkISize onISize() SK_OVERRIDE { | 175 SkISize onISize() SK_OVERRIDE { |
176 return SkISize::Make(1990, 640); | 176 return SkISize::Make(1990, 640); |
177 } | 177 } |
178 | 178 |
179 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 179 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
180 canvas->translate(SkIntToScalar(10), SkIntToScalar(20)); | 180 canvas->translate(SkIntToScalar(10), SkIntToScalar(20)); |
181 | 181 |
182 const struct { | 182 const struct { |
183 SkXfermode::Mode fMode; | 183 SkXfermode::Mode fMode; |
184 const char* fLabel; | 184 const char* fLabel; |
185 int fSourceTypeMask; // The source types to use this | 185 int fSourceTypeMask; // The source types to use this |
186 // mode with. See draw_mode for | 186 // mode with. See draw_mode for |
187 // an explanation of each type. | 187 // an explanation of each type. |
188 // PDF has to play some tricks | 188 // PDF has to play some tricks |
189 // to support the base modes, | 189 // to support the base modes, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 private: | 291 private: |
292 typedef GM INHERITED; | 292 typedef GM INHERITED; |
293 }; | 293 }; |
294 | 294 |
295 ////////////////////////////////////////////////////////////////////////////// | 295 ////////////////////////////////////////////////////////////////////////////// |
296 | 296 |
297 static GM* MyFactory(void*) { return new XfermodesGM; } | 297 static GM* MyFactory(void*) { return new XfermodesGM; } |
298 static GMRegistry reg(MyFactory); | 298 static GMRegistry reg(MyFactory); |
299 | 299 |
300 } | 300 } |
OLD | NEW |