aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-05 15:47:48 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-05 15:47:48 +0000
commita93f4e770f22f913197bef82dc19078e12bee76b (patch)
treea4d35e2b140ee6c1e5bcea1295c46f2448617718 /src
parent4faa869cdabbdcf4867118b4a1272296baaeeb52 (diff)
Check that Mode is valid for ModeColorFilterEffect
R=robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/53983005 git-svn-id: http://skia.googlecode.com/svn/trunk@12131 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/effects/SkColorFilters.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/effects/SkColorFilters.cpp b/src/effects/SkColorFilters.cpp
index 43478c834d..613163e5a6 100644
--- a/src/effects/SkColorFilters.cpp
+++ b/src/effects/SkColorFilters.cpp
@@ -186,6 +186,13 @@ static inline ColorExpr color_filter_expression(const SkXfermode::Mode& mode,
class ModeColorFilterEffect : public GrEffect {
public:
static GrEffectRef* Create(const GrColor& c, SkXfermode::Mode mode) {
+ // TODO: Make the effect take the coeffs rather than mode since we already do the
+ // conversion here.
+ SkXfermode::Coeff srcCoeff, dstCoeff;
+ if (!SkXfermode::ModeAsCoeff(mode, &srcCoeff, &dstCoeff)) {
+ SkDebugf("Failing to create color filter for mode %d\n", mode);
+ return NULL;
+ }
AutoEffectUnref effect(SkNEW_ARGS(ModeColorFilterEffect, (c, mode)));
return CreateEffectRef(effect);
}