Replace GrColor4h with SkPMColor4f
- Mechanical replacement of GrColor4h (used throughout Ops) with
SkPMColor4f.
- API adaptation (to/FromGrColor -> to/From_BytesRGBA).
- Complete removal of FromFloats (source was already SkPMColor4f),
and toFloats (setting uniforms can directly access .vec()).
Bug: skia:
Change-Id: I37eece1fa7ed2545dc6843e840d4cc3c60f19747
Reviewed-on: https://skia-review.googlesource.com/c/166620
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/ccpr/GrCCDrawPathsOp.cpp b/src/gpu/ccpr/GrCCDrawPathsOp.cpp
index 0fc321d..0f3aef5 100644
--- a/src/gpu/ccpr/GrCCDrawPathsOp.cpp
+++ b/src/gpu/ccpr/GrCCDrawPathsOp.cpp
@@ -120,7 +120,7 @@
: GrDrawOp(ClassID())
, fViewMatrixIfUsingLocalCoords(has_coord_transforms(paint) ? m : SkMatrix::I())
, fDraws(m, shape, strokeDevWidth, shapeConservativeIBounds, maskDevIBounds, maskVisibility,
- GrColor4h::FromFloats(paint.getColor4f().vec()))
+ paint.getColor4f())
, fProcessors(std::move(paint)) { // Paint must be moved after fetching its color above.
SkDEBUGCODE(fBaseInstance = -1);
// FIXME: intersect with clip bounds to (hopefully) improve batching.
@@ -139,7 +139,7 @@
float strokeDevWidth,
const SkIRect& shapeConservativeIBounds,
const SkIRect& maskDevIBounds, Visibility maskVisibility,
- const GrColor4h& color)
+ const SkPMColor4f& color)
: fMatrix(m)
, fShape(shape)
, fStrokeDevWidth(strokeDevWidth)
@@ -199,8 +199,8 @@
// TODO4F: Preserve float colors
// fShapeConservativeIBounds already accounted for this possibility of inflating the stroke.
- draw->fColor = GrColor4h::FromGrColor(
- GrColorMul(draw->fColor.toGrColor(), coverageAsAlpha));
+ draw->fColor = SkPMColor4f::FromBytes_RGBA(
+ GrColorMul(draw->fColor.toBytes_RGBA(), coverageAsAlpha));
}
return RequiresDstTexture(analysis.requiresDstTexture());
@@ -327,7 +327,7 @@
this->recordInstance(proxy, resources->nextPathInstanceIdx());
// TODO4F: Preserve float colors
resources->appendDrawPathInstance().set(*cacheEntry, draw.fCachedMaskShift,
- draw.fColor.toGrColor());
+ draw.fColor.toBytes_RGBA());
continue;
}
@@ -337,7 +337,7 @@
this->recordInstance(atlas->textureProxy(), resources->nextPathInstanceIdx());
// TODO4F: Preserve float colors
resources->appendDrawPathInstance().set(
- *cacheEntry, draw.fCachedMaskShift, draw.fColor.toGrColor(),
+ *cacheEntry, draw.fCachedMaskShift, draw.fColor.toBytes_RGBA(),
cacheEntry->hasCachedAtlas() ? DoEvenOddFill::kNo : doEvenOddFill);
continue;
}
@@ -355,7 +355,7 @@
this->recordInstance(atlas->textureProxy(), resources->nextPathInstanceIdx());
// TODO4F: Preserve float colors
resources->appendDrawPathInstance().set(*cacheEntry, draw.fCachedMaskShift,
- draw.fColor.toGrColor());
+ draw.fColor.toBytes_RGBA());
// Remember this atlas in case we encounter the path again during the same flush.
cacheEntry->setCurrFlushAtlas(atlas);
continue;
@@ -376,7 +376,7 @@
this->recordInstance(atlas->textureProxy(), resources->nextPathInstanceIdx());
// TODO4F: Preserve float colors
resources->appendDrawPathInstance().set(devBounds, devBounds45, devToAtlasOffset,
- draw.fColor.toGrColor(), doEvenOddFill);
+ draw.fColor.toBytes_RGBA(), doEvenOddFill);
// If we have a spot in the path cache, try to make a note of where this mask is so we
// can reuse it in the future.