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 "SkTransparentShader.h" | 10 #include "SkTransparentShader.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 for (int i = count - 1; i >= 0; --i) { | 87 for (int i = count - 1; i >= 0; --i) { |
88 span[i] = SkPackARGB32(src[i], 0, 0, 0); | 88 span[i] = SkPackARGB32(src[i], 0, 0, 0); |
89 } | 89 } |
90 } else { | 90 } else { |
91 for (int i = count - 1; i >= 0; --i) { | 91 for (int i = count - 1; i >= 0; --i) { |
92 span[i] = SkPackARGB32(SkAlphaMul(src[i], scale), 0, 0, 0); | 92 span[i] = SkPackARGB32(SkAlphaMul(src[i], scale), 0, 0, 0); |
93 } | 93 } |
94 } | 94 } |
95 break; | 95 break; |
96 } | 96 } |
97 case SkBitmap::kA1_Config: | |
98 SkDEBUGFAIL("kA1_Config umimplemented at this time"); | |
99 break; | |
100 default: // to avoid warnings | 97 default: // to avoid warnings |
101 break; | 98 break; |
102 } | 99 } |
103 } | 100 } |
104 | 101 |
105 void SkTransparentShader::shadeSpan16(int x, int y, uint16_t span[], int count)
{ | 102 void SkTransparentShader::shadeSpan16(int x, int y, uint16_t span[], int count)
{ |
106 SkASSERT(fDevice->config() == SkBitmap::kRGB_565_Config); | 103 SkASSERT(fDevice->config() == SkBitmap::kRGB_565_Config); |
107 | 104 |
108 uint16_t* src = fDevice->getAddr16(x, y); | 105 uint16_t* src = fDevice->getAddr16(x, y); |
109 if (src != span) { | 106 if (src != span) { |
110 memcpy(span, src, count << 1); | 107 memcpy(span, src, count << 1); |
111 } | 108 } |
112 } | 109 } |
113 | 110 |
114 #ifdef SK_DEVELOPER | 111 #ifdef SK_DEVELOPER |
115 void SkTransparentShader::toString(SkString* str) const { | 112 void SkTransparentShader::toString(SkString* str) const { |
116 str->append("SkTransparentShader: ("); | 113 str->append("SkTransparentShader: ("); |
117 | 114 |
118 this->INHERITED::toString(str); | 115 this->INHERITED::toString(str); |
119 | 116 |
120 str->append(")"); | 117 str->append(")"); |
121 } | 118 } |
122 #endif | 119 #endif |
OLD | NEW |