OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "gm.h" | 8 #include "gm.h" |
9 | 9 |
10 namespace skiagm { | 10 namespace skiagm { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 } | 103 } |
104 | 104 |
105 void drawLabel(SkCanvas* canvas, const char *text, int startX, int startY, | 105 void drawLabel(SkCanvas* canvas, const char *text, int startX, int startY, |
106 int endX, int endY) { | 106 int endX, int endY) { |
107 SkPaint paint; | 107 SkPaint paint; |
108 sk_tool_utils::set_portable_typeface(&paint); | 108 sk_tool_utils::set_portable_typeface(&paint); |
109 paint.setColor(0xFF000000); | 109 paint.setColor(0xFF000000); |
110 SkPath path; | 110 SkPath path; |
111 path.moveTo(SkIntToScalar(startX), SkIntToScalar(startY)); | 111 path.moveTo(SkIntToScalar(startX), SkIntToScalar(startY)); |
112 path.lineTo(SkIntToScalar(endX), SkIntToScalar(endY)); | 112 path.lineTo(SkIntToScalar(endX), SkIntToScalar(endY)); |
113 canvas->drawTextOnPath(text, strlen(text), path, NULL, paint); | 113 canvas->drawTextOnPath(text, strlen(text), path, NULL, |
| 114 SkCanvas::kStretch_TextOnPathMethod, paint); |
114 } | 115 } |
115 | 116 |
116 /** Stamp out 9 copies of origBitmap, scrolled in each direction (and | 117 /** Stamp out 9 copies of origBitmap, scrolled in each direction (and |
117 * not scrolled at all). | 118 * not scrolled at all). |
118 */ | 119 */ |
119 void draw9(SkCanvas* canvas, int x, int y, SkIRect* subset, | 120 void draw9(SkCanvas* canvas, int x, int y, SkIRect* subset, |
120 int scrollX, int scrollY) { | 121 int scrollX, int scrollY) { |
121 for (int yMult=-1; yMult<=1; yMult++) { | 122 for (int yMult=-1; yMult<=1; yMult++) { |
122 for (int xMult=-1; xMult<=1; xMult++) { | 123 for (int xMult=-1; xMult<=1; xMult++) { |
123 // Figure out the (x,y) to draw this copy at | 124 // Figure out the (x,y) to draw this copy at |
(...skipping 22 matching lines...) Expand all Loading... |
146 static const int quarterHeight = 14; | 147 static const int quarterHeight = 14; |
147 SkBitmap origBitmap; | 148 SkBitmap origBitmap; |
148 }; | 149 }; |
149 | 150 |
150 ////////////////////////////////////////////////////////////////////////////// | 151 ////////////////////////////////////////////////////////////////////////////// |
151 | 152 |
152 static GM* MyFactory(void*) { return new BitmapScrollGM; } | 153 static GM* MyFactory(void*) { return new BitmapScrollGM; } |
153 static GMRegistry reg(MyFactory); | 154 static GMRegistry reg(MyFactory); |
154 | 155 |
155 } | 156 } |
OLD | NEW |