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

Side by Side Diff: src/codec/SkCodec_libgif.cpp

Issue 1277213002: Support more swizzles to 565 in SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Support more Created 5 years, 4 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 Google Inc. 2 * Copyright 2015 Google Inc.
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 "SkCodec_libgif.h" 8 #include "SkCodec_libgif.h"
9 #include "SkCodecPriv.h" 9 #include "SkCodecPriv.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 return NULL; 204 return NULL;
205 } 205 }
206 206
207 SkGifCodec::SkGifCodec(const SkImageInfo& srcInfo, SkStream* stream, 207 SkGifCodec::SkGifCodec(const SkImageInfo& srcInfo, SkStream* stream,
208 GifFileType* gif) 208 GifFileType* gif)
209 : INHERITED(srcInfo, stream) 209 : INHERITED(srcInfo, stream)
210 , fGif(gif) 210 , fGif(gif)
211 {} 211 {}
212 212
213 /* 213 /*
214 * Checks if the conversion between the input image and the requested output
215 * image has been implemented
216 */
217 static bool conversion_possible(const SkImageInfo& dst,
218 const SkImageInfo& src) {
219 // Ensure that the profile type is unchanged
220 if (dst.profileType() != src.profileType()) {
221 return false;
222 }
223
224 // Check for supported color and alpha types
225 switch (dst.colorType()) {
226 case kN32_SkColorType:
227 return kPremul_SkAlphaType == dst.alphaType() ||
228 kUnpremul_SkAlphaType == dst.alphaType();
229 case kIndex_8_SkColorType:
230 return kPremul_SkAlphaType == dst.alphaType() ||
231 kUnpremul_SkAlphaType == dst.alphaType();
232 default:
233 return false;
234 }
235 }
236
237 /*
238 * Initiates the gif decode 214 * Initiates the gif decode
239 */ 215 */
240 SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo, 216 SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo,
241 void* dst, size_t dstRowBytes, 217 void* dst, size_t dstRowBytes,
242 const Options& opts, 218 const Options& opts,
243 SkPMColor* inputColorPtr, 219 SkPMColor* inputColorPtr,
244 int* inputColorCount) { 220 int* inputColorCount) {
245 // Rewind if necessary 221 // Rewind if necessary
246 SkCodec::RewindState rewindState = this->rewindIfNeeded(); 222 SkCodec::RewindState rewindState = this->rewindIfNeeded();
247 if (rewindState == kCouldNotRewind_RewindState) { 223 if (rewindState == kCouldNotRewind_RewindState) {
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 // giflib returns an error code if the record type is not known. 547 // giflib returns an error code if the record type is not known.
572 // We should catch this error immediately. 548 // We should catch this error immediately.
573 SkASSERT(false); 549 SkASSERT(false);
574 break; 550 break;
575 } 551 }
576 } while (TERMINATE_RECORD_TYPE != recordType); 552 } while (TERMINATE_RECORD_TYPE != recordType);
577 553
578 return gif_error("Could not find any images to decode in gif file.\n", 554 return gif_error("Could not find any images to decode in gif file.\n",
579 kInvalidInput); 555 kInvalidInput);
580 } 556 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698