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

Side by Side Diff: gm/gammatext.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/fontscaler.cpp ('k') | gm/getpostextpath.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 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"
11 #include "SkGradientShader.h" 11 #include "SkGradientShader.h"
12 #include "SkTypeface.h" 12 #include "SkTypeface.h"
13 13
14 static SkShader* make_heatGradient(const SkPoint pts[2]) { 14 static SkShader* make_heatGradient(const SkPoint pts[2]) {
15 #if 0 // UNUSED 15 #if 0 // UNUSED
16 const SkColor colors[] = { 16 const SkColor colors[] = {
17 SK_ColorBLACK, SK_ColorBLUE, SK_ColorCYAN, SK_ColorGREEN, 17 SK_ColorBLACK, SK_ColorBLUE, SK_ColorCYAN, SK_ColorGREEN,
18 SK_ColorYELLOW, SK_ColorRED, SK_ColorWHITE 18 SK_ColorYELLOW, SK_ColorRED, SK_ColorWHITE
19 }; 19 };
20 #endif 20 #endif
21 const SkColor bw[] = { SK_ColorBLACK, SK_ColorWHITE }; 21 const SkColor bw[] = { SK_ColorBLACK, SK_ColorWHITE };
22 22
23 return SkGradientShader::CreateLinear(pts, bw, NULL, 23 return SkGradientShader::CreateLinear(pts, bw, NULL,
24 SK_ARRAY_COUNT(bw), 24 SK_ARRAY_COUNT(bw),
25 SkShader::kClamp_TileMode); 25 SkShader::kClamp_TileMode);
26 } 26 }
27 27
28 static bool setFont(SkPaint* paint, const char name[]) { 28 static bool setFont(SkPaint* paint, const char name[]) {
29 SkTypeface* tf = SkTypeface::CreateFromName(name, SkTypeface::kNormal); 29 SkTypeface* tf = sk_tool_utils::create_portable_typeface(name, SkTypeface::k Normal);
30 if (tf) { 30 if (tf) {
31 paint->setTypeface(tf)->unref(); 31 paint->setTypeface(tf)->unref();
32 return true; 32 return true;
33 } 33 }
34 return false; 34 return false;
35 } 35 }
36 36
37 #ifdef SK_BUILD_FOR_MAC 37 #ifdef SK_BUILD_FOR_MAC
38 #import <ApplicationServices/ApplicationServices.h> 38 #import <ApplicationServices/ApplicationServices.h>
39 #define BITMAP_INFO_RGB (kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Ho st) 39 #define BITMAP_INFO_RGB (kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Ho st)
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 private: 201 private:
202 typedef GM INHERITED; 202 typedef GM INHERITED;
203 }; 203 };
204 204
205 ////////////////////////////////////////////////////////////////////////////// 205 //////////////////////////////////////////////////////////////////////////////
206 206
207 static GM* MyFactory(void*) { return new GammaTextGM; } 207 static GM* MyFactory(void*) { return new GammaTextGM; }
208 static GMRegistry reg(MyFactory); 208 static GMRegistry reg(MyFactory);
209 209
210 } 210 }
OLDNEW
« no previous file with comments | « gm/fontscaler.cpp ('k') | gm/getpostextpath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698