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

Unified Diff: src/core/SkBitmapProcShader.cpp

Issue 2030953002: Add the ability to handle premul and swizzle src bitmap data. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapProcShader.cpp
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
index a372b5199041d9c608d608ecac302ae8f24aced6..f88729e30512f1c219a45ec27c300c4263546252 100644
--- a/src/core/SkBitmapProcShader.cpp
+++ b/src/core/SkBitmapProcShader.cpp
@@ -205,7 +205,10 @@ private:
static bool choose_linear_pipeline(const SkShader::ContextRec& rec, const SkImageInfo& srcInfo) {
// If we get here, we can reasonably use either context, respect the caller's preference
//
- return SkShader::ContextRec::kPM4f_DstType == rec.fPreferredDstType;
+ bool needsPremul = srcInfo.alphaType() == kUnpremul_SkAlphaType;
+ bool needsSwizzle = srcInfo.bytesPerPixel() == 4 && srcInfo.colorType() != kN32_SkColorType;
+ return SkShader::ContextRec::kPM4f_DstType == rec.fPreferredDstType
+ || needsPremul || needsSwizzle;
}
size_t SkBitmapProcShader::ContextSize(const ContextRec& rec, const SkImageInfo& srcInfo) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698