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

Side by Side Diff: gm/arithmode.cpp

Issue 1235343004: make arithmode bigtext colortype* degeneratesegments gm portable (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 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/bigtext.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 26 matching lines...) Expand all
37 canvas.drawPaint(paint); 37 canvas.drawPaint(paint);
38 return bm; 38 return bm;
39 } 39 }
40 40
41 static SkBitmap make_dst() { 41 static SkBitmap make_dst() {
42 SkBitmap bm = make_bm(); 42 SkBitmap bm = make_bm();
43 SkCanvas canvas(bm); 43 SkCanvas canvas(bm);
44 SkPaint paint; 44 SkPaint paint;
45 SkPoint pts[] = { {0, SkIntToScalar(HH)}, {SkIntToScalar(WW), 0} }; 45 SkPoint pts[] = { {0, SkIntToScalar(HH)}, {SkIntToScalar(WW), 0} };
46 SkColor colors[] = { 46 SkColor colors[] = {
47 SK_ColorBLUE, SK_ColorYELLOW, SK_ColorBLACK, SK_ColorGREEN, SK_ColorGRAY 47 SK_ColorBLUE, SK_ColorYELLOW, SK_ColorBLACK, SK_ColorGREEN,
48 sk_tool_utils::color_to_565(SK_ColorGRAY)
48 }; 49 };
49 SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_COU NT(colors), 50 SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_COU NT(colors),
50 SkShader::kClamp_TileMode); 51 SkShader::kClamp_TileMode);
51 paint.setShader(s)->unref(); 52 paint.setShader(s)->unref();
52 canvas.drawPaint(paint); 53 canvas.drawPaint(paint);
53 return bm; 54 return bm;
54 } 55 }
55 56
56 static void show_k_text(SkCanvas* canvas, SkScalar x, SkScalar y, const SkScalar k[]) { 57 static void show_k_text(SkCanvas* canvas, SkScalar x, SkScalar y, const SkScalar k[]) {
57 SkPaint paint; 58 SkPaint paint;
58 paint.setTextSize(SkIntToScalar(24)); 59 paint.setTextSize(SkIntToScalar(24));
59 paint.setAntiAlias(true); 60 paint.setAntiAlias(true);
60 sk_tool_utils::set_portable_typeface(&paint); 61 sk_tool_utils::set_portable_typeface_always(&paint);
61 for (int i = 0; i < 4; ++i) { 62 for (int i = 0; i < 4; ++i) {
62 SkString str; 63 SkString str;
63 str.appendScalar(k[i]); 64 str.appendScalar(k[i]);
64 SkScalar width = paint.measureText(str.c_str(), str.size()); 65 SkScalar width = paint.measureText(str.c_str(), str.size());
65 canvas->drawText(str.c_str(), str.size(), x, y + paint.getTextSize(), pa int); 66 canvas->drawText(str.c_str(), str.size(), x, y + paint.getTextSize(), pa int);
66 x += width + SkIntToScalar(10); 67 x += width + SkIntToScalar(10);
67 } 68 }
68 } 69 }
69 70
70 class ArithmodeGM : public skiagm::GM { 71 class ArithmodeGM : public skiagm::GM {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 125 }
125 126
126 private: 127 private:
127 typedef GM INHERITED; 128 typedef GM INHERITED;
128 }; 129 };
129 130
130 /////////////////////////////////////////////////////////////////////////////// 131 ///////////////////////////////////////////////////////////////////////////////
131 132
132 static skiagm::GM* MyFactory(void*) { return new ArithmodeGM; } 133 static skiagm::GM* MyFactory(void*) { return new ArithmodeGM; }
133 static skiagm::GMRegistry reg(MyFactory); 134 static skiagm::GMRegistry reg(MyFactory);
OLDNEW
« no previous file with comments | « no previous file | gm/bigtext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698