Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: gm/textbloblooper.cpp

Issue 1263553002: make pixelsnap textblob* etc gm portable (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add more 565 compatibility Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gm/surface.cpp ('k') | gm/textblobshader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 9
10 #include "Sk2DPathEffect.h" 10 #include "Sk2DPathEffect.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 void onOnceBeforeDraw() override { 141 void onOnceBeforeDraw() override {
142 SkTextBlobBuilder builder; 142 SkTextBlobBuilder builder;
143 143
144 // LCD 144 // LCD
145 SkPaint paint; 145 SkPaint paint;
146 paint.setTextSize(32); 146 paint.setTextSize(32);
147 const char* text = "The quick brown fox jumps over the lazy dog"; 147 const char* text = "The quick brown fox jumps over the lazy dog";
148 paint.setSubpixelText(true); 148 paint.setSubpixelText(true);
149 paint.setLCDRenderText(true); 149 paint.setLCDRenderText(true);
150 paint.setAntiAlias(true); 150 paint.setAntiAlias(true);
151 sk_tool_utils::set_portable_typeface(&paint);
151 add_to_text_blob(&builder, text, paint, 0, 0); 152 add_to_text_blob(&builder, text, paint, 0, 0);
152 fBlob.reset(builder.build()); 153 fBlob.reset(builder.build());
153 154
154 // create a looper which sandwhiches an effect in two normal draws 155 // create a looper which sandwhiches an effect in two normal draws
155 LooperSettings looperSandwhich[] = { 156 LooperSettings looperSandwhich[] = {
156 { SkXfermode::kSrc_Mode, SK_ColorMAGENTA, SkPaint::kFill_Style, 0, 0, 0, false }, 157 { SkXfermode::kSrc_Mode, SK_ColorMAGENTA, SkPaint::kFill_Style, 0, 0, 0, false },
157 { SkXfermode::kSrcOver_Mode, 0x88000000, SkPaint::kFill_Style, 0, 10. f, 0, true }, 158 { SkXfermode::kSrcOver_Mode, 0x88000000, SkPaint::kFill_Style, 0, 10. f, 0, true },
158 { SkXfermode::kSrcOver_Mode, 0x50FF00FF, SkPaint::kFill_Style, 0, 20. f, 0, false }, 159 { SkXfermode::kSrcOver_Mode, 0x50FF00FF, SkPaint::kFill_Style, 0, 20. f, 0, false },
159 }; 160 };
160 161
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 SkString onShortName() override { 219 SkString onShortName() override {
219 return SkString("textbloblooper"); 220 return SkString("textbloblooper");
220 } 221 }
221 222
222 SkISize onISize() override { 223 SkISize onISize() override {
223 return SkISize::Make(kWidth, kHeight); 224 return SkISize::Make(kWidth, kHeight);
224 } 225 }
225 226
226 void onDraw(SkCanvas* canvas) override { 227 void onDraw(SkCanvas* canvas) override {
227 228
228 canvas->drawColor(SK_ColorGRAY); 229 canvas->drawColor(sk_tool_utils::color_to_565(SK_ColorGRAY));
229 230
230 SkPaint paint; 231 SkPaint paint;
231 canvas->translate(10, 40); 232 canvas->translate(10, 40);
232 233
233 paint.setTextSize(40); 234 paint.setTextSize(40);
234 235
235 SkRect bounds = fBlob->bounds(); 236 SkRect bounds = fBlob->bounds();
236 237
237 int y = 0; 238 int y = 0;
238 for (int looper = 0; looper < fLoopers.count(); looper++) { 239 for (int looper = 0; looper < fLoopers.count(); looper++) {
(...skipping 10 matching lines...) Expand all
249 SkAutoTUnref<const SkTextBlob> fBlob; 250 SkAutoTUnref<const SkTextBlob> fBlob;
250 SkTArray<SkAutoTUnref<SkLayerDrawLooper>, true> fLoopers; 251 SkTArray<SkAutoTUnref<SkLayerDrawLooper>, true> fLoopers;
251 252
252 typedef GM INHERITED; 253 typedef GM INHERITED;
253 }; 254 };
254 255
255 ////////////////////////////////////////////////////////////////////////////// 256 //////////////////////////////////////////////////////////////////////////////
256 257
257 DEF_GM( return SkNEW(TextBlobLooperGM); ) 258 DEF_GM( return SkNEW(TextBlobLooperGM); )
258 } 259 }
OLDNEW
« no previous file with comments | « gm/surface.cpp ('k') | gm/textblobshader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698