OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 border, with no red. | 64 border, with no red. |
65 */ | 65 */ |
66 | 66 |
67 class AAClipGM : public skiagm::GM { | 67 class AAClipGM : public skiagm::GM { |
68 public: | 68 public: |
69 AAClipGM() { | 69 AAClipGM() { |
70 | 70 |
71 } | 71 } |
72 | 72 |
73 protected: | 73 protected: |
74 virtual SkString onShortName() SK_OVERRIDE { | 74 SkString onShortName() SK_OVERRIDE { |
75 return SkString("aaclip"); | 75 return SkString("aaclip"); |
76 } | 76 } |
77 | 77 |
78 virtual SkISize onISize() SK_OVERRIDE { | 78 SkISize onISize() SK_OVERRIDE { |
79 return SkISize::Make(240, 120); | 79 return SkISize::Make(240, 120); |
80 } | 80 } |
81 | 81 |
82 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 82 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
83 // Initial pixel-boundary-aligned draw | 83 // Initial pixel-boundary-aligned draw |
84 draw_rect_tests(canvas); | 84 draw_rect_tests(canvas); |
85 | 85 |
86 // Repeat 4x with .2, .4, .6, .8 px offsets | 86 // Repeat 4x with .2, .4, .6, .8 px offsets |
87 canvas->translate(SK_Scalar1 / 5, SK_Scalar1 / 5); | 87 canvas->translate(SK_Scalar1 / 5, SK_Scalar1 / 5); |
88 canvas->translate(SkIntToScalar(50), 0); | 88 canvas->translate(SkIntToScalar(50), 0); |
89 draw_rect_tests(canvas); | 89 draw_rect_tests(canvas); |
90 | 90 |
91 canvas->translate(SK_Scalar1 / 5, SK_Scalar1 / 5); | 91 canvas->translate(SK_Scalar1 / 5, SK_Scalar1 / 5); |
92 canvas->translate(SkIntToScalar(50), 0); | 92 canvas->translate(SkIntToScalar(50), 0); |
93 draw_rect_tests(canvas); | 93 draw_rect_tests(canvas); |
94 | 94 |
95 canvas->translate(SK_Scalar1 / 5, SK_Scalar1 / 5); | 95 canvas->translate(SK_Scalar1 / 5, SK_Scalar1 / 5); |
96 canvas->translate(SkIntToScalar(50), 0); | 96 canvas->translate(SkIntToScalar(50), 0); |
97 draw_rect_tests(canvas); | 97 draw_rect_tests(canvas); |
98 | 98 |
99 canvas->translate(SK_Scalar1 / 5, SK_Scalar1 / 5); | 99 canvas->translate(SK_Scalar1 / 5, SK_Scalar1 / 5); |
100 canvas->translate(SkIntToScalar(50), 0); | 100 canvas->translate(SkIntToScalar(50), 0); |
101 draw_rect_tests(canvas); | 101 draw_rect_tests(canvas); |
102 } | 102 } |
103 | 103 |
104 virtual uint32_t onGetFlags() const SK_OVERRIDE { return kSkipPipe_Flag; } | 104 uint32_t onGetFlags() const SK_OVERRIDE { return kSkipPipe_Flag; } |
105 | 105 |
106 private: | 106 private: |
107 typedef skiagm::GM INHERITED; | 107 typedef skiagm::GM INHERITED; |
108 }; | 108 }; |
109 | 109 |
110 DEF_GM( return SkNEW(AAClipGM); ) | 110 DEF_GM( return SkNEW(AAClipGM); ) |
111 | 111 |
112 ///////////////////////////////////////////////////////////////////////// | 112 ///////////////////////////////////////////////////////////////////////// |
113 | 113 |
114 #ifdef SK_BUILD_FOR_MAC | 114 #ifdef SK_BUILD_FOR_MAC |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 CGImageRelease(image); | 149 CGImageRelease(image); |
150 | 150 |
151 canvas->drawBitmap(bm2, 10, 120); | 151 canvas->drawBitmap(bm2, 10, 120); |
152 } | 152 } |
153 | 153 |
154 class CGImageGM : public skiagm::GM { | 154 class CGImageGM : public skiagm::GM { |
155 public: | 155 public: |
156 CGImageGM() {} | 156 CGImageGM() {} |
157 | 157 |
158 protected: | 158 protected: |
159 virtual SkString onShortName() SK_OVERRIDE { | 159 SkString onShortName() SK_OVERRIDE { |
160 return SkString("cgimage"); | 160 return SkString("cgimage"); |
161 } | 161 } |
162 | 162 |
163 virtual SkISize onISize() SK_OVERRIDE { | 163 SkISize onISize() SK_OVERRIDE { |
164 return SkISize::Make(800, 250); | 164 return SkISize::Make(800, 250); |
165 } | 165 } |
166 | 166 |
167 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 167 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
168 const struct { | 168 const struct { |
169 SkColorType fCT; | 169 SkColorType fCT; |
170 SkAlphaType fAT; | 170 SkAlphaType fAT; |
171 } rec[] = { | 171 } rec[] = { |
172 { kRGB_565_SkColorType, kOpaque_SkAlphaType }, | 172 { kRGB_565_SkColorType, kOpaque_SkAlphaType }, |
173 | 173 |
174 { kRGBA_8888_SkColorType, kPremul_SkAlphaType }, | 174 { kRGBA_8888_SkColorType, kPremul_SkAlphaType }, |
175 { kRGBA_8888_SkColorType, kUnpremul_SkAlphaType }, | 175 { kRGBA_8888_SkColorType, kUnpremul_SkAlphaType }, |
176 { kRGBA_8888_SkColorType, kOpaque_SkAlphaType }, | 176 { kRGBA_8888_SkColorType, kOpaque_SkAlphaType }, |
177 | 177 |
178 { kBGRA_8888_SkColorType, kPremul_SkAlphaType }, | 178 { kBGRA_8888_SkColorType, kPremul_SkAlphaType }, |
179 { kBGRA_8888_SkColorType, kUnpremul_SkAlphaType }, | 179 { kBGRA_8888_SkColorType, kUnpremul_SkAlphaType }, |
180 { kBGRA_8888_SkColorType, kOpaque_SkAlphaType }, | 180 { kBGRA_8888_SkColorType, kOpaque_SkAlphaType }, |
181 }; | 181 }; |
182 | 182 |
183 for (size_t i = 0; i < SK_ARRAY_COUNT(rec); ++i) { | 183 for (size_t i = 0; i < SK_ARRAY_COUNT(rec); ++i) { |
184 SkImageInfo info = SkImageInfo::Make(100, 100, rec[i].fCT, rec[i].fA
T); | 184 SkImageInfo info = SkImageInfo::Make(100, 100, rec[i].fCT, rec[i].fA
T); |
185 test_image(canvas, info); | 185 test_image(canvas, info); |
186 canvas->translate(info.width() + 10, 0); | 186 canvas->translate(info.width() + 10, 0); |
187 } | 187 } |
188 } | 188 } |
189 | 189 |
190 virtual uint32_t onGetFlags() const SK_OVERRIDE { return kSkipPipe_Flag; } | 190 uint32_t onGetFlags() const SK_OVERRIDE { return kSkipPipe_Flag; } |
191 | 191 |
192 private: | 192 private: |
193 typedef skiagm::GM INHERITED; | 193 typedef skiagm::GM INHERITED; |
194 }; | 194 }; |
195 | 195 |
196 #if 0 // Disabled pending fix from reed@ | 196 #if 0 // Disabled pending fix from reed@ |
197 DEF_GM( return SkNEW(CGImageGM); ) | 197 DEF_GM( return SkNEW(CGImageGM); ) |
198 #endif | 198 #endif |
199 #endif | 199 #endif |
OLD | NEW |