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

Side by Side Diff: gm/imagefilterscropped.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/imagefiltersbase.cpp ('k') | gm/imagefiltersgraph.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 "SkColorFilter.h" 10 #include "SkColorFilter.h"
(...skipping 27 matching lines...) Expand all
38 canvas->clipRect(r); 38 canvas->clipRect(r);
39 canvas->drawCircle(r.centerX(), r.centerY(), r.width()*2/5, paint); 39 canvas->drawCircle(r.centerX(), r.centerY(), r.width()*2/5, paint);
40 canvas->restore(); 40 canvas->restore();
41 } 41 }
42 42
43 static void draw_text(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { 43 static void draw_text(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {
44 SkPaint paint; 44 SkPaint paint;
45 paint.setImageFilter(imf); 45 paint.setImageFilter(imf);
46 paint.setColor(SK_ColorGREEN); 46 paint.setColor(SK_ColorGREEN);
47 paint.setAntiAlias(true); 47 paint.setAntiAlias(true);
48 sk_tool_utils::set_portable_typeface(&paint);
48 paint.setTextSize(r.height()/2); 49 paint.setTextSize(r.height()/2);
49 paint.setTextAlign(SkPaint::kCenter_Align); 50 paint.setTextAlign(SkPaint::kCenter_Align);
50 canvas->save(); 51 canvas->save();
51 canvas->clipRect(r); 52 canvas->clipRect(r);
52 canvas->drawText("Text", 4, r.centerX(), r.centerY(), paint); 53 canvas->drawText("Text", 4, r.centerX(), r.centerY(), paint);
53 canvas->restore(); 54 canvas->restore();
54 } 55 }
55 56
56 static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { 57 static void draw_bitmap(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {
57 SkPaint paint; 58 SkPaint paint;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } 173 }
173 174
174 private: 175 private:
175 typedef GM INHERITED; 176 typedef GM INHERITED;
176 }; 177 };
177 178
178 /////////////////////////////////////////////////////////////////////////////// 179 ///////////////////////////////////////////////////////////////////////////////
179 180
180 static skiagm::GM* MyFactory(void*) { return new ImageFiltersCroppedGM; } 181 static skiagm::GM* MyFactory(void*) { return new ImageFiltersCroppedGM; }
181 static skiagm::GMRegistry reg(MyFactory); 182 static skiagm::GMRegistry reg(MyFactory);
OLDNEW
« no previous file with comments | « gm/imagefiltersbase.cpp ('k') | gm/imagefiltersgraph.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698