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 "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 bmp.allocN32Pixels(2, 2); | 30 bmp.allocN32Pixels(2, 2); |
31 uint32_t* pixels = reinterpret_cast<uint32_t*>(bmp.getPixels()); | 31 uint32_t* pixels = reinterpret_cast<uint32_t*>(bmp.getPixels()); |
32 pixels[0] = SkPreMultiplyColor(SK_ColorRED); | 32 pixels[0] = SkPreMultiplyColor(SK_ColorRED); |
33 pixels[1] = SkPreMultiplyColor(SK_ColorGREEN); | 33 pixels[1] = SkPreMultiplyColor(SK_ColorGREEN); |
34 pixels[2] = SkPreMultiplyColor(SK_ColorBLACK); | 34 pixels[2] = SkPreMultiplyColor(SK_ColorBLACK); |
35 pixels[3] = SkPreMultiplyColor(SK_ColorBLUE); | 35 pixels[3] = SkPreMultiplyColor(SK_ColorBLUE); |
36 | 36 |
37 return bmp; | 37 return bmp; |
38 } | 38 } |
39 | 39 |
40 static const SkScalar RECT_SIZE = 64; | 40 constexpr SkScalar RECT_SIZE = 64; |
41 static const SkScalar SLIDE_SIZE = 300; | 41 constexpr SkScalar SLIDE_SIZE = 300; |
42 | 42 |
43 class ClippedBitmapShadersGM : public GM { | 43 class ClippedBitmapShadersGM : public GM { |
44 public: | 44 public: |
45 ClippedBitmapShadersGM(SkShader::TileMode mode, bool hq=false) | 45 ClippedBitmapShadersGM(SkShader::TileMode mode, bool hq=false) |
46 : fMode(mode), fHQ(hq) { | 46 : fMode(mode), fHQ(hq) { |
47 } | 47 } |
48 | 48 |
49 protected: | 49 protected: |
50 SkShader::TileMode fMode; | 50 SkShader::TileMode fMode; |
51 bool fHQ; | 51 bool fHQ; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kRepeat_TileMode); ) | 116 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kRepeat_TileMode); ) |
117 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kMirror_TileMode); ) | 117 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kMirror_TileMode); ) |
118 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kClamp_TileMode); ) | 118 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kClamp_TileMode); ) |
119 | 119 |
120 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kRepeat_TileMode, true); ) | 120 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kRepeat_TileMode, true); ) |
121 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kMirror_TileMode, true); ) | 121 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kMirror_TileMode, true); ) |
122 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kClamp_TileMode, true); ) | 122 DEF_GM( return new ClippedBitmapShadersGM(SkShader::kClamp_TileMode, true); ) |
123 | 123 |
124 | 124 |
125 } | 125 } |
OLD | NEW |