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

Side by Side Diff: gm/lumafilter.cpp

Issue 407183003: add portable and canonical font support for DM (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add atexit; rename to create_... Created 6 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/linepaths.cpp ('k') | gm/matrixconvolution.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 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkGradientShader.h" 10 #include "SkGradientShader.h"
11 #include "SkLumaColorFilter.h" 11 #include "SkLumaColorFilter.h"
12 12
13 static SkScalar kSize = 80; 13 static SkScalar kSize = 80;
14 static SkScalar kInset = 10; 14 static SkScalar kInset = 10;
15 static SkColor kColor1 = SkColorSetARGB(0xff, 0xff, 0xff, 0); 15 static SkColor kColor1 = SkColorSetARGB(0xff, 0xff, 0xff, 0);
16 static SkColor kColor2 = SkColorSetARGB(0xff, 0x80, 0xff, 0); 16 static SkColor kColor2 = SkColorSetARGB(0xff, 0x80, 0xff, 0);
17 17
18 static void draw_label(SkCanvas* canvas, const char* label, 18 static void draw_label(SkCanvas* canvas, const char* label,
19 const SkPoint& offset) { 19 const SkPoint& offset) {
20 SkPaint paint; 20 SkPaint paint;
21 sk_tool_utils::set_portable_typeface(&paint);
21 size_t len = strlen(label); 22 size_t len = strlen(label);
22 23
23 SkScalar width = paint.measureText(label, len); 24 SkScalar width = paint.measureText(label, len);
24 canvas->drawText(label, len, offset.x() - width / 2, offset.y(), 25 canvas->drawText(label, len, offset.x() - width / 2, offset.y(),
25 paint); 26 paint);
26 } 27 }
27 28
28 static void draw_scene(SkCanvas* canvas, SkColorFilter* filter, 29 static void draw_scene(SkCanvas* canvas, SkColorFilter* filter,
29 SkXfermode::Mode mode, SkShader* s1, 30 SkXfermode::Mode mode, SkShader* s1,
30 SkShader* s2) { 31 SkShader* s2) {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 private: 149 private:
149 SkAutoTUnref<SkColorFilter> fFilter; 150 SkAutoTUnref<SkColorFilter> fFilter;
150 SkAutoTUnref<SkShader> fGr1, fGr2; 151 SkAutoTUnref<SkShader> fGr1, fGr2;
151 152
152 typedef skiagm::GM INHERITED; 153 typedef skiagm::GM INHERITED;
153 }; 154 };
154 155
155 ////////////////////////////////////////////////////////////////////////////// 156 //////////////////////////////////////////////////////////////////////////////
156 157
157 DEF_GM( return SkNEW(LumaFilterGM); ) 158 DEF_GM( return SkNEW(LumaFilterGM); )
OLDNEW
« no previous file with comments | « gm/linepaths.cpp ('k') | gm/matrixconvolution.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698