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

Side by Side Diff: gm/androidfallback.cpp

Issue 208313014: gather GM tests which are disabled on Android (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add links to bugs Created 6 years, 9 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/bitmapcopy.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 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 17 matching lines...) Expand all
28 virtual SkISize onISize() SK_OVERRIDE { 28 virtual SkISize onISize() SK_OVERRIDE {
29 return make_isize(500, 500); 29 return make_isize(500, 500);
30 } 30 }
31 31
32 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 32 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
33 33
34 SkPaint paint; 34 SkPaint paint;
35 paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); 35 paint.setTextEncoding(SkPaint::kUTF16_TextEncoding);
36 paint.setTextSize(24); 36 paint.setTextSize(24);
37 37
38 #ifdef SK_BUILD_FOR_ANDROID
39 SkPaintOptionsAndroid options = paint.getPaintOptionsAndroid(); 38 SkPaintOptionsAndroid options = paint.getPaintOptionsAndroid();
40 options.setUseFontFallbacks(true); 39 options.setUseFontFallbacks(true);
41 paint.setPaintOptionsAndroid(options); 40 paint.setPaintOptionsAndroid(options);
42 #endif
43 41
44 // "א foo 免舌 bar क" 42 // "א foo 免舌 bar क"
45 const uint16_t unicodeStr[] = {0x05D0, 0x0020, 0x0066, 0x006F, 0x006F, 0 x0020, 0x514D, 43 const uint16_t unicodeStr[] = {0x05D0, 0x0020, 0x0066, 0x006F, 0x006F, 0 x0020, 0x514D,
46 0x820c, 0x0020, 0x0062, 0x0061, 0x0072, 0 x0020, 0x0915}; 44 0x820c, 0x0020, 0x0062, 0x0061, 0x0072, 0 x0020, 0x0915};
47 const int strLength = sizeof(unicodeStr) / sizeof(uint16_t); 45 const int strLength = sizeof(unicodeStr) / sizeof(uint16_t);
48 const int strByteLength = sizeof(unicodeStr); 46 const int strByteLength = sizeof(unicodeStr);
49 47
50 SkScalar posX[strLength]; 48 SkScalar posX[strLength];
51 SkPoint posXY[strLength]; 49 SkPoint posXY[strLength];
52 50
53 for (int i = 0; i < strLength; ++i) { 51 for (int i = 0; i < strLength; ++i) {
54 posX[i] = SkIntToScalar(i * 24); 52 posX[i] = SkIntToScalar(i * 24);
55 posXY[i].fX = posX[i]; 53 posXY[i].fX = posX[i];
56 posXY[i].fY = SkIntToScalar(24 + i); 54 posXY[i].fY = SkIntToScalar(24 + i);
57 } 55 }
58 56
59 canvas->translate(SkIntToScalar(10), SkIntToScalar(25)); 57 canvas->translate(SkIntToScalar(10), SkIntToScalar(25));
60 // This currently causes the PDF backend to assert 58 // This currently causes the PDF backend to assert
61 // canvas->drawText(unicodeStr, strByteLength, 0, 0, paint); 59 // canvas->drawText(unicodeStr, strByteLength, 0, 0, paint);
62 60
63 canvas->translate(0, SkIntToScalar(75)); 61 canvas->translate(0, SkIntToScalar(75));
64 canvas->drawPosTextH(unicodeStr, strByteLength, posX, 0, paint); 62 canvas->drawPosTextH(unicodeStr, strByteLength, posX, 0, paint);
65 63
66 #ifdef SK_BUILD_FOR_ANDROID
67 options.setLanguage("ja"); 64 options.setLanguage("ja");
68 paint.setPaintOptionsAndroid(options); 65 paint.setPaintOptionsAndroid(options);
69 #endif
70 66
71 canvas->translate(0, SkIntToScalar(75)); 67 canvas->translate(0, SkIntToScalar(75));
72 canvas->drawPosText(unicodeStr, strByteLength, posXY, paint); 68 canvas->drawPosText(unicodeStr, strByteLength, posXY, paint);
73 69
74 SkPath path; 70 SkPath path;
75 path.moveTo(0, 0); 71 path.moveTo(0, 0);
76 path.quadTo(50.0f, 100.0f, 250.0f, 150.0f); 72 path.quadTo(50.0f, 100.0f, 250.0f, 150.0f);
77 73
78 canvas->translate(0, SkIntToScalar(75)); 74 canvas->translate(0, SkIntToScalar(75));
79 canvas->drawTextOnPath(unicodeStr, strByteLength, path, NULL, paint); 75 canvas->drawTextOnPath(unicodeStr, strByteLength, path, NULL, paint);
80 } 76 }
81 77
82 private: 78 private:
83 typedef GM INHERITED; 79 typedef GM INHERITED;
84 }; 80 };
85 81
86 ////////////////////////////////////////////////////////////////////////////// 82 //////////////////////////////////////////////////////////////////////////////
87 83
88 #ifdef SK_BUILD_FOR_ANDROID
89 DEF_GM( return SkNEW(AndroidFallbackGM); ) 84 DEF_GM( return SkNEW(AndroidFallbackGM); )
90 #endif
91 85
92 } 86 }
OLDNEW
« no previous file with comments | « no previous file | gm/bitmapcopy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698