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

Side by Side Diff: gm/androidfallback.cpp

Issue 25749003: update GM to use #ifdef instead of just #if (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« 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 2013 Google Inc. 2 * Copyright 2013 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 9
10 namespace skiagm { 10 namespace skiagm {
(...skipping 12 matching lines...) Expand all
23 virtual SkISize onISize() SK_OVERRIDE { 23 virtual SkISize onISize() SK_OVERRIDE {
24 return make_isize(500, 500); 24 return make_isize(500, 500);
25 } 25 }
26 26
27 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 27 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
28 28
29 SkPaint paint; 29 SkPaint paint;
30 paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); 30 paint.setTextEncoding(SkPaint::kUTF16_TextEncoding);
31 paint.setTextSize(24); 31 paint.setTextSize(24);
32 32
33 #if SK_BUILD_FOR_ANDROID 33 #ifdef SK_BUILD_FOR_ANDROID
34 SkPaintOptionsAndroid options = paint.getPaintOptionsAndroid(); 34 SkPaintOptionsAndroid options = paint.getPaintOptionsAndroid();
35 options.setUseFontFallbacks(true); 35 options.setUseFontFallbacks(true);
36 paint.setPaintOptionsAndroid(options); 36 paint.setPaintOptionsAndroid(options);
37 #endif 37 #endif
38 38
39 // "א foo 免舌 bar क" 39 // "א foo 免舌 bar क"
40 const uint16_t unicodeStr[] = {0x05D0, 0x0020, 0x0066, 0x006F, 0x006F, 0 x0020, 0x514D, 40 const uint16_t unicodeStr[] = {0x05D0, 0x0020, 0x0066, 0x006F, 0x006F, 0 x0020, 0x514D,
41 0x820c, 0x0020, 0x0062, 0x0061, 0x0072, 0 x0020, 0x0915}; 41 0x820c, 0x0020, 0x0062, 0x0061, 0x0072, 0 x0020, 0x0915};
42 const int strLength = sizeof(unicodeStr) / sizeof(uint16_t); 42 const int strLength = sizeof(unicodeStr) / sizeof(uint16_t);
43 const int strByteLength = sizeof(unicodeStr); 43 const int strByteLength = sizeof(unicodeStr);
44 44
45 SkScalar posX[strLength]; 45 SkScalar posX[strLength];
46 SkPoint posXY[strLength]; 46 SkPoint posXY[strLength];
47 47
48 for (int i = 0; i < strLength; ++i) { 48 for (int i = 0; i < strLength; ++i) {
49 posX[i] = SkIntToScalar(i * 24); 49 posX[i] = SkIntToScalar(i * 24);
50 posXY[i].fX = posX[i]; 50 posXY[i].fX = posX[i];
51 posXY[i].fY = SkIntToScalar(24 + i); 51 posXY[i].fY = SkIntToScalar(24 + i);
52 } 52 }
53 53
54 canvas->translate(SkIntToScalar(10), SkIntToScalar(25)); 54 canvas->translate(SkIntToScalar(10), SkIntToScalar(25));
55 // This currently causes the PDF backend to assert 55 // This currently causes the PDF backend to assert
56 // canvas->drawText(unicodeStr, strByteLength, 0, 0, paint); 56 // canvas->drawText(unicodeStr, strByteLength, 0, 0, paint);
57 57
58 canvas->translate(0, SkIntToScalar(75)); 58 canvas->translate(0, SkIntToScalar(75));
59 canvas->drawPosTextH(unicodeStr, strByteLength, posX, 0, paint); 59 canvas->drawPosTextH(unicodeStr, strByteLength, posX, 0, paint);
60 60
61 #if SK_BUILD_FOR_ANDROID 61 #ifdef SK_BUILD_FOR_ANDROID
62 options.setLanguage("ja"); 62 options.setLanguage("ja");
63 paint.setPaintOptionsAndroid(options); 63 paint.setPaintOptionsAndroid(options);
64 #endif 64 #endif
65 65
66 canvas->translate(0, SkIntToScalar(75)); 66 canvas->translate(0, SkIntToScalar(75));
67 canvas->drawPosText(unicodeStr, strByteLength, posXY, paint); 67 canvas->drawPosText(unicodeStr, strByteLength, posXY, paint);
68 68
69 SkPath path; 69 SkPath path;
70 path.moveTo(0, 0); 70 path.moveTo(0, 0);
71 path.quadTo(50.0f, 100.0f, 250.0f, 150.0f); 71 path.quadTo(50.0f, 100.0f, 250.0f, 150.0f);
72 72
73 canvas->translate(0, SkIntToScalar(75)); 73 canvas->translate(0, SkIntToScalar(75));
74 canvas->drawTextOnPath(unicodeStr, strByteLength, path, NULL, paint); 74 canvas->drawTextOnPath(unicodeStr, strByteLength, path, NULL, paint);
75 } 75 }
76 76
77 private: 77 private:
78 typedef GM INHERITED; 78 typedef GM INHERITED;
79 }; 79 };
80 80
81 ////////////////////////////////////////////////////////////////////////////// 81 //////////////////////////////////////////////////////////////////////////////
82 82
83 #if SK_BUILD_FOR_ANDROID 83 #ifdef SK_BUILD_FOR_ANDROID
84 DEF_GM( return SkNEW(AndroidFallbackGM); ) 84 DEF_GM( return SkNEW(AndroidFallbackGM); )
85 #endif 85 #endif
86 86
87 } 87 }
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