OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 | 8 |
9 #include "gm.h" | 9 #include "gm.h" |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 virtual ~ShaderGM() { | 49 virtual ~ShaderGM() { |
50 SkSafeUnref(fShader); | 50 SkSafeUnref(fShader); |
51 } | 51 } |
52 | 52 |
53 protected: | 53 protected: |
54 virtual SkString onShortName() SK_OVERRIDE { | 54 virtual SkString onShortName() SK_OVERRIDE { |
55 return SkString("composeshader"); | 55 return SkString("composeshader"); |
56 } | 56 } |
57 | 57 |
58 virtual SkISize onISize() SK_OVERRIDE { | 58 virtual SkISize onISize() SK_OVERRIDE { |
59 return make_isize(640, 480); | 59 return make_isize(120, 120); |
60 } | 60 } |
61 | 61 |
62 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 62 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
63 | 63 |
64 SkPaint paint; | 64 SkPaint paint; |
65 | 65 |
66 paint.setColor(SK_ColorGREEN); | 66 paint.setColor(SK_ColorGREEN); |
67 canvas->drawRectCoords(0, 0, SkIntToScalar(100), SkIntToScalar(100), pai
nt); | 67 canvas->drawRectCoords(0, 0, SkIntToScalar(100), SkIntToScalar(100), pai
nt); |
68 paint.setShader(fShader); | 68 paint.setShader(fShader); |
69 canvas->drawRectCoords(0, 0, SkIntToScalar(100), SkIntToScalar(100), pai
nt); | 69 canvas->drawRectCoords(0, 0, SkIntToScalar(100), SkIntToScalar(100), pai
nt); |
70 } | 70 } |
71 | 71 |
72 private: | 72 private: |
73 SkShader* fShader; | 73 SkShader* fShader; |
74 typedef GM INHERITED ; | 74 typedef GM INHERITED ; |
75 }; | 75 }; |
76 | 76 |
77 ////////////////////////////////////////////////////////////////////////////// | 77 ////////////////////////////////////////////////////////////////////////////// |
78 | 78 |
79 static GM* MyFactory(void*) { return new ShaderGM; } | 79 static GM* MyFactory(void*) { return new ShaderGM; } |
80 static GMRegistry reg(MyFactory); | 80 static GMRegistry reg(MyFactory); |
81 | 81 |
82 } // namespace | 82 } // namespace |
OLD | NEW |