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

Side by Side Diff: gm/dftext.cpp

Issue 637953002: fix android framework build errors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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 | no next file » | 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 #include "gm.h" 7 #include "gm.h"
8 #include "SkSurface.h" 8 #include "SkSurface.h"
9 #include "SkTypeface.h" 9 #include "SkTypeface.h"
10 10
(...skipping 23 matching lines...) Expand all
34 34
35 static void rotate_about(SkCanvas* canvas, 35 static void rotate_about(SkCanvas* canvas,
36 SkScalar degrees, 36 SkScalar degrees,
37 SkScalar px, SkScalar py) { 37 SkScalar px, SkScalar py) {
38 canvas->translate(px, py); 38 canvas->translate(px, py);
39 canvas->rotate(degrees); 39 canvas->rotate(degrees);
40 canvas->translate(-px, -py); 40 canvas->translate(-px, -py);
41 } 41 }
42 42
43 virtual void onDraw(SkCanvas* inputCanvas) { 43 virtual void onDraw(SkCanvas* inputCanvas) {
44 #if SK_BUILD_FOR_ANDROID 44 #ifdef SK_BUILD_FOR_ANDROID
45 SkScalar textSizes[] = { 9.0f, 9.0f*2.0f, 9.0f*5.0f, 9.0f*2.0f*5.0f }; 45 SkScalar textSizes[] = { 9.0f, 9.0f*2.0f, 9.0f*5.0f, 9.0f*2.0f*5.0f };
46 #else 46 #else
47 SkScalar textSizes[] = { 11.0f, 11.0f*2.0f, 11.0f*5.0f, 11.0f*2.0f*5.0f }; 47 SkScalar textSizes[] = { 11.0f, 11.0f*2.0f, 11.0f*5.0f, 11.0f*2.0f*5.0f };
48 #endif 48 #endif
49 SkScalar scales[] = { 2.0f*5.0f, 5.0f, 2.0f, 1.0f }; 49 SkScalar scales[] = { 2.0f*5.0f, 5.0f, 2.0f, 1.0f };
50 50
51 // set up offscreen rendering with distance field text 51 // set up offscreen rendering with distance field text
52 #if SK_SUPPORT_GPU 52 #if SK_SUPPORT_GPU
53 GrContext* ctx = inputCanvas->getGrContext(); 53 GrContext* ctx = inputCanvas->getGrContext();
54 SkImageInfo info = SkImageInfo::MakeN32Premul(onISize()); 54 SkImageInfo info = SkImageInfo::MakeN32Premul(onISize());
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 0xFFFF0000, 0xFF00FF00, 0xFF0000FF, 148 0xFFFF0000, 0xFF00FF00, 0xFF0000FF,
149 0xFF000000, 149 0xFF000000,
150 }; 150 };
151 151
152 paint.setColor(0xFFF1F1F1); 152 paint.setColor(0xFFF1F1F1);
153 SkRect r = SkRect::MakeLTRB(670, 250, 820, 460); 153 SkRect r = SkRect::MakeLTRB(670, 250, 820, 460);
154 canvas->drawRect(r, paint); 154 canvas->drawRect(r, paint);
155 155
156 x = SkIntToScalar(680); 156 x = SkIntToScalar(680);
157 y = SkIntToScalar(270); 157 y = SkIntToScalar(270);
158 #if SK_BUILD_FOR_ANDROID 158 #ifdef SK_BUILD_FOR_ANDROID
159 paint.setTextSize(SkIntToScalar(19)); 159 paint.setTextSize(SkIntToScalar(19));
160 #else 160 #else
161 paint.setTextSize(SkIntToScalar(22)); 161 paint.setTextSize(SkIntToScalar(22));
162 #endif 162 #endif
163 for (size_t i = 0; i < SK_ARRAY_COUNT(fg); ++i) { 163 for (size_t i = 0; i < SK_ARRAY_COUNT(fg); ++i) {
164 paint.setColor(fg[i]); 164 paint.setColor(fg[i]);
165 165
166 canvas->drawText(text, textLen, x, y, paint); 166 canvas->drawText(text, textLen, x, y, paint);
167 y += paint.getFontMetrics(NULL); 167 y += paint.getFontMetrics(NULL);
168 } 168 }
169 169
170 paint.setColor(0xFF1F1F1F); 170 paint.setColor(0xFF1F1F1F);
171 r = SkRect::MakeLTRB(820, 250, 970, 460); 171 r = SkRect::MakeLTRB(820, 250, 970, 460);
172 canvas->drawRect(r, paint); 172 canvas->drawRect(r, paint);
173 173
174 x = SkIntToScalar(830); 174 x = SkIntToScalar(830);
175 y = SkIntToScalar(270); 175 y = SkIntToScalar(270);
176 #if SK_BUILD_FOR_ANDROID 176 #ifdef SK_BUILD_FOR_ANDROID
177 paint.setTextSize(SkIntToScalar(19)); 177 paint.setTextSize(SkIntToScalar(19));
178 #else 178 #else
179 paint.setTextSize(SkIntToScalar(22)); 179 paint.setTextSize(SkIntToScalar(22));
180 #endif 180 #endif
181 for (size_t i = 0; i < SK_ARRAY_COUNT(fg); ++i) { 181 for (size_t i = 0; i < SK_ARRAY_COUNT(fg); ++i) {
182 paint.setColor(fg[i]); 182 paint.setColor(fg[i]);
183 183
184 canvas->drawText(text, textLen, x, y, paint); 184 canvas->drawText(text, textLen, x, y, paint);
185 y += paint.getFontMetrics(NULL); 185 y += paint.getFontMetrics(NULL);
186 } 186 }
(...skipping 14 matching lines...) Expand all
201 private: 201 private:
202 typedef GM INHERITED; 202 typedef GM INHERITED;
203 }; 203 };
204 204
205 ////////////////////////////////////////////////////////////////////////////// 205 //////////////////////////////////////////////////////////////////////////////
206 206
207 static GM* MyFactory(void*) { return new DFTextGM; } 207 static GM* MyFactory(void*) { return new DFTextGM; }
208 static GMRegistry reg(MyFactory); 208 static GMRegistry reg(MyFactory);
209 209
210 } 210 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698