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

Side by Side Diff: gm/imageresizetiled.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/imagemagnifier.cpp ('k') | gm/internal_links.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 2014 Google Inc. 2 * Copyright 2014 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 "SkMatrixImageFilter.h" 9 #include "SkMatrixImageFilter.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 SkScalarInvert(RESIZE_FACTOR)); 50 SkScalarInvert(RESIZE_FACTOR));
51 canvas->saveLayer(NULL, &paint); 51 canvas->saveLayer(NULL, &paint);
52 const char* str[] = { 52 const char* str[] = {
53 "The quick", 53 "The quick",
54 "brown fox", 54 "brown fox",
55 "jumped over", 55 "jumped over",
56 "the lazy dog.", 56 "the lazy dog.",
57 }; 57 };
58 SkPaint textPaint; 58 SkPaint textPaint;
59 textPaint.setAntiAlias(true); 59 textPaint.setAntiAlias(true);
60 sk_tool_utils::set_portable_typeface(&textPaint);
60 textPaint.setTextSize(SkIntToScalar(100)); 61 textPaint.setTextSize(SkIntToScalar(100));
61 int posY = 0; 62 int posY = 0;
62 for (unsigned i = 0; i < SK_ARRAY_COUNT(str); i++) { 63 for (unsigned i = 0; i < SK_ARRAY_COUNT(str); i++) {
63 posY += 100; 64 posY += 100;
64 canvas->drawText(str[i], strlen(str[i]), SkIntToScalar(0), 65 canvas->drawText(str[i], strlen(str[i]), SkIntToScalar(0),
65 SkIntToScalar(posY), textPaint); 66 SkIntToScalar(posY), textPaint);
66 } 67 }
67 canvas->restore(); 68 canvas->restore();
68 canvas->restore(); 69 canvas->restore();
69 } 70 }
70 } 71 }
71 } 72 }
72 73
73 private: 74 private:
74 typedef GM INHERITED; 75 typedef GM INHERITED;
75 }; 76 };
76 77
77 ////////////////////////////////////////////////////////////////////////////// 78 //////////////////////////////////////////////////////////////////////////////
78 79
79 DEF_GM(return new ImageResizeTiledGM(); ) 80 DEF_GM(return new ImageResizeTiledGM(); )
80 81
81 } 82 }
OLDNEW
« no previous file with comments | « gm/imagemagnifier.cpp ('k') | gm/internal_links.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698