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

Side by Side Diff: gm/textbloblooper.cpp

Issue 1076593002: Start canonicalizing color for all A8 textblobs (Closed) Base URL: https://skia.googlesource.com/skia.git@atcachemasks
Patch Set: nits Created 5 years, 8 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/textblobcolortrans.cpp ('k') | gyp/gmslides.gypi » ('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"
11 #include "SkBlurMask.h" 11 #include "SkBlurMask.h"
12 #include "SkBlurMaskFilter.h" 12 #include "SkBlurMaskFilter.h"
13 #include "SkColorFilter.h" 13 #include "SkColorFilter.h"
14 #include "SkCanvas.h" 14 #include "SkCanvas.h"
15 #include "SkGradientShader.h" 15 #include "SkGradientShader.h"
16 #include "SkGraphics.h" 16 #include "SkGraphics.h"
17 #include "SkLayerDrawLooper.h" 17 #include "SkLayerDrawLooper.h"
18 #include "SkRandom.h" 18 #include "SkRandom.h"
19 #include "SkTextBlob.h" 19 #include "SkTextBlob.h"
20 20
21 namespace skiagm { 21 namespace skiagm {
22 22
23 static const int kWidth = 1250; 23 static const int kWidth = 1250;
24 static const int kHeight = 700; 24 static const int kHeight = 700;
25 25
26 // Unlike the variant in sk_tool_utils, this version positions the glyphs on a d iagonal
26 static void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const SkPaint& origPaint, 27 static void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const SkPaint& origPaint,
27 SkScalar x, SkScalar y) { 28 SkScalar x, SkScalar y) {
28 SkPaint paint(origPaint); 29 SkPaint paint(origPaint);
29 SkTDArray<uint16_t> glyphs; 30 SkTDArray<uint16_t> glyphs;
30 31
31 size_t len = strlen(text); 32 size_t len = strlen(text);
32 glyphs.append(paint.textToGlyphs(text, len, NULL)); 33 glyphs.append(paint.textToGlyphs(text, len, NULL));
33 paint.textToGlyphs(text, len, glyphs.begin()); 34 paint.textToGlyphs(text, len, glyphs.begin());
34 35
35 const SkScalar advanceX = paint.getTextSize() * 0.85f; 36 const SkScalar advanceX = paint.getTextSize() * 0.85f;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 SkAutoTUnref<const SkTextBlob> fBlob; 249 SkAutoTUnref<const SkTextBlob> fBlob;
249 SkTArray<SkAutoTUnref<SkLayerDrawLooper>, true> fLoopers; 250 SkTArray<SkAutoTUnref<SkLayerDrawLooper>, true> fLoopers;
250 251
251 typedef GM INHERITED; 252 typedef GM INHERITED;
252 }; 253 };
253 254
254 ////////////////////////////////////////////////////////////////////////////// 255 //////////////////////////////////////////////////////////////////////////////
255 256
256 DEF_GM( return SkNEW(TextBlobLooperGM); ) 257 DEF_GM( return SkNEW(TextBlobLooperGM); )
257 } 258 }
OLDNEW
« no previous file with comments | « gm/textblobcolortrans.cpp ('k') | gyp/gmslides.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698