Remove some more GrColor references
Bug: skia: Change-Id: I395395b1cd81a1d45ca779b2273015c8ed9fb882 Reviewed-on: https://skia-review.googlesource.com/c/168361 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
e70c6b13dd
commit
00b2939890
@ -11,10 +11,8 @@
|
||||
#ifndef GrColor_DEFINED
|
||||
#define GrColor_DEFINED
|
||||
|
||||
#include "GrTypes.h"
|
||||
#include "SkColor.h"
|
||||
#include "SkColorPriv.h"
|
||||
#include "SkUnPreMultiply.h"
|
||||
|
||||
/**
|
||||
* GrColor is 4 bytes for R, G, B, A, in a specific order defined below. Whether the color is
|
||||
@ -77,23 +75,6 @@ static inline GrColor GrColorPackA4(unsigned a) {
|
||||
#define GrColor_ILLEGAL (~(0xFF << GrColor_SHIFT_A))
|
||||
|
||||
#define GrColor_WHITE 0xFFFFFFFF
|
||||
#define GrColor_TRANSPARENT_BLACK 0x0
|
||||
|
||||
/**
|
||||
* Assert in debug builds that a GrColor is premultiplied.
|
||||
*/
|
||||
static inline void GrColorIsPMAssert(GrColor SkDEBUGCODE(c)) {
|
||||
#ifdef SK_DEBUG
|
||||
unsigned a = GrColorUnpackA(c);
|
||||
unsigned r = GrColorUnpackR(c);
|
||||
unsigned g = GrColorUnpackG(c);
|
||||
unsigned b = GrColorUnpackB(c);
|
||||
|
||||
SkASSERT(r <= a);
|
||||
SkASSERT(g <= a);
|
||||
SkASSERT(b <= a);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline GrColor GrColorMul(GrColor c0, GrColor c1) {
|
||||
U8CPU r = SkMulDiv255Round(GrColorUnpackR(c0), GrColorUnpackR(c1));
|
||||
@ -109,9 +90,4 @@ static inline float GrNormalizeByteToFloat(uint8_t value) {
|
||||
return value * ONE_OVER_255;
|
||||
}
|
||||
|
||||
/** Determines whether the color is opaque or not. */
|
||||
static inline bool GrColorIsOpaque(GrColor color) {
|
||||
return (color & (0xFFU << GrColor_SHIFT_A)) == (0xFFU << GrColor_SHIFT_A);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -50,11 +50,6 @@ public:
|
||||
void setColor4f(const SkPMColor4f& color) { fColor = color; }
|
||||
const SkPMColor4f& getColor4f() const { return fColor; }
|
||||
|
||||
/**
|
||||
* Legacy getter, until all code handles 4f directly.
|
||||
*/
|
||||
GrColor getColor() const { return fColor.toBytes_RGBA(); }
|
||||
|
||||
void setXPFactory(const GrXPFactory* xpFactory) {
|
||||
fXPFactory = xpFactory;
|
||||
fTrivial &= !SkToBool(xpFactory);
|
||||
|
@ -126,7 +126,6 @@ static inline GrColor GrRandomColor(SkRandom* random) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
GrColorIsPMAssert(color);
|
||||
return color;
|
||||
}
|
||||
|
||||
|
@ -400,12 +400,12 @@ static inline bool skpaint_to_grpaint_impl(GrContext* context,
|
||||
}
|
||||
|
||||
// We can ignore origColor here - alpha is unchanged by gamma
|
||||
GrColor paintAlpha = GrColorPackA4(skPaint.getAlpha());
|
||||
if (GrColor_WHITE != paintAlpha) {
|
||||
float paintAlpha = skPaint.getColor4f().fA;
|
||||
if (1.0f != paintAlpha) {
|
||||
// No gamut conversion - paintAlpha is a (linear) alpha value, splatted to all
|
||||
// color channels. It's value should be treated as the same in ANY color space.
|
||||
grPaint->addColorFragmentProcessor(GrConstColorProcessor::Make(
|
||||
SkPMColor4f::FromBytes_RGBA(paintAlpha),
|
||||
{ paintAlpha, paintAlpha, paintAlpha, paintAlpha },
|
||||
GrConstColorProcessor::InputMode::kModulateRGBA));
|
||||
}
|
||||
} else {
|
||||
@ -430,12 +430,12 @@ static inline bool skpaint_to_grpaint_impl(GrContext* context,
|
||||
grPaint->setColor4f(opaqueColor);
|
||||
|
||||
// We can ignore origColor here - alpha is unchanged by gamma
|
||||
GrColor paintAlpha = GrColorPackA4(skPaint.getAlpha());
|
||||
if (GrColor_WHITE != paintAlpha) {
|
||||
float paintAlpha = skPaint.getColor4f().fA;
|
||||
if (1.0f != paintAlpha) {
|
||||
// No gamut conversion - paintAlpha is a (linear) alpha value, splatted to all
|
||||
// color channels. It's value should be treated as the same in ANY color space.
|
||||
grPaint->addColorFragmentProcessor(GrConstColorProcessor::Make(
|
||||
SkPMColor4f::FromBytes_RGBA(paintAlpha),
|
||||
{ paintAlpha, paintAlpha, paintAlpha, paintAlpha },
|
||||
GrConstColorProcessor::InputMode::kModulateRGBA));
|
||||
}
|
||||
} else {
|
||||
|
@ -669,7 +669,7 @@ GR_DRAW_OP_TEST_DEFINE(ShadowRRectOp) {
|
||||
SkScalar blurWidth = random->nextSScalar1() * 72.f;
|
||||
bool isCircle = random->nextBool();
|
||||
// This op doesn't use a full GrPaint, just a color.
|
||||
GrColor color = paint.getColor();
|
||||
GrColor color = paint.getColor4f().toBytes_RGBA();
|
||||
if (isCircle) {
|
||||
SkRect circle = GrTest::TestSquare(random);
|
||||
SkRRect rrect = SkRRect::MakeOval(circle);
|
||||
|
@ -576,8 +576,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorOptimizationValidationTest, repor
|
||||
}
|
||||
}
|
||||
}
|
||||
if (GrColorIsOpaque(input) && fp->preservesOpaqueInput() &&
|
||||
!GrColorIsOpaque(output)) {
|
||||
if (input4f.isOpaque() && fp->preservesOpaqueInput() && !output4f.isOpaque()) {
|
||||
passing = false;
|
||||
|
||||
if (opaqueMessage.isEmpty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user