Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: src/core/SkComposeShader.cpp

Issue 1532573002: Don't preserve buggy Android behavior of ignoring the paint's alpha. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698