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

Side by Side Diff: gm/arithmode.cpp

Issue 348323003: use platform-independent font for gm (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add include tools for skimage Created 6 years, 6 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 | « no previous file | gm/bitmapcopy.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 "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 SkShader::kClamp_TileMode); 50 SkShader::kClamp_TileMode);
51 paint.setShader(s)->unref(); 51 paint.setShader(s)->unref();
52 canvas.drawPaint(paint); 52 canvas.drawPaint(paint);
53 return bm; 53 return bm;
54 } 54 }
55 55
56 static void show_k_text(SkCanvas* canvas, SkScalar x, SkScalar y, const SkScalar k[]) { 56 static void show_k_text(SkCanvas* canvas, SkScalar x, SkScalar y, const SkScalar k[]) {
57 SkPaint paint; 57 SkPaint paint;
58 paint.setTextSize(SkIntToScalar(24)); 58 paint.setTextSize(SkIntToScalar(24));
59 paint.setAntiAlias(true); 59 paint.setAntiAlias(true);
60 sk_tool_utils::set_portable_typeface(&paint);
60 for (int i = 0; i < 4; ++i) { 61 for (int i = 0; i < 4; ++i) {
61 SkString str; 62 SkString str;
62 str.appendScalar(k[i]); 63 str.appendScalar(k[i]);
63 SkScalar width = paint.measureText(str.c_str(), str.size()); 64 SkScalar width = paint.measureText(str.c_str(), str.size());
64 canvas->drawText(str.c_str(), str.size(), x, y + paint.getTextSize(), pa int); 65 canvas->drawText(str.c_str(), str.size(), x, y + paint.getTextSize(), pa int);
65 x += width + SkIntToScalar(10); 66 x += width + SkIntToScalar(10);
66 } 67 }
67 } 68 }
68 69
69 class ArithmodeGM : public skiagm::GM { 70 class ArithmodeGM : public skiagm::GM {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 124 }
124 125
125 private: 126 private:
126 typedef GM INHERITED; 127 typedef GM INHERITED;
127 }; 128 };
128 129
129 /////////////////////////////////////////////////////////////////////////////// 130 ///////////////////////////////////////////////////////////////////////////////
130 131
131 static skiagm::GM* MyFactory(void*) { return new ArithmodeGM; } 132 static skiagm::GM* MyFactory(void*) { return new ArithmodeGM; }
132 static skiagm::GMRegistry reg(MyFactory); 133 static skiagm::GMRegistry reg(MyFactory);
OLDNEW
« no previous file with comments | « no previous file | gm/bitmapcopy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698