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

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

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 years, 3 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/SkCodec_libico.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 * 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // Many gifs specify a color table index for transparent pixels. Every 163 // Many gifs specify a color table index for transparent pixels. Every
164 // other pixel is guaranteed to be opaque. Despite this, because of the 164 // other pixel is guaranteed to be opaque. Despite this, because of the
165 // possiblity of transparent pixels, we cannot assume that the image is 165 // possiblity of transparent pixels, we cannot assume that the image is
166 // opaque. We have the option to set the alpha type as kPremul or 166 // opaque. We have the option to set the alpha type as kPremul or
167 // kUnpremul. Both are valid since the alpha component will always be 167 // kUnpremul. Both are valid since the alpha component will always be
168 // 0xFF or the entire 32-bit pixel will be set to zero. We prefer 168 // 0xFF or the entire 32-bit pixel will be set to zero. We prefer
169 // kPremul because we support kPremul, and it is more efficient to 169 // kPremul because we support kPremul, and it is more efficient to
170 // use kPremul directly even when kUnpremul is supported. 170 // use kPremul directly even when kUnpremul is supported.
171 const SkImageInfo& imageInfo = SkImageInfo::Make(width, height, 171 const SkImageInfo& imageInfo = SkImageInfo::Make(width, height,
172 kIndex_8_SkColorType, kPremul_SkAlphaType); 172 kIndex_8_SkColorType, kPremul_SkAlphaType);
173 *codecOut = SkNEW_ARGS(SkGifCodec, (imageInfo, streamDeleter.detach(), g if.detach())); 173 *codecOut = new SkGifCodec(imageInfo, streamDeleter.detach(), gif.detach ());
174 } else { 174 } else {
175 SkASSERT(NULL != gifOut); 175 SkASSERT(NULL != gifOut);
176 streamDeleter.detach(); 176 streamDeleter.detach();
177 *gifOut = gif.detach(); 177 *gifOut = gif.detach();
178 } 178 }
179 return true; 179 return true;
180 } 180 }
181 181
182 /* 182 /*
183 * Assumes IsGif was called and returned true 183 * Assumes IsGif was called and returned true
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 SkSwizzler::kIndex, colorTable, subsetDstInfo, 408 SkSwizzler::kIndex, colorTable, subsetDstInfo,
409 zeroInit, this->getInfo())); 409 zeroInit, this->getInfo()));
410 } else { 410 } else {
411 // Create the fully dimensional swizzler 411 // Create the fully dimensional swizzler
412 swizzler.reset(SkSwizzler::CreateSwizzler( 412 swizzler.reset(SkSwizzler::CreateSwizzler(
413 SkSwizzler::kIndex, colorTable, dstInfo, 413 SkSwizzler::kIndex, colorTable, dstInfo,
414 zeroInit, this->getInfo())); 414 zeroInit, this->getInfo()));
415 } 415 }
416 416
417 // Stores output from dgiflib and input to the swizzler 417 // Stores output from dgiflib and input to the swizzler
418 SkAutoTDeleteArray<uint8_t> 418 SkAutoTDeleteArray<uint8_t> buffer(new uint8_t[innerWidth]);
419 buffer(SkNEW_ARRAY(uint8_t, innerWidth));
420 419
421 // Check the interlace flag and iterate over rows of the input 420 // Check the interlace flag and iterate over rows of the input
422 if (fGif->Image.Interlace) { 421 if (fGif->Image.Interlace) {
423 // In interlace mode, the rows of input are rearranged in 422 // In interlace mode, the rows of input are rearranged in
424 // the output image. We use an iterator to take care of 423 // the output image. We use an iterator to take care of
425 // the rearranging. 424 // the rearranging.
426 SkGifInterlaceIter iter(innerHeight); 425 SkGifInterlaceIter iter(innerHeight);
427 for (int32_t y = 0; y < innerHeight; y++) { 426 for (int32_t y = 0; y < innerHeight; y++) {
428 if (GIF_ERROR == DGifGetLine(fGif, buffer.get(), 427 if (GIF_ERROR == DGifGetLine(fGif, buffer.get(),
429 innerWidth)) { 428 innerWidth)) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 // giflib returns an error code if the record type is not known. 522 // giflib returns an error code if the record type is not known.
524 // We should catch this error immediately. 523 // We should catch this error immediately.
525 SkASSERT(false); 524 SkASSERT(false);
526 break; 525 break;
527 } 526 }
528 } while (TERMINATE_RECORD_TYPE != recordType); 527 } while (TERMINATE_RECORD_TYPE != recordType);
529 528
530 return gif_error("Could not find any images to decode in gif file.\n", 529 return gif_error("Could not find any images to decode in gif file.\n",
531 kInvalidInput); 530 kInvalidInput);
532 } 531 }
OLDNEW
« no previous file with comments | « src/codec/SkCodec.cpp ('k') | src/codec/SkCodec_libico.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698