Add generic factory function to GrFillRectOp
Bug: skia: Change-Id: Iaa56cdb8107dc278e585807ec10aeae53150b97a Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214720 Commit-Queue: Michael Ludwig <michaelludwig@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
3fdc05a334
commit
d9f917b563
@ -345,6 +345,17 @@ private:
|
||||
|
||||
namespace GrFillRectOp {
|
||||
|
||||
std::unique_ptr<GrDrawOp> MakeGeneric(GrRecordingContext* context,
|
||||
GrPaint&& paint,
|
||||
GrAAType aaType,
|
||||
GrQuadAAFlags aaFlags,
|
||||
const GrPerspQuad& deviceQuad,
|
||||
const GrPerspQuad& localQuad,
|
||||
const GrUserStencilSettings* stencil) {
|
||||
return FillRectOp::Make(context, std::move(paint), aaType, aaFlags, stencil,
|
||||
deviceQuad, localQuad);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrDrawOp> MakePerEdge(GrRecordingContext* context,
|
||||
GrPaint&& paint,
|
||||
GrAAType aaType,
|
||||
@ -352,8 +363,9 @@ std::unique_ptr<GrDrawOp> MakePerEdge(GrRecordingContext* context,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkRect& rect,
|
||||
const GrUserStencilSettings* stencilSettings) {
|
||||
return FillRectOp::Make(context, std::move(paint), aaType, edgeAA, stencilSettings,
|
||||
GrPerspQuad::MakeFromRect(rect, viewMatrix), GrPerspQuad(rect));
|
||||
return MakeGeneric(context, std::move(paint), aaType, edgeAA,
|
||||
GrPerspQuad::MakeFromRect(rect, viewMatrix),
|
||||
GrPerspQuad(rect), stencilSettings);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrDrawOp> MakePerEdgeWithLocalMatrix(GrRecordingContext* context,
|
||||
@ -364,9 +376,9 @@ std::unique_ptr<GrDrawOp> MakePerEdgeWithLocalMatrix(GrRecordingContext* context
|
||||
const SkMatrix& localMatrix,
|
||||
const SkRect& rect,
|
||||
const GrUserStencilSettings* stencilSettings) {
|
||||
return FillRectOp::Make(context, std::move(paint), aaType, edgeAA, stencilSettings,
|
||||
GrPerspQuad::MakeFromRect(rect, viewMatrix),
|
||||
GrPerspQuad::MakeFromRect(rect, localMatrix));
|
||||
return MakeGeneric(context, std::move(paint), aaType, edgeAA,
|
||||
GrPerspQuad::MakeFromRect(rect, viewMatrix),
|
||||
GrPerspQuad::MakeFromRect(rect, localMatrix), stencilSettings);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrDrawOp> MakePerEdgeWithLocalRect(GrRecordingContext* context,
|
||||
@ -377,8 +389,9 @@ std::unique_ptr<GrDrawOp> MakePerEdgeWithLocalRect(GrRecordingContext* context,
|
||||
const SkRect& rect,
|
||||
const SkRect& localRect,
|
||||
const GrUserStencilSettings* stencilSettings) {
|
||||
return FillRectOp::Make(context, std::move(paint), aaType, edgeAA, stencilSettings,
|
||||
GrPerspQuad::MakeFromRect(rect, viewMatrix), GrPerspQuad(localRect));
|
||||
return MakeGeneric(context, std::move(paint), aaType, edgeAA,
|
||||
GrPerspQuad::MakeFromRect(rect, viewMatrix),
|
||||
GrPerspQuad(localRect), stencilSettings);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrDrawOp> MakePerEdgeQuad(GrRecordingContext* context,
|
||||
@ -389,10 +402,10 @@ std::unique_ptr<GrDrawOp> MakePerEdgeQuad(GrRecordingContext* context,
|
||||
const SkPoint quad[4],
|
||||
const SkPoint localQuad[4],
|
||||
const GrUserStencilSettings* stencilSettings) {
|
||||
return FillRectOp::Make(context, std::move(paint), aaType, edgeAA, stencilSettings,
|
||||
GrPerspQuad::MakeFromSkQuad(quad, viewMatrix),
|
||||
GrPerspQuad::MakeFromSkQuad(localQuad ? localQuad : quad,
|
||||
SkMatrix::I()));
|
||||
const SkPoint* localPoints = localQuad ? localQuad : quad;
|
||||
return MakeGeneric(context, std::move(paint), aaType, edgeAA,
|
||||
GrPerspQuad::MakeFromSkQuad(quad, viewMatrix),
|
||||
GrPerspQuad::MakeFromSkQuad(localPoints, SkMatrix::I()), stencilSettings);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrDrawOp> MakeSet(GrRecordingContext* context,
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
class GrDrawOp;
|
||||
class GrPaint;
|
||||
class GrPerspQuad;
|
||||
class GrRecordingContext;
|
||||
struct GrUserStencilSettings;
|
||||
class SkMatrix;
|
||||
@ -26,6 +27,16 @@ struct SkRect;
|
||||
*/
|
||||
namespace GrFillRectOp {
|
||||
|
||||
// FIXME(michaelludwig) - To be renamed Make() after narrow functions are removed
|
||||
std::unique_ptr<GrDrawOp> MakeGeneric(GrRecordingContext* context,
|
||||
GrPaint&& paint,
|
||||
GrAAType aaType,
|
||||
GrQuadAAFlags aaFlags,
|
||||
const GrPerspQuad& deviceQuad,
|
||||
const GrPerspQuad& localQuad,
|
||||
const GrUserStencilSettings* stencil = nullptr);
|
||||
|
||||
// FIXME(michaelludwig) - To be removed after usages replaced with MakeGeneric
|
||||
// General purpose factory functions that handle per-edge anti-aliasing
|
||||
std::unique_ptr<GrDrawOp> MakePerEdge(GrRecordingContext* context,
|
||||
GrPaint&& paint,
|
||||
@ -35,6 +46,7 @@ std::unique_ptr<GrDrawOp> MakePerEdge(GrRecordingContext* context,
|
||||
const SkRect& rect,
|
||||
const GrUserStencilSettings* stencil = nullptr);
|
||||
|
||||
// FIXME(michaelludwig) - To be removed after usages replaced with MakeGeneric
|
||||
std::unique_ptr<GrDrawOp> MakePerEdgeWithLocalMatrix(GrRecordingContext* context,
|
||||
GrPaint&& paint,
|
||||
GrAAType aaType,
|
||||
@ -44,6 +56,7 @@ std::unique_ptr<GrDrawOp> MakePerEdgeWithLocalMatrix(GrRecordingContext* context
|
||||
const SkRect& rect,
|
||||
const GrUserStencilSettings* stl = nullptr);
|
||||
|
||||
// FIXME(michaelludwig) - To be removed after usages replaced with MakeGeneric
|
||||
std::unique_ptr<GrDrawOp> MakePerEdgeWithLocalRect(GrRecordingContext* context,
|
||||
GrPaint&& paint,
|
||||
GrAAType aaType,
|
||||
@ -55,6 +68,7 @@ std::unique_ptr<GrDrawOp> MakePerEdgeWithLocalRect(GrRecordingContext* context,
|
||||
|
||||
// Generalization that accepts 2D convex quads instead of just rectangles. If 'localQuad' is not
|
||||
// null, this is equivalent to the "WithLocalRect" versions. Quad arrays match SkRect::toQuad order.
|
||||
// FIXME(michaelludwig) - To be removed after usages replaced with MakeGeneric
|
||||
std::unique_ptr<GrDrawOp> MakePerEdgeQuad(GrRecordingContext* context,
|
||||
GrPaint&& paint,
|
||||
GrAAType aaType,
|
||||
@ -74,6 +88,7 @@ std::unique_ptr<GrDrawOp> MakeSet(GrRecordingContext* context,
|
||||
int quadCount,
|
||||
const GrUserStencilSettings* stencil = nullptr);
|
||||
|
||||
// FIXME(michaelludwig) - To be removed after usages replaced with MakeGeneric
|
||||
// Specializations where all edges are treated the same. If the aa type is coverage, then the
|
||||
// edges will be anti-aliased, otherwise per-edge AA will be disabled.
|
||||
std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context,
|
||||
@ -82,7 +97,7 @@ std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkRect& rect,
|
||||
const GrUserStencilSettings* stencil = nullptr);
|
||||
|
||||
// FIXME(michaelludwig) - To be removed after usages replaced with MakeGeneric
|
||||
std::unique_ptr<GrDrawOp> MakeWithLocalMatrix(GrRecordingContext* context,
|
||||
GrPaint&& paint,
|
||||
GrAAType aaType,
|
||||
@ -90,7 +105,7 @@ std::unique_ptr<GrDrawOp> MakeWithLocalMatrix(GrRecordingContext* context,
|
||||
const SkMatrix& localMatrix,
|
||||
const SkRect& rect,
|
||||
const GrUserStencilSettings* stencil = nullptr);
|
||||
|
||||
// FIXME(michaelludwig) - To be removed after usages replaced with MakeGeneric
|
||||
std::unique_ptr<GrDrawOp> MakeWithLocalRect(GrRecordingContext* context,
|
||||
GrPaint&& paint,
|
||||
GrAAType aaType,
|
||||
|
Loading…
Reference in New Issue
Block a user