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

Side by Side Diff: include/codec/SkCodec.h

Issue 1518743002: Add reallyHasAlpha() to SkAndroidCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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 #ifndef SkCodec_DEFINED 8 #ifndef SkCodec_DEFINED
9 #define SkCodec_DEFINED 9 #define SkCodec_DEFINED
10 10
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 virtual Result onGetPixels(const SkImageInfo& info, 479 virtual Result onGetPixels(const SkImageInfo& info,
480 void* pixels, size_t rowBytes, const Options&, 480 void* pixels, size_t rowBytes, const Options&,
481 SkPMColor ctable[], int* ctableCount, 481 SkPMColor ctable[], int* ctableCount,
482 int* rowsDecoded) = 0; 482 int* rowsDecoded) = 0;
483 483
484 virtual bool onGetValidSubset(SkIRect* /* desiredSubset */) const { 484 virtual bool onGetValidSubset(SkIRect* /* desiredSubset */) const {
485 // By default, subsets are not supported. 485 // By default, subsets are not supported.
486 return false; 486 return false;
487 } 487 }
488 488
489 virtual bool onReallyHasAlpha() const { return false; } 489 virtual bool onReallyHasAlpha() const {
490 // Opaque images never have alpha. If the image indicates that it
491 // does have alpha, by default, we will assume this to be true.
492 // Subclasses may override this function if they intend to verify
493 // that the image actually has alpha.
494 return kOpaque_SkAlphaType != this->getInfo().alphaType();
scroggo 2015/12/10 17:02:32 SkWebpCodec's implementation looks like this (and
msarett 2015/12/10 17:41:18 Yes I think so. Or we should make this pure virtu
scroggo 2015/12/10 18:29:42 Yeah, I think we have a note about that in skbug.c
495 }
490 496
491 /** 497 /**
492 * If the stream was previously read, attempt to rewind. 498 * If the stream was previously read, attempt to rewind.
493 * 499 *
494 * If the stream needed to be rewound, call onRewind. 500 * If the stream needed to be rewound, call onRewind.
495 * @returns true if the codec is at the right position and can be used. 501 * @returns true if the codec is at the right position and can be used.
496 * false if there was a failure to rewind. 502 * false if there was a failure to rewind.
497 * 503 *
498 * This is called by getPixels() and start(). Subclasses may call if they 504 * This is called by getPixels() and start(). Subclasses may call if they
499 * need to rewind at another time. 505 * need to rewind at another time.
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 * not affect ownership. 647 * not affect ownership.
642 * 648 *
643 * Only valid during scanline decoding. 649 * Only valid during scanline decoding.
644 */ 650 */
645 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr; } 651 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr; }
646 652
647 friend class SkSampledCodec; 653 friend class SkSampledCodec;
648 friend class SkIcoCodec; 654 friend class SkIcoCodec;
649 }; 655 };
650 #endif // SkCodec_DEFINED 656 #endif // SkCodec_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698