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

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

Issue 1075243003: Implementing filling for SkBmpCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Sharing code in static helper Created 5 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/codec/SkCodec_libbmp.cpp ('k') | src/codec/SkSwizzler.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 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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 418
419 // Modify the destination info 419 // Modify the destination info
420 const SkImageInfo subsetDstInfo = 420 const SkImageInfo subsetDstInfo =
421 dstInfo.makeWH(innerWidth, innerHeight); 421 dstInfo.makeWH(innerWidth, innerHeight);
422 422
423 // Fill the destination with the fill color 423 // Fill the destination with the fill color
424 // FIXME: This may not be the behavior that we want for 424 // FIXME: This may not be the behavior that we want for
425 // animated gifs where we draw on top of the 425 // animated gifs where we draw on top of the
426 // previous frame. 426 // previous frame.
427 if (!skipBackground) { 427 if (!skipBackground) {
428 SkSwizzler::Fill(dst, dstInfo, dstRowBytes, 0, fillIndex , colorTable); 428 SkSwizzler::Fill(dst, dstInfo, dstRowBytes, height, fill Index, colorTable);
429 } 429 }
430 430
431 // Modify the dst pointer 431 // Modify the dst pointer
432 const int32_t dstBytesPerPixel = 432 const int32_t dstBytesPerPixel =
433 SkColorTypeBytesPerPixel(dstColorType); 433 SkColorTypeBytesPerPixel(dstColorType);
434 void* subsetDst = SkTAddOffset<void*>(dst, 434 void* subsetDst = SkTAddOffset<void*>(dst,
435 dstRowBytes * imageTop + 435 dstRowBytes * imageTop +
436 dstBytesPerPixel * imageLeft); 436 dstBytesPerPixel * imageLeft);
437 437
438 // Create the subset swizzler 438 // Create the subset swizzler
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 y, height - 1).c_str(), kIncompleteInput); 471 y, height - 1).c_str(), kIncompleteInput);
472 } 472 }
473 swizzler->next(buffer.get(), iter.nextY()); 473 swizzler->next(buffer.get(), iter.nextY());
474 } 474 }
475 } else { 475 } else {
476 // Standard mode 476 // Standard mode
477 for (int32_t y = 0; y < innerHeight; y++) { 477 for (int32_t y = 0; y < innerHeight; y++) {
478 if (GIF_ERROR == DGifGetLine(fGif, buffer.get(), 478 if (GIF_ERROR == DGifGetLine(fGif, buffer.get(),
479 innerWidth)) { 479 innerWidth)) {
480 if (!skipBackground) { 480 if (!skipBackground) {
481 SkSwizzler::Fill(dst, dstInfo, dstRowBytes, y, f illIndex, 481 SkSwizzler::Fill(swizzler->getDstRow(), dstInfo, dstRowBytes,
482 colorTable); 482 innerHeight - y, fillIndex, colorTable);
483 } 483 }
484 return gif_error(SkStringPrintf( 484 return gif_error(SkStringPrintf(
485 "Could not decode line %d of %d.\n", 485 "Could not decode line %d of %d.\n",
486 y, height - 1).c_str(), kIncompleteInput); 486 y, height - 1).c_str(), kIncompleteInput);
487 } 487 }
488 swizzler->next(buffer.get()); 488 swizzler->next(buffer.get());
489 } 489 }
490 } 490 }
491 491
492 // FIXME: Gif files may have multiple images stored in a single 492 // FIXME: Gif files may have multiple images stored in a single
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 // giflib returns an error code if the record type is not known. 562 // giflib returns an error code if the record type is not known.
563 // We should catch this error immediately. 563 // We should catch this error immediately.
564 SkASSERT(false); 564 SkASSERT(false);
565 break; 565 break;
566 } 566 }
567 } while (TERMINATE_RECORD_TYPE != recordType); 567 } while (TERMINATE_RECORD_TYPE != recordType);
568 568
569 return gif_error("Could not find any images to decode in gif file.\n", 569 return gif_error("Could not find any images to decode in gif file.\n",
570 kInvalidInput); 570 kInvalidInput);
571 } 571 }
OLDNEW
« no previous file with comments | « src/codec/SkCodec_libbmp.cpp ('k') | src/codec/SkSwizzler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698