OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkAtomics.h" | 8 #include "SkAtomics.h" |
9 #include "SkBitmapProcShader.h" | 9 #include "SkBitmapProcShader.h" |
10 #include "SkColorShader.h" | 10 #include "SkColorShader.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 r = SkMulDiv255Round(r, a); | 291 r = SkMulDiv255Round(r, a); |
292 g = SkMulDiv255Round(g, a); | 292 g = SkMulDiv255Round(g, a); |
293 b = SkMulDiv255Round(b, a); | 293 b = SkMulDiv255Round(b, a); |
294 } | 294 } |
295 fPMColor = SkPackARGB32(a, r, g, b); | 295 fPMColor = SkPackARGB32(a, r, g, b); |
296 | 296 |
297 SkColor4f c4 = SkColor4f::FromColor(shader.fColor); | 297 SkColor4f c4 = SkColor4f::FromColor(shader.fColor); |
298 c4.fA *= rec.fPaint->getAlpha() / 255.0f; | 298 c4.fA *= rec.fPaint->getAlpha() / 255.0f; |
299 fPM4f = c4.premul(); | 299 fPM4f = c4.premul(); |
300 | 300 |
301 fFlags = kConstInY32_Flag | kSupports4f_Flag; | 301 fFlags = kConstInY32_Flag; |
302 if (255 == a) { | 302 if (255 == a) { |
303 fFlags |= kOpaqueAlpha_Flag; | 303 fFlags |= kOpaqueAlpha_Flag; |
304 } | 304 } |
305 } | 305 } |
306 | 306 |
307 void SkColorShader::ColorShaderContext::shadeSpan(int x, int y, SkPMColor span[]
, int count) { | 307 void SkColorShader::ColorShaderContext::shadeSpan(int x, int y, SkPMColor span[]
, int count) { |
308 sk_memset32(span, fPMColor, count); | 308 sk_memset32(span, fPMColor, count); |
309 } | 309 } |
310 | 310 |
311 void SkColorShader::ColorShaderContext::shadeSpanAlpha(int x, int y, uint8_t alp
ha[], int count) { | 311 void SkColorShader::ColorShaderContext::shadeSpanAlpha(int x, int y, uint8_t alp
ha[], int count) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 #include "SkEmptyShader.h" | 365 #include "SkEmptyShader.h" |
366 | 366 |
367 void SkEmptyShader::toString(SkString* str) const { | 367 void SkEmptyShader::toString(SkString* str) const { |
368 str->append("SkEmptyShader: ("); | 368 str->append("SkEmptyShader: ("); |
369 | 369 |
370 this->INHERITED::toString(str); | 370 this->INHERITED::toString(str); |
371 | 371 |
372 str->append(")"); | 372 str->append(")"); |
373 } | 373 } |
374 #endif | 374 #endif |
OLD | NEW |