Retire SkShader::kSupports4f_Flag

No longer used except in one test.

Introduce kPrefers4f_Flag instead.

R=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1726983002

Review URL: https://codereview.chromium.org/1726983002
This commit is contained in:
fmalita 2016-02-23 19:02:20 -08:00 committed by Commit bot
parent 85a7a5fc6c
commit ca058f57a3
4 changed files with 7 additions and 9 deletions

View File

@ -82,7 +82,10 @@ public:
shadeSpan().
*/
kConstInY32_Flag = 1 << 1,
kSupports4f_Flag = 1 << 2,
/** hint for the blitter that 4f is the preferred shading mode.
*/
kPrefers4f_Flag = 1 << 2,
};
/**
@ -130,10 +133,6 @@ public:
*/
virtual uint32_t getFlags() const { return 0; }
bool supports4f() const {
return SkToBool(this->getFlags() & kSupports4f_Flag);
}
/**
* Called for each span of the object being drawn. Your subclass should
* set the appropriate colors (with premultiplied alpha) that correspond

View File

@ -298,7 +298,7 @@ SkColorShader::ColorShaderContext::ColorShaderContext(const SkColorShader& shade
c4.fA *= rec.fPaint->getAlpha() / 255.0f;
fPM4f = c4.premul();
fFlags = kConstInY32_Flag | kSupports4f_Flag;
fFlags = kConstInY32_Flag;
if (255 == a) {
fFlags |= kOpaqueAlpha_Flag;
}

View File

@ -63,7 +63,7 @@ SkGradientShaderBase::
GradientShaderBase4fContext::GradientShaderBase4fContext(const SkGradientShaderBase& shader,
const ContextRec& rec)
: INHERITED(shader, rec)
, fFlags(this->INHERITED::getFlags() | kSupports4f_Flag)
, fFlags(this->INHERITED::getFlags())
#ifdef SK_SUPPORT_LEGACY_GRADIENT_DITHERING
, fDither(true)
#else

View File

@ -157,8 +157,7 @@ DEF_TEST(Color4f_shader, reporter) {
SkShader::ContextRec::kPM4f_DstType);
SkASSERT(paint.getShader()->contextSize(contextRec) <= sizeof(storage));
SkShader::Context* ctx = paint.getShader()->createContext(contextRec, storage);
REPORTER_ASSERT(reporter, ctx->supports4f() == rec.fSupports4f);
if (ctx->supports4f()) {
if (rec.fSupports4f) {
const int N = 100;
SkPM4f buffer4f[N];
ctx->shadeSpan4f(0, 0, buffer4f, N);