aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2017-05-24 15:27:46 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-24 19:52:05 +0000
commitaa13223f54d1f55ba702582f61359f8b43782730 (patch)
tree4474c8d48f039464c798768b3f03e13b39ed3d70
parent6fee59b514c5f7b7ff34d63b294759dd0c1d4858 (diff)
Allow for non opaque colors for src-over lcd fallback case in gpu
Since skia is currently requiring the dst to be opaque for lcd draws this change is safe to make in terms of correctly. It will also be faster than the current shader based blending. Bug: chromium:725879 Change-Id: I0c14b80eb5ab819500afc55030df83d5ddbef94a Reviewed-on: https://skia-review.googlesource.com/17840 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
-rw-r--r--src/gpu/effects/GrPorterDuffXferProcessor.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
index 834f3af950..9012d2028c 100644
--- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
@@ -801,7 +801,8 @@ static inline GrXPFactory::AnalysisProperties analysis_properties(
}
if (isLCD) {
- if (SkBlendMode::kSrcOver == mode && color.isConstant() && color.isOpaque() &&
+ // See comment in MakeSrcOverXferProcessor about color.isOpaque here
+ if (SkBlendMode::kSrcOver == mode && color.isConstant() && /*color.isOpaque() &&*/
!caps.shaderCaps()->dualSourceBlendingSupport() &&
!caps.shaderCaps()->dstReadInShaderSupport()) {
props |= AnalysisProperties::kIgnoresInputColor;
@@ -896,7 +897,15 @@ sk_sp<const GrXferProcessor> GrPorterDuffXPFactory::MakeSrcOverXferProcessor(
return nullptr;
}
- if (color.isConstant() && color.isOpaque() && !caps.shaderCaps()->dualSourceBlendingSupport() &&
+ // Currently up the stack Skia is requiring that the dst is opaque or that the client has said
+ // the opaqueness doesn't matter. Thus for src-over we don't need to worry about the src color
+ // being opaque or not. For now we disable the check for opaqueness, but in the future we should
+ // pass down the knowledge about dst opaqueness and make the correct decision here.
+ //
+ // This also fixes a chrome bug on macs where we are getting random fuzziness when doing
+ // blending in the shader for non opaque sources.
+ if (color.isConstant() && /*color.isOpaque() &&*/
+ !caps.shaderCaps()->dualSourceBlendingSupport() &&
!caps.shaderCaps()->dstReadInShaderSupport()) {
// If we don't have dual source blending or in shader dst reads, we fall
// back to this trick for rendering SrcOver LCD text instead of doing a