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

Unified Diff: src/image/SkImage.cpp

Issue 2250663002: Add alphaType() to SkImage (Closed) Base URL: https://skia.googlesource.com/skia.git@special-image-alpha-type
Patch Set: Remove virtuals from SkImage, slight cleanup Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkImage.h ('k') | src/image/SkImage_Base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkImage.cpp
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index b8c89645b2fed5409f5a8ecb7a9c531cb17d7da8..fa3580c175d978799649b9053f0ca8c81dadea92 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -106,6 +106,10 @@ void SkImage::preroll(GrContext* ctx) const {
///////////////////////////////////////////////////////////////////////////////////////////////////
+SkAlphaType SkImage::alphaType() const {
+ return as_IB(this)->onAlphaType();
+}
+
sk_sp<SkShader> SkImage::makeShader(SkShader::TileMode tileX, SkShader::TileMode tileY,
const SkMatrix* localMatrix) const {
return SkImageShader::Make(sk_ref_sp(const_cast<SkImage*>(this)), tileX, tileY, localMatrix);
@@ -320,7 +324,7 @@ bool SkImage_Base::onAsLegacyBitmap(SkBitmap* bitmap, LegacyBitmapMode mode) con
// As the base-class, all we can do is make a copy (regardless of mode).
// Subclasses that want to be more optimal should override.
SkImageInfo info = this->onImageInfo().makeColorType(kN32_SkColorType)
- .makeAlphaType(this->isOpaque() ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
+ .makeAlphaType(this->alphaType());
if (!bitmap->tryAllocPixels(info)) {
return false;
}
« no previous file with comments | « include/core/SkImage.h ('k') | src/image/SkImage_Base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698