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 | 8 |
9 /* Tests text rendering with LCD and subpixel rendering turned on and off. | 9 /* Tests text rendering with LCD and subpixel rendering turned on and off. |
10 */ | 10 */ |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 SkString onShortName() SK_OVERRIDE { | 155 SkString onShortName() SK_OVERRIDE { |
156 return SkString("lcdtextprops"); | 156 return SkString("lcdtextprops"); |
157 } | 157 } |
158 | 158 |
159 SkISize onISize() SK_OVERRIDE { return SkISize::Make(230, 230); } | 159 SkISize onISize() SK_OVERRIDE { return SkISize::Make(230, 230); } |
160 | 160 |
161 uint32_t onGetFlags() const SK_OVERRIDE { | 161 uint32_t onGetFlags() const SK_OVERRIDE { |
162 return kSkip565_Flag; | 162 return kSkip565_Flag; |
163 } | 163 } |
164 | 164 |
165 virtual void onOnceBeforeDraw() SK_OVERRIDE { | 165 void onOnceBeforeDraw() SK_OVERRIDE { |
166 fInfo = SkImageInfo::MakeN32Premul(100, 100); | 166 fInfo = SkImageInfo::MakeN32Premul(100, 100); |
167 SkPictureRecorder recorder; | 167 SkPictureRecorder recorder; |
168 DrawText(recorder.beginRecording(SkIntToScalar(fInfo.width()), | 168 DrawText(recorder.beginRecording(SkIntToScalar(fInfo.width()), |
169 SkIntToScalar(fInfo.height()))); | 169 SkIntToScalar(fInfo.height()))); |
170 SkAutoTUnref<SkPicture> pic(recorder.endRecording()); | 170 SkAutoTUnref<SkPicture> pic(recorder.endRecording()); |
171 SkAutoTUnref<SkImageFilter> filter(SkPictureImageFilter::Create(pic.get(
))); | 171 SkAutoTUnref<SkImageFilter> filter(SkPictureImageFilter::Create(pic.get(
))); |
172 fFilterPaint.setImageFilter(filter.get()); | 172 fFilterPaint.setImageFilter(filter.get()); |
173 } | 173 } |
174 | 174 |
175 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 175 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
176 const SkPixelGeometry geos[] = { | 176 const SkPixelGeometry geos[] = { |
177 kRGB_H_SkPixelGeometry, | 177 kRGB_H_SkPixelGeometry, |
178 kUnknown_SkPixelGeometry, | 178 kUnknown_SkPixelGeometry, |
179 }; | 179 }; |
180 | 180 |
181 for (size_t i = 0; i < SK_ARRAY_COUNT(geos); ++i) { | 181 for (size_t i = 0; i < SK_ARRAY_COUNT(geos); ++i) { |
182 SkAutoTUnref<SkSurface> surf(MakeSurface(canvas, fInfo, geos[i])); | 182 SkAutoTUnref<SkSurface> surf(MakeSurface(canvas, fInfo, geos[i])); |
183 DrawText(surf->getCanvas()); | 183 DrawText(surf->getCanvas()); |
184 surf->draw(canvas, SkIntToScalar(i * (fInfo.width() + 10)), 0, NULL)
; | 184 surf->draw(canvas, SkIntToScalar(i * (fInfo.width() + 10)), 0, NULL)
; |
185 } | 185 } |
(...skipping 15 matching lines...) Expand all Loading... |
201 | 201 |
202 typedef skiagm::GM INHERITED; | 202 typedef skiagm::GM INHERITED; |
203 }; | 203 }; |
204 | 204 |
205 /////////////////////////////////////////////////////////////////////////////// | 205 /////////////////////////////////////////////////////////////////////////////// |
206 | 206 |
207 DEF_GM( return new LcdTextGM; ) | 207 DEF_GM( return new LcdTextGM; ) |
208 DEF_GM( return new LcdTextSizeGM; ) | 208 DEF_GM( return new LcdTextSizeGM; ) |
209 // Temporarily disabled (dftext interference) | 209 // Temporarily disabled (dftext interference) |
210 // DEF_GM( return new LcdTextProps; ) | 210 // DEF_GM( return new LcdTextProps; ) |
OLD | NEW |