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

Side by Side Diff: src/codec/SkCodecPriv.h

Issue 1695473002: Fix colorType/alphaType checks in SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Consistently require that kGray8 decodes be opaque Created 4 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The Android Open Source Project 2 * Copyright 2015 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 #ifndef SkCodecPriv_DEFINED 8 #ifndef SkCodecPriv_DEFINED
9 #define SkCodecPriv_DEFINED 9 #define SkCodecPriv_DEFINED
10 10
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // Ensure the alpha type is valid 129 // Ensure the alpha type is valid
130 if (!valid_alpha(dst.alphaType(), src.alphaType())) { 130 if (!valid_alpha(dst.alphaType(), src.alphaType())) {
131 return false; 131 return false;
132 } 132 }
133 133
134 // Check for supported color types 134 // Check for supported color types
135 switch (dst.colorType()) { 135 switch (dst.colorType()) {
136 case kN32_SkColorType: 136 case kN32_SkColorType:
137 return true; 137 return true;
138 case kRGB_565_SkColorType: 138 case kRGB_565_SkColorType:
139 case kGray_8_SkColorType:
scroggo 2016/02/12 17:13:55 So if the Source is N32 and has no alpha, we will
msarett 2016/02/12 17:41:31 Oops this is not what I meant to do. Just want to
139 return src.alphaType() == kOpaque_SkAlphaType; 140 return src.alphaType() == kOpaque_SkAlphaType;
140 default: 141 default:
141 return dst.colorType() == src.colorType(); 142 return dst.colorType() == src.colorType();
142 } 143 }
143 } 144 }
144 145
145 /* 146 /*
146 * If there is a color table, get a pointer to the colors, otherwise return null ptr 147 * If there is a color table, get a pointer to the colors, otherwise return null ptr
147 */ 148 */
148 inline const SkPMColor* get_color_ptr(SkColorTable* colorTable) { 149 inline const SkPMColor* get_color_ptr(SkColorTable* colorTable) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 uint32_t result; 242 uint32_t result;
242 memcpy(&result, &(buffer[i]), 4); 243 memcpy(&result, &(buffer[i]), 4);
243 #ifdef SK_CPU_BENDIAN 244 #ifdef SK_CPU_BENDIAN
244 return SkEndianSwap32(result); 245 return SkEndianSwap32(result);
245 #else 246 #else
246 return result; 247 return result;
247 #endif 248 #endif
248 } 249 }
249 250
250 #endif // SkCodecPriv_DEFINED 251 #endif // SkCodecPriv_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698