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

Side by Side Diff: gm/bitmapfilters.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 | « gm/bitmapcopy.cpp ('k') | gm/bitmapscroll.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 "sk_tool_utils.h" 9 #include "sk_tool_utils.h"
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 49
50 static SkScalar draw_row(SkCanvas* canvas, const SkBitmap& bm) { 50 static SkScalar draw_row(SkCanvas* canvas, const SkBitmap& bm) {
51 SkAutoCanvasRestore acr(canvas, true); 51 SkAutoCanvasRestore acr(canvas, true);
52 52
53 SkPaint paint; 53 SkPaint paint;
54 SkScalar x = 0; 54 SkScalar x = 0;
55 const int scale = 32; 55 const int scale = 32;
56 56
57 paint.setAntiAlias(true); 57 paint.setAntiAlias(true);
58 sk_tool_utils::set_portable_typeface(&paint);
58 const char* name = sk_tool_utils::colortype_name(bm.colorType()); 59 const char* name = sk_tool_utils::colortype_name(bm.colorType());
59 canvas->drawText(name, strlen(name), x, SkIntToScalar(bm.height())*scale*5/8 , 60 canvas->drawText(name, strlen(name), x, SkIntToScalar(bm.height())*scale*5/8 ,
60 paint); 61 paint);
61 canvas->translate(SkIntToScalar(48), 0); 62 canvas->translate(SkIntToScalar(48), 0);
62 63
63 canvas->scale(SkIntToScalar(scale), SkIntToScalar(scale)); 64 canvas->scale(SkIntToScalar(scale), SkIntToScalar(scale));
64 65
65 x += draw_set(canvas, bm, 0, &paint); 66 x += draw_set(canvas, bm, 0, &paint);
66 paint.reset(); 67 paint.reset();
67 paint.setAlpha(0x80); 68 paint.setAlpha(0x80);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 private: 117 private:
117 typedef GM INHERITED; 118 typedef GM INHERITED;
118 }; 119 };
119 120
120 ////////////////////////////////////////////////////////////////////////////// 121 //////////////////////////////////////////////////////////////////////////////
121 122
122 static GM* MyFactory(void*) { return new FilterGM; } 123 static GM* MyFactory(void*) { return new FilterGM; }
123 static GMRegistry reg(MyFactory); 124 static GMRegistry reg(MyFactory);
124 125
125 } 126 }
OLDNEW
« no previous file with comments | « gm/bitmapcopy.cpp ('k') | gm/bitmapscroll.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698