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

Side by Side Diff: gm/bitmapsource.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/bitmapscroll.cpp ('k') | gm/blurs.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 9
10 #include "SkBitmapSource.h" 10 #include "SkBitmapSource.h"
11 11
12 // This GM exercises the SkBitmapSource ImageFilter class. 12 // This GM exercises the SkBitmapSource ImageFilter class.
13 13
14 class BitmapSourceGM : public skiagm::GM { 14 class BitmapSourceGM : public skiagm::GM {
15 public: 15 public:
16 BitmapSourceGM() { 16 BitmapSourceGM() {
17 } 17 }
18 18
19 protected: 19 protected:
20 virtual SkString onShortName() SK_OVERRIDE { 20 virtual SkString onShortName() SK_OVERRIDE {
21 return SkString("bitmapsource"); 21 return SkString("bitmapsource");
22 } 22 }
23 23
24 void makeBitmap() { 24 void makeBitmap() {
25 fBitmap.allocN32Pixels(100, 100); 25 fBitmap.allocN32Pixels(100, 100);
26 SkCanvas canvas(fBitmap); 26 SkCanvas canvas(fBitmap);
27 canvas.clear(0x00000000); 27 canvas.clear(0x00000000);
28 SkPaint paint; 28 SkPaint paint;
29 paint.setAntiAlias(true); 29 paint.setAntiAlias(true);
30 sk_tool_utils::set_portable_typeface(&paint);
30 paint.setColor(0xFFFFFFFF); 31 paint.setColor(0xFFFFFFFF);
31 paint.setTextSize(SkIntToScalar(96)); 32 paint.setTextSize(SkIntToScalar(96));
32 const char* str = "e"; 33 const char* str = "e";
33 canvas.drawText(str, strlen(str), SkIntToScalar(20), SkIntToScalar(70), paint); 34 canvas.drawText(str, strlen(str), SkIntToScalar(20), SkIntToScalar(70), paint);
34 } 35 }
35 36
36 virtual SkISize onISize() SK_OVERRIDE { return SkISize::Make(500, 150); } 37 virtual SkISize onISize() SK_OVERRIDE { return SkISize::Make(500, 150); }
37 38
38 virtual void onOnceBeforeDraw() SK_OVERRIDE { 39 virtual void onOnceBeforeDraw() SK_OVERRIDE {
39 this->makeBitmap(); 40 this->makeBitmap();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 81 }
81 82
82 private: 83 private:
83 SkBitmap fBitmap; 84 SkBitmap fBitmap;
84 typedef GM INHERITED; 85 typedef GM INHERITED;
85 }; 86 };
86 87
87 /////////////////////////////////////////////////////////////////////////////// 88 ///////////////////////////////////////////////////////////////////////////////
88 89
89 DEF_GM( return new BitmapSourceGM; ) 90 DEF_GM( return new BitmapSourceGM; )
OLDNEW
« no previous file with comments | « gm/bitmapscroll.cpp ('k') | gm/blurs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698