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 | 140 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
141 scale = 256; // ugh -- maintain old bug/behavior for now | 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; |
142 #endif | 144 #endif |
143 | 145 |
144 SkPMColor tmp[TMP_COLOR_COUNT]; | 146 SkPMColor tmp[TMP_COLOR_COUNT]; |
145 | 147 |
146 if (nullptr == mode) { // implied SRC_OVER | 148 if (nullptr == mode) { // implied SRC_OVER |
147 // TODO: when we have a good test-case, should use SkBlitRow::Proc32 | 149 // TODO: when we have a good test-case, should use SkBlitRow::Proc32 |
148 // for these loops | 150 // for these loops |
149 do { | 151 do { |
150 int n = count; | 152 int n = count; |
151 if (n > TMP_COLOR_COUNT) { | 153 if (n > TMP_COLOR_COUNT) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 if (fMode) { | 251 if (fMode) { |
250 str->append(" Xfermode: "); | 252 str->append(" Xfermode: "); |
251 fMode->toString(str); | 253 fMode->toString(str); |
252 } | 254 } |
253 | 255 |
254 this->INHERITED::toString(str); | 256 this->INHERITED::toString(str); |
255 | 257 |
256 str->append(")"); | 258 str->append(")"); |
257 } | 259 } |
258 #endif | 260 #endif |
OLD | NEW |