OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
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 | 8 |
9 | 9 |
10 #include "SkComposeShader.h" | 10 #include "SkComposeShader.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // larger is better (fewer times we have to loop), but we shouldn't | 130 // larger is better (fewer times we have to loop), but we shouldn't |
131 // take up too much stack-space (each element is 4 bytes) | 131 // take up too much stack-space (each element is 4 bytes) |
132 #define TMP_COLOR_COUNT 64 | 132 #define TMP_COLOR_COUNT 64 |
133 | 133 |
134 void SkComposeShader::ComposeShaderContext::shadeSpan(int x, int y, SkPMColor re
sult[], int count) { | 134 void SkComposeShader::ComposeShaderContext::shadeSpan(int x, int y, SkPMColor re
sult[], int count) { |
135 SkShader::Context* shaderContextA = fShaderContextA; | 135 SkShader::Context* shaderContextA = fShaderContextA; |
136 SkShader::Context* shaderContextB = fShaderContextB; | 136 SkShader::Context* shaderContextB = fShaderContextB; |
137 SkXfermode* mode = static_cast<const SkComposeShader&>(fShader).fMode
; | 137 SkXfermode* mode = static_cast<const SkComposeShader&>(fShader).fMode
; |
138 unsigned scale = SkAlpha255To256(this->getPaintAlpha()); | 138 unsigned scale = SkAlpha255To256(this->getPaintAlpha()); |
139 | 139 |
140 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | |
141 // In the Android framework, make compose shader ignore the paint's alpha. | |
142 // This matches the old behavior. FIXME: Can we remove this difference? | |
143 scale = 256; | |
144 #endif | |
145 | |
146 SkPMColor tmp[TMP_COLOR_COUNT]; | 140 SkPMColor tmp[TMP_COLOR_COUNT]; |
147 | 141 |
148 if (nullptr == mode) { // implied SRC_OVER | 142 if (nullptr == mode) { // implied SRC_OVER |
149 // TODO: when we have a good test-case, should use SkBlitRow::Proc32 | 143 // TODO: when we have a good test-case, should use SkBlitRow::Proc32 |
150 // for these loops | 144 // for these loops |
151 do { | 145 do { |
152 int n = count; | 146 int n = count; |
153 if (n > TMP_COLOR_COUNT) { | 147 if (n > TMP_COLOR_COUNT) { |
154 n = TMP_COLOR_COUNT; | 148 n = TMP_COLOR_COUNT; |
155 } | 149 } |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 if (fMode) { | 245 if (fMode) { |
252 str->append(" Xfermode: "); | 246 str->append(" Xfermode: "); |
253 fMode->toString(str); | 247 fMode->toString(str); |
254 } | 248 } |
255 | 249 |
256 this->INHERITED::toString(str); | 250 this->INHERITED::toString(str); |
257 | 251 |
258 str->append(")"); | 252 str->append(")"); |
259 } | 253 } |
260 #endif | 254 #endif |
OLD | NEW |