OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkColorCubeFilter.h" | 9 #include "SkColorCubeFilter.h" |
10 #include "SkBitmapSource.h" | 10 #include "SkBitmapSource.h" |
11 #include "SkData.h" | 11 #include "SkData.h" |
12 #include "SkGradientShader.h" | 12 #include "SkGradientShader.h" |
13 | 13 |
14 namespace skiagm { | 14 namespace skiagm { |
15 | 15 |
16 static SkShader* MakeLinear() { | 16 static SkShader* MakeLinear() { |
17 static const SkPoint pts[2] = { | 17 static const SkPoint pts[2] = { |
18 { 0, 0 }, | 18 { 0, 0 }, |
19 { SkIntToScalar(80), SkIntToScalar(80) } | 19 { SkIntToScalar(80), SkIntToScalar(80) } |
20 }; | 20 }; |
21 static const SkColor colors[] = { SK_ColorYELLOW, SK_ColorBLUE }; | 21 static const SkColor colors[] = { SK_ColorYELLOW, SK_ColorBLUE }; |
22 return SkGradientShader::CreateLinear( | 22 return SkGradientShader::CreateLinear( |
23 pts, colors, NULL, 2, SkShader::kRepeat_TileMode, 0, &SkMatrix::I()); | 23 pts, colors, nullptr, 2, SkShader::kRepeat_TileMode, 0, &SkMatrix::I()); |
24 } | 24 } |
25 | 25 |
26 class ColorCubeGM : public GM { | 26 class ColorCubeGM : public GM { |
27 public: | 27 public: |
28 ColorCubeGM() | 28 ColorCubeGM() |
29 : fInitialized(false) | 29 : fInitialized(false) |
30 , f3DLut4(NULL) | 30 , f3DLut4(nullptr) |
31 , f3DLut8(NULL) | 31 , f3DLut8(nullptr) |
32 , f3DLut16(NULL) | 32 , f3DLut16(nullptr) |
33 , f3DLut32(NULL) | 33 , f3DLut32(nullptr) |
34 , f3DLut64(NULL) | 34 , f3DLut64(nullptr) |
35 { | 35 { |
36 this->setBGColor(0xFF000000); | 36 this->setBGColor(0xFF000000); |
37 } | 37 } |
38 | 38 |
39 ~ColorCubeGM() { | 39 ~ColorCubeGM() { |
40 SkSafeUnref(f3DLut4); | 40 SkSafeUnref(f3DLut4); |
41 SkSafeUnref(f3DLut8); | 41 SkSafeUnref(f3DLut8); |
42 SkSafeUnref(f3DLut16); | 42 SkSafeUnref(f3DLut16); |
43 SkSafeUnref(f3DLut32); | 43 SkSafeUnref(f3DLut32); |
44 SkSafeUnref(f3DLut64); | 44 SkSafeUnref(f3DLut64); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 SkData* f3DLut32; | 133 SkData* f3DLut32; |
134 SkData* f3DLut64; | 134 SkData* f3DLut64; |
135 }; | 135 }; |
136 | 136 |
137 ////////////////////////////////////////////////////////////////////////////// | 137 ////////////////////////////////////////////////////////////////////////////// |
138 | 138 |
139 static GM* MyFactory(void*) { return new ColorCubeGM; } | 139 static GM* MyFactory(void*) { return new ColorCubeGM; } |
140 static GMRegistry reg(MyFactory); | 140 static GMRegistry reg(MyFactory); |
141 | 141 |
142 } | 142 } |
OLD | NEW |