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

Side by Side Diff: src/effects/SkTransparentShader.cpp

Issue 227433009: Rename kPMColor_SkColorType to kN32_SkColorType. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 8 months 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 | « src/effects/SkMorphologyImageFilter.cpp ('k') | src/effects/gradients/SkGradientShader.cpp » ('j') | 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 "SkTransparentShader.h" 10 #include "SkTransparentShader.h"
(...skipping 11 matching lines...) Expand all
22 22
23 uint32_t SkTransparentShader::getFlags() { 23 uint32_t SkTransparentShader::getFlags() {
24 uint32_t flags = this->INHERITED::getFlags(); 24 uint32_t flags = this->INHERITED::getFlags();
25 25
26 switch (fDevice->colorType()) { 26 switch (fDevice->colorType()) {
27 case kRGB_565_SkColorType: 27 case kRGB_565_SkColorType:
28 flags |= kHasSpan16_Flag; 28 flags |= kHasSpan16_Flag;
29 if (fAlpha == 255) 29 if (fAlpha == 255)
30 flags |= kOpaqueAlpha_Flag; 30 flags |= kOpaqueAlpha_Flag;
31 break; 31 break;
32 case kPMColor_SkColorType: 32 case kN32_SkColorType:
33 if (fAlpha == 255 && fDevice->isOpaque()) 33 if (fAlpha == 255 && fDevice->isOpaque())
34 flags |= kOpaqueAlpha_Flag; 34 flags |= kOpaqueAlpha_Flag;
35 break; 35 break;
36 default: 36 default:
37 break; 37 break;
38 } 38 }
39 return flags; 39 return flags;
40 } 40 }
41 41
42 void SkTransparentShader::shadeSpan(int x, int y, SkPMColor span[], int count) { 42 void SkTransparentShader::shadeSpan(int x, int y, SkPMColor span[], int count) {
43 unsigned scale = SkAlpha255To256(fAlpha); 43 unsigned scale = SkAlpha255To256(fAlpha);
44 44
45 switch (fDevice->colorType()) { 45 switch (fDevice->colorType()) {
46 case kPMColor_SkColorType: 46 case kN32_SkColorType:
47 if (scale == 256) { 47 if (scale == 256) {
48 SkPMColor* src = fDevice->getAddr32(x, y); 48 SkPMColor* src = fDevice->getAddr32(x, y);
49 if (src != span) { 49 if (src != span) {
50 memcpy(span, src, count * sizeof(SkPMColor)); 50 memcpy(span, src, count * sizeof(SkPMColor));
51 } 51 }
52 } else { 52 } else {
53 const SkPMColor* src = fDevice->getAddr32(x, y); 53 const SkPMColor* src = fDevice->getAddr32(x, y);
54 for (int i = count - 1; i >= 0; --i) { 54 for (int i = count - 1; i >= 0; --i) {
55 span[i] = SkAlphaMulQ(src[i], scale); 55 span[i] = SkAlphaMulQ(src[i], scale);
56 } 56 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 #ifndef SK_IGNORE_TO_STRING 109 #ifndef SK_IGNORE_TO_STRING
110 void SkTransparentShader::toString(SkString* str) const { 110 void SkTransparentShader::toString(SkString* str) const {
111 str->append("SkTransparentShader: ("); 111 str->append("SkTransparentShader: (");
112 112
113 this->INHERITED::toString(str); 113 this->INHERITED::toString(str);
114 114
115 str->append(")"); 115 str->append(")");
116 } 116 }
117 #endif 117 #endif
OLDNEW
« no previous file with comments | « src/effects/SkMorphologyImageFilter.cpp ('k') | src/effects/gradients/SkGradientShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698