From 23267ceca27aab4c29271e9ecd5ee5a87740ffb9 Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Thu, 24 Oct 2013 13:29:38 +0000 Subject: [PATCH] Fix ModeColorFilterEffect assert during GLProgramsTest Select random filter mode for the test-case until the mode is not Dst. SkModeColorFilter with Dst mode will not create a ModeColorFilterEffect, and thus the case is not implemented. Also changes it so that each call to ModeColorFilterEffect::TestCreate creates a new GrEffect. Previously only one static effect was ever created, due to copy-paste error. R=bsalomon@google.com Author: kkinnunen@nvidia.com Review URL: https://codereview.chromium.org/39403002 git-svn-id: http://skia.googlecode.com/svn/trunk@11938 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/effects/SkColorFilters.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/effects/SkColorFilters.cpp b/src/effects/SkColorFilters.cpp index d53e20cf06..43478c834d 100644 --- a/src/effects/SkColorFilters.cpp +++ b/src/effects/SkColorFilters.cpp @@ -392,10 +392,12 @@ GrEffectRef* ModeColorFilterEffect::TestCreate(SkRandom* rand, GrContext*, const GrDrawTargetCaps&, GrTexture*[]) { - int mode = rand->nextRangeU(0, SkXfermode::kLastCoeffMode); + SkXfermode::Mode mode = SkXfermode::kDst_Mode; + while (SkXfermode::kDst_Mode == mode) { + mode = static_cast(rand->nextRangeU(0, SkXfermode::kLastCoeffMode)); + } GrColor color = rand->nextU(); - static AutoEffectUnref gEffect(SkNEW_ARGS(ModeColorFilterEffect, (color, static_cast(mode)))); - return CreateEffectRef(gEffect); + return ModeColorFilterEffect::Create(color, mode); } GrEffectRef* SkModeColorFilter::asNewEffect(GrContext*) const {