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 "Test.h" | 8 #include "Test.h" |
9 #include "SkPath.h" | 9 #include "SkPath.h" |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
11 #include "SkLayerDrawLooper.h" | 11 #include "SkLayerDrawLooper.h" |
12 #include "SkBlurMaskFilter.h" | 12 #include "SkBlurMaskFilter.h" |
13 | 13 |
| 14 // temparary api for bicubic, just be sure we can set/clear it |
| 15 static void test_bicubic(skiatest::Reporter* reporter) { |
| 16 SkPaint p0; |
| 17 REPORTER_ASSERT(reporter, 0 == (p0.getFlags() & SkPaint::kBicubicFilterBitma
p_Flag)); |
| 18 p0.setFlags(p0.getFlags() | SkPaint::kBicubicFilterBitmap_Flag); |
| 19 REPORTER_ASSERT(reporter, 0 != (p0.getFlags() & SkPaint::kBicubicFilterBitma
p_Flag)); |
| 20 SkPaint p1(p0); |
| 21 REPORTER_ASSERT(reporter, 0 != (p1.getFlags() & SkPaint::kBicubicFilterBitma
p_Flag)); |
| 22 p0.reset(); |
| 23 REPORTER_ASSERT(reporter, 0 == (p0.getFlags() & SkPaint::kBicubicFilterBitma
p_Flag)); |
| 24 p0 = p1; |
| 25 p0.setFlags(p0.getFlags() | SkPaint::kBicubicFilterBitmap_Flag); |
| 26 } |
| 27 |
14 static void test_copy(skiatest::Reporter* reporter) { | 28 static void test_copy(skiatest::Reporter* reporter) { |
15 SkPaint paint; | 29 SkPaint paint; |
16 // set a few member variables | 30 // set a few member variables |
17 paint.setStyle(SkPaint::kStrokeAndFill_Style); | 31 paint.setStyle(SkPaint::kStrokeAndFill_Style); |
18 paint.setTextAlign(SkPaint::kLeft_Align); | 32 paint.setTextAlign(SkPaint::kLeft_Align); |
19 paint.setStrokeWidth(SkIntToScalar(2)); | 33 paint.setStrokeWidth(SkIntToScalar(2)); |
20 // set a few pointers | 34 // set a few pointers |
21 SkLayerDrawLooper* looper = new SkLayerDrawLooper(); | 35 SkLayerDrawLooper* looper = new SkLayerDrawLooper(); |
22 paint.setLooper(looper)->unref(); | 36 paint.setLooper(looper)->unref(); |
23 SkMaskFilter* mask = SkBlurMaskFilter::Create(1, SkBlurMaskFilter::kNormal_B
lurStyle); | 37 SkMaskFilter* mask = SkBlurMaskFilter::Create(1, SkBlurMaskFilter::kNormal_B
lurStyle); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 REPORTER_ASSERT(reporter, r.isEmpty()); | 125 REPORTER_ASSERT(reporter, r.isEmpty()); |
112 } | 126 } |
113 | 127 |
114 static void TestPaint(skiatest::Reporter* reporter) { | 128 static void TestPaint(skiatest::Reporter* reporter) { |
115 // TODO add general paint tests | 129 // TODO add general paint tests |
116 test_copy(reporter); | 130 test_copy(reporter); |
117 | 131 |
118 // regression tests | 132 // regression tests |
119 regression_cubic(reporter); | 133 regression_cubic(reporter); |
120 regression_measureText(reporter); | 134 regression_measureText(reporter); |
| 135 |
| 136 test_bicubic(reporter); |
121 } | 137 } |
122 | 138 |
123 #include "TestClassDef.h" | 139 #include "TestClassDef.h" |
124 DEFINE_TESTCLASS("Paint", TestPaintClass, TestPaint) | 140 DEFINE_TESTCLASS("Paint", TestPaintClass, TestPaint) |
OLD | NEW |