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

Side by Side Diff: gm/imageblur.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/image.cpp ('k') | gm/imageblurtiled.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 "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 26 matching lines...) Expand all
37 37
38 virtual void onDraw(SkCanvas* canvas) { 38 virtual void onDraw(SkCanvas* canvas) {
39 SkPaint paint; 39 SkPaint paint;
40 paint.setImageFilter(SkBlurImageFilter::Create(fSigmaX, fSigmaY))->unref (); 40 paint.setImageFilter(SkBlurImageFilter::Create(fSigmaX, fSigmaY))->unref ();
41 canvas->saveLayer(NULL, &paint); 41 canvas->saveLayer(NULL, &paint);
42 const char* str = "The quick brown fox jumped over the lazy dog."; 42 const char* str = "The quick brown fox jumped over the lazy dog.";
43 43
44 SkRandom rand; 44 SkRandom rand;
45 SkPaint textPaint; 45 SkPaint textPaint;
46 textPaint.setAntiAlias(true); 46 textPaint.setAntiAlias(true);
47 sk_tool_utils::set_portable_typeface(&textPaint);
47 for (int i = 0; i < 25; ++i) { 48 for (int i = 0; i < 25; ++i) {
48 int x = rand.nextULessThan(WIDTH); 49 int x = rand.nextULessThan(WIDTH);
49 int y = rand.nextULessThan(HEIGHT); 50 int y = rand.nextULessThan(HEIGHT);
50 textPaint.setColor(rand.nextBits(24) | 0xFF000000); 51 textPaint.setColor(rand.nextBits(24) | 0xFF000000);
51 textPaint.setTextSize(rand.nextRangeScalar(0, 300)); 52 textPaint.setTextSize(rand.nextRangeScalar(0, 300));
52 canvas->drawText(str, strlen(str), SkIntToScalar(x), 53 canvas->drawText(str, strlen(str), SkIntToScalar(x),
53 SkIntToScalar(y), textPaint); 54 SkIntToScalar(y), textPaint);
54 } 55 }
55 canvas->restore(); 56 canvas->restore();
56 } 57 }
57 58
58 private: 59 private:
59 SkScalar fSigmaX; 60 SkScalar fSigmaX;
60 SkScalar fSigmaY; 61 SkScalar fSigmaY;
61 SkString fName; 62 SkString fName;
62 63
63 typedef GM INHERITED; 64 typedef GM INHERITED;
64 }; 65 };
65 66
66 ////////////////////////////////////////////////////////////////////////////// 67 //////////////////////////////////////////////////////////////////////////////
67 68
68 static GM* MyFactory1(void*) { return new ImageBlurGM(24.0f, 0.0f, ""); } 69 static GM* MyFactory1(void*) { return new ImageBlurGM(24.0f, 0.0f, ""); }
69 static GMRegistry reg1(MyFactory1); 70 static GMRegistry reg1(MyFactory1);
70 71
71 static GM* MyFactory2(void*) { return new ImageBlurGM(80.0f, 80.0f, "_large"); } 72 static GM* MyFactory2(void*) { return new ImageBlurGM(80.0f, 80.0f, "_large"); }
72 static GMRegistry reg2(MyFactory2); 73 static GMRegistry reg2(MyFactory2);
73 74
74 } 75 }
OLDNEW
« no previous file with comments | « gm/image.cpp ('k') | gm/imageblurtiled.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698