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

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

Issue 1037793002: C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: git cl web Created 5 years, 9 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_libpng.h ('k') | src/core/SkAAClip.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_libpng.h" 8 #include "SkCodec_libpng.h"
9 #include "SkCodecPriv.h" 9 #include "SkCodecPriv.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 public: 496 public:
497 SkPngScanlineDecoder(const SkImageInfo& dstInfo, SkPngCodec* codec) 497 SkPngScanlineDecoder(const SkImageInfo& dstInfo, SkPngCodec* codec)
498 : INHERITED(dstInfo) 498 : INHERITED(dstInfo)
499 , fCodec(codec) 499 , fCodec(codec)
500 , fHasAlpha(false) 500 , fHasAlpha(false)
501 { 501 {
502 fStorage.reset(dstInfo.width() * SkSwizzler::BytesPerPixel(fCodec->fSrcC onfig)); 502 fStorage.reset(dstInfo.width() * SkSwizzler::BytesPerPixel(fCodec->fSrcC onfig));
503 fSrcRow = static_cast<uint8_t*>(fStorage.get()); 503 fSrcRow = static_cast<uint8_t*>(fStorage.get());
504 } 504 }
505 505
506 SkImageGenerator::Result onGetScanlines(void* dst, int count, size_t rowByte s) SK_OVERRIDE { 506 SkImageGenerator::Result onGetScanlines(void* dst, int count, size_t rowByte s) override {
507 if (setjmp(png_jmpbuf(fCodec->fPng_ptr))) { 507 if (setjmp(png_jmpbuf(fCodec->fPng_ptr))) {
508 SkDebugf("setjmp long jump!\n"); 508 SkDebugf("setjmp long jump!\n");
509 return SkImageGenerator::kInvalidInput; 509 return SkImageGenerator::kInvalidInput;
510 } 510 }
511 511
512 for (int i = 0; i < count; i++) { 512 for (int i = 0; i < count; i++) {
513 png_read_rows(fCodec->fPng_ptr, &fSrcRow, png_bytepp_NULL, 1); 513 png_read_rows(fCodec->fPng_ptr, &fSrcRow, png_bytepp_NULL, 1);
514 fCodec->fSwizzler->setDstRow(dst); 514 fCodec->fSwizzler->setDstRow(dst);
515 fHasAlpha |= !SkSwizzler::IsOpaque(fCodec->fSwizzler->next(fSrcRow)) ; 515 fHasAlpha |= !SkSwizzler::IsOpaque(fCodec->fSwizzler->next(fSrcRow)) ;
516 dst = SkTAddOffset<void>(dst, rowBytes); 516 dst = SkTAddOffset<void>(dst, rowBytes);
517 } 517 }
518 return SkImageGenerator::kSuccess; 518 return SkImageGenerator::kSuccess;
519 } 519 }
520 520
521 SkImageGenerator::Result onSkipScanlines(int count) SK_OVERRIDE { 521 SkImageGenerator::Result onSkipScanlines(int count) override {
522 // FIXME: Could we use the return value of setjmp to specify the type of 522 // FIXME: Could we use the return value of setjmp to specify the type of
523 // error? 523 // error?
524 if (setjmp(png_jmpbuf(fCodec->fPng_ptr))) { 524 if (setjmp(png_jmpbuf(fCodec->fPng_ptr))) {
525 SkDebugf("setjmp long jump!\n"); 525 SkDebugf("setjmp long jump!\n");
526 return SkImageGenerator::kInvalidInput; 526 return SkImageGenerator::kInvalidInput;
527 } 527 }
528 528
529 png_read_rows(fCodec->fPng_ptr, png_bytepp_NULL, png_bytepp_NULL, count) ; 529 png_read_rows(fCodec->fPng_ptr, png_bytepp_NULL, png_bytepp_NULL, count) ;
530 return SkImageGenerator::kSuccess; 530 return SkImageGenerator::kSuccess;
531 } 531 }
532 532
533 void onFinish() SK_OVERRIDE { 533 void onFinish() override {
534 fCodec->finish(); 534 fCodec->finish();
535 } 535 }
536 536
537 bool onReallyHasAlpha() const SK_OVERRIDE { return fHasAlpha; } 537 bool onReallyHasAlpha() const override { return fHasAlpha; }
538 538
539 private: 539 private:
540 SkPngCodec* fCodec; // Unowned. 540 SkPngCodec* fCodec; // Unowned.
541 bool fHasAlpha; 541 bool fHasAlpha;
542 SkAutoMalloc fStorage; 542 SkAutoMalloc fStorage;
543 uint8_t* fSrcRow; 543 uint8_t* fSrcRow;
544 544
545 typedef SkScanlineDecoder INHERITED; 545 typedef SkScanlineDecoder INHERITED;
546 }; 546 };
547 547
(...skipping 21 matching lines...) Expand all
569 569
570 SkASSERT(fNumberPasses != INVALID_NUMBER_PASSES); 570 SkASSERT(fNumberPasses != INVALID_NUMBER_PASSES);
571 if (fNumberPasses > 1) { 571 if (fNumberPasses > 1) {
572 // We cannot efficiently do scanline decoding. 572 // We cannot efficiently do scanline decoding.
573 return NULL; 573 return NULL;
574 } 574 }
575 575
576 return SkNEW_ARGS(SkPngScanlineDecoder, (dstInfo, this)); 576 return SkNEW_ARGS(SkPngScanlineDecoder, (dstInfo, this));
577 } 577 }
578 578
OLDNEW
« no previous file with comments | « src/codec/SkCodec_libpng.h ('k') | src/core/SkAAClip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698