| 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 "SkArithmeticMode.h" | 9 #include "SkArithmeticMode.h" |
| 10 #include "SkOffsetImageFilter.h" | 10 #include "SkOffsetImageFilter.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 XfermodeImageFilterGM(){ | 22 XfermodeImageFilterGM(){ |
| 23 this->setBGColor(0xFF000000); | 23 this->setBGColor(0xFF000000); |
| 24 } | 24 } |
| 25 | 25 |
| 26 protected: | 26 protected: |
| 27 virtual SkString onShortName() SK_OVERRIDE { | 27 virtual SkString onShortName() SK_OVERRIDE { |
| 28 return SkString("xfermodeimagefilter"); | 28 return SkString("xfermodeimagefilter"); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void make_bitmap() { | 31 void make_bitmap() { |
| 32 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 80, 80); | 32 fBitmap.allocN32Pixels(80, 80); |
| 33 fBitmap.allocPixels(); | |
| 34 SkBitmapDevice device(fBitmap); | 33 SkBitmapDevice device(fBitmap); |
| 35 SkCanvas canvas(&device); | 34 SkCanvas canvas(&device); |
| 36 canvas.clear(0x00000000); | 35 canvas.clear(0x00000000); |
| 37 SkPaint paint; | 36 SkPaint paint; |
| 38 paint.setAntiAlias(true); | 37 paint.setAntiAlias(true); |
| 39 paint.setColor(0xD000D000); | 38 paint.setColor(0xD000D000); |
| 40 paint.setTextSize(SkIntToScalar(96)); | 39 paint.setTextSize(SkIntToScalar(96)); |
| 41 const char* str = "e"; | 40 const char* str = "e"; |
| 42 canvas.drawText(str, strlen(str), SkIntToScalar(15), SkIntToScalar(65),
paint); | 41 canvas.drawText(str, strlen(str), SkIntToScalar(15), SkIntToScalar(65),
paint); |
| 43 } | 42 } |
| 44 | 43 |
| 45 void make_checkerboard() { | 44 void make_checkerboard() { |
| 46 fCheckerboard.setConfig(SkBitmap::kARGB_8888_Config, 80, 80); | 45 fCheckerboard.allocN32Pixels(80, 80); |
| 47 fCheckerboard.allocPixels(); | |
| 48 SkBitmapDevice device(fCheckerboard); | 46 SkBitmapDevice device(fCheckerboard); |
| 49 SkCanvas canvas(&device); | 47 SkCanvas canvas(&device); |
| 50 canvas.clear(0x00000000); | 48 canvas.clear(0x00000000); |
| 51 SkPaint darkPaint; | 49 SkPaint darkPaint; |
| 52 darkPaint.setColor(0xFF404040); | 50 darkPaint.setColor(0xFF404040); |
| 53 SkPaint lightPaint; | 51 SkPaint lightPaint; |
| 54 lightPaint.setColor(0xFFA0A0A0); | 52 lightPaint.setColor(0xFFA0A0A0); |
| 55 for (int y = 0; y < 80; y += 16) { | 53 for (int y = 0; y < 80; y += 16) { |
| 56 for (int x = 0; x < 80; x += 16) { | 54 for (int x = 0; x < 80; x += 16) { |
| 57 canvas.save(); | 55 canvas.save(); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 private: | 221 private: |
| 224 SkBitmap fBitmap, fCheckerboard; | 222 SkBitmap fBitmap, fCheckerboard; |
| 225 typedef GM INHERITED; | 223 typedef GM INHERITED; |
| 226 }; | 224 }; |
| 227 | 225 |
| 228 ////////////////////////////////////////////////////////////////////////////// | 226 ////////////////////////////////////////////////////////////////////////////// |
| 229 | 227 |
| 230 DEF_GM( return new XfermodeImageFilterGM; ); | 228 DEF_GM( return new XfermodeImageFilterGM; ); |
| 231 | 229 |
| 232 } | 230 } |
| OLD | NEW |