OLD | NEW |
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 "SkTypes.h" | 7 #include "SkTypes.h" |
8 | 8 |
9 #include "Test.h" | 9 #include "Test.h" |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 create(&drawTextBitmap, drawTextRect, SkBitmap::kARGB_8888_Config); | 73 create(&drawTextBitmap, drawTextRect, SkBitmap::kARGB_8888_Config); |
74 SkCanvas drawTextCanvas(drawTextBitmap); | 74 SkCanvas drawTextCanvas(drawTextBitmap); |
75 | 75 |
76 SkIRect drawPosTextRect = SkIRect::MakeWH(64, 64); | 76 SkIRect drawPosTextRect = SkIRect::MakeWH(64, 64); |
77 SkBitmap drawPosTextBitmap; | 77 SkBitmap drawPosTextBitmap; |
78 create(&drawPosTextBitmap, drawPosTextRect, SkBitmap::kARGB_8888_Config); | 78 create(&drawPosTextBitmap, drawPosTextRect, SkBitmap::kARGB_8888_Config); |
79 SkCanvas drawPosTextCanvas(drawPosTextBitmap); | 79 SkCanvas drawPosTextCanvas(drawPosTextBitmap); |
80 | 80 |
81 for (float offsetY = 0.0f; offsetY < 1.0f; offsetY += (1.0f / 16.0f)) { | 81 for (float offsetY = 0.0f; offsetY < 1.0f; offsetY += (1.0f / 16.0f)) { |
82 for (float offsetX = 0.0f; offsetX < 1.0f; offsetX += (1.0f / 16.0f)) { | 82 for (float offsetX = 0.0f; offsetX < 1.0f; offsetX += (1.0f / 16.0f)) { |
83 SkPoint point = SkPoint::Make(SkFloatToScalar(25.0f + offsetX), | 83 SkPoint point = SkPoint::Make(25.0f + offsetX, |
84 SkFloatToScalar(25.0f + offsetY)); | 84 25.0f + offsetY); |
85 | 85 |
86 for (int align = 0; align < SkPaint::kAlignCount; ++align) { | 86 for (int align = 0; align < SkPaint::kAlignCount; ++align) { |
87 paint.setTextAlign(static_cast<SkPaint::Align>(align)); | 87 paint.setTextAlign(static_cast<SkPaint::Align>(align)); |
88 | 88 |
89 for (unsigned int flags = 0; flags < (1 << 3); ++flags) { | 89 for (unsigned int flags = 0; flags < (1 << 3); ++flags) { |
90 static const unsigned int antiAliasFlag = 1; | 90 static const unsigned int antiAliasFlag = 1; |
91 static const unsigned int subpixelFlag = 1 << 1; | 91 static const unsigned int subpixelFlag = 1 << 1; |
92 static const unsigned int lcdFlag = 1 << 2; | 92 static const unsigned int lcdFlag = 1 << 2; |
93 | 93 |
94 paint.setAntiAlias(SkToBool(flags & antiAliasFlag)); | 94 paint.setAntiAlias(SkToBool(flags & antiAliasFlag)); |
(...skipping 11 matching lines...) Expand all Loading... |
106 compare(drawTextBitmap, drawTextRect, | 106 compare(drawTextBitmap, drawTextRect, |
107 drawPosTextBitmap, drawPosTextRect)); | 107 drawPosTextBitmap, drawPosTextRect)); |
108 } | 108 } |
109 } | 109 } |
110 } | 110 } |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 #include "TestClassDef.h" | 114 #include "TestClassDef.h" |
115 DEFINE_TESTCLASS("DrawText_DrawPosText", DrawTextTestClass, test_drawText) | 115 DEFINE_TESTCLASS("DrawText_DrawPosText", DrawTextTestClass, test_drawText) |
OLD | NEW |