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

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

Issue 1694023002: Revert of Fix colorType/alphaType checks in SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
« no previous file with comments | « src/codec/SkCodec.cpp ('k') | src/codec/SkGifCodec.h » ('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 * 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 return kOpaque_SkAlphaType == dst.alphaType(); 139 return src.alphaType() == kOpaque_SkAlphaType;
140 case kGray_8_SkColorType:
141 if (kOpaque_SkAlphaType != dst.alphaType()) {
142 return false;
143 }
144 // Fall through
145 default: 140 default:
146 return dst.colorType() == src.colorType(); 141 return dst.colorType() == src.colorType();
147 } 142 }
148 } 143 }
149 144
150 /* 145 /*
151 * If there is a color table, get a pointer to the colors, otherwise return null ptr 146 * If there is a color table, get a pointer to the colors, otherwise return null ptr
152 */ 147 */
153 inline const SkPMColor* get_color_ptr(SkColorTable* colorTable) { 148 inline const SkPMColor* get_color_ptr(SkColorTable* colorTable) {
154 return nullptr != colorTable ? colorTable->readColors() : nullptr; 149 return nullptr != colorTable ? colorTable->readColors() : nullptr;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 uint32_t result; 241 uint32_t result;
247 memcpy(&result, &(buffer[i]), 4); 242 memcpy(&result, &(buffer[i]), 4);
248 #ifdef SK_CPU_BENDIAN 243 #ifdef SK_CPU_BENDIAN
249 return SkEndianSwap32(result); 244 return SkEndianSwap32(result);
250 #else 245 #else
251 return result; 246 return result;
252 #endif 247 #endif
253 } 248 }
254 249
255 #endif // SkCodecPriv_DEFINED 250 #endif // SkCodecPriv_DEFINED
OLDNEW
« no previous file with comments | « src/codec/SkCodec.cpp ('k') | src/codec/SkGifCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698