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 | 7 |
8 #include "SkColorShader.h" | 8 #include "SkColorShader.h" |
9 #include "SkGradientShader.h" | 9 #include "SkGradientShader.h" |
10 #include "SkShader.h" | 10 #include "SkShader.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 96 } |
97 | 97 |
98 static void test_color(skiatest::Reporter* reporter) | 98 static void test_color(skiatest::Reporter* reporter) |
99 { | 99 { |
100 SkColorShader colorShader1(SkColorSetARGB(0,0,0,0)); | 100 SkColorShader colorShader1(SkColorSetARGB(0,0,0,0)); |
101 REPORTER_ASSERT(reporter, !colorShader1.isOpaque()); | 101 REPORTER_ASSERT(reporter, !colorShader1.isOpaque()); |
102 SkColorShader colorShader2(SkColorSetARGB(0xFF,0,0,0)); | 102 SkColorShader colorShader2(SkColorSetARGB(0xFF,0,0,0)); |
103 REPORTER_ASSERT(reporter, colorShader2.isOpaque()); | 103 REPORTER_ASSERT(reporter, colorShader2.isOpaque()); |
104 SkColorShader colorShader3(SkColorSetARGB(0x7F,0,0,0)); | 104 SkColorShader colorShader3(SkColorSetARGB(0x7F,0,0,0)); |
105 REPORTER_ASSERT(reporter, !colorShader3.isOpaque()); | 105 REPORTER_ASSERT(reporter, !colorShader3.isOpaque()); |
106 | |
107 // with inherrited color, shader must declare itself as opaque, | |
108 // since lack of opacity will depend solely on the paint | |
109 SkColorShader colorShader4; | |
110 REPORTER_ASSERT(reporter, colorShader4.isOpaque()); | |
111 } | 106 } |
112 | 107 |
113 DEF_TEST(ShaderOpacity, reporter) { | 108 DEF_TEST(ShaderOpacity, reporter) { |
114 test_gradient(reporter); | 109 test_gradient(reporter); |
115 test_color(reporter); | 110 test_color(reporter); |
116 test_bitmap(reporter); | 111 test_bitmap(reporter); |
117 } | 112 } |
OLD | NEW |