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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 SkShader::Context* contextA, SkShader::Context* contextB) | 114 SkShader::Context* contextA, SkShader::Context* contextB) |
115 : INHERITED(shader, rec) | 115 : INHERITED(shader, rec) |
116 , fShaderContextA(contextA) | 116 , fShaderContextA(contextA) |
117 , fShaderContextB(contextB) {} | 117 , fShaderContextB(contextB) {} |
118 | 118 |
119 SkComposeShader::ComposeShaderContext::~ComposeShaderContext() { | 119 SkComposeShader::ComposeShaderContext::~ComposeShaderContext() { |
120 fShaderContextA->~Context(); | 120 fShaderContextA->~Context(); |
121 fShaderContextB->~Context(); | 121 fShaderContextB->~Context(); |
122 } | 122 } |
123 | 123 |
| 124 bool SkComposeShader::asACompose(ComposeRec* rec) const { |
| 125 if (rec) { |
| 126 rec->fShaderA = fShaderA; |
| 127 rec->fShaderB = fShaderB; |
| 128 rec->fMode = fMode; |
| 129 } |
| 130 return true; |
| 131 } |
| 132 |
| 133 |
124 // larger is better (fewer times we have to loop), but we shouldn't | 134 // larger is better (fewer times we have to loop), but we shouldn't |
125 // take up too much stack-space (each element is 4 bytes) | 135 // take up too much stack-space (each element is 4 bytes) |
126 #define TMP_COLOR_COUNT 64 | 136 #define TMP_COLOR_COUNT 64 |
127 | 137 |
128 void SkComposeShader::ComposeShaderContext::shadeSpan(int x, int y, SkPMColor re
sult[], int count) { | 138 void SkComposeShader::ComposeShaderContext::shadeSpan(int x, int y, SkPMColor re
sult[], int count) { |
129 SkShader::Context* shaderContextA = fShaderContextA; | 139 SkShader::Context* shaderContextA = fShaderContextA; |
130 SkShader::Context* shaderContextB = fShaderContextB; | 140 SkShader::Context* shaderContextB = fShaderContextB; |
131 SkXfermode* mode = static_cast<const SkComposeShader&>(fShader).fMode
; | 141 SkXfermode* mode = static_cast<const SkComposeShader&>(fShader).fMode
; |
132 unsigned scale = SkAlpha255To256(this->getPaintAlpha()); | 142 unsigned scale = SkAlpha255To256(this->getPaintAlpha()); |
133 | 143 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 str->append(" ShaderB: "); | 207 str->append(" ShaderB: "); |
198 fShaderB->toString(str); | 208 fShaderB->toString(str); |
199 str->append(" Xfermode: "); | 209 str->append(" Xfermode: "); |
200 fMode->toString(str); | 210 fMode->toString(str); |
201 | 211 |
202 this->INHERITED::toString(str); | 212 this->INHERITED::toString(str); |
203 | 213 |
204 str->append(")"); | 214 str->append(")"); |
205 } | 215 } |
206 #endif | 216 #endif |
OLD | NEW |