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
This commit is contained in:
commit-bot@chromium.org 2013-10-24 13:29:38 +00:00
parent 83d8eda890
commit 23267ceca2

View File

@ -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<SkXfermode::Mode>(rand->nextRangeU(0, SkXfermode::kLastCoeffMode));
}
GrColor color = rand->nextU();
static AutoEffectUnref gEffect(SkNEW_ARGS(ModeColorFilterEffect, (color, static_cast<SkXfermode::Mode>(mode))));
return CreateEffectRef(gEffect);
return ModeColorFilterEffect::Create(color, mode);
}
GrEffectRef* SkModeColorFilter::asNewEffect(GrContext*) const {