Move more Ops to skgpu::v1 namespace
GrFillRRectOp
GrFillRectOp
Bug: skia:11837
Change-Id: Icdecc2ccd9def659b0d9402910b2072e02577a66
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444817
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/bench/ImageCycleBench.cpp b/bench/ImageCycleBench.cpp
index 00cde3e..16322c0 100644
--- a/bench/ImageCycleBench.cpp
+++ b/bench/ImageCycleBench.cpp
@@ -16,7 +16,7 @@
/**
* Draws a small set of small images multiple times each with no overlaps so that each image could
- * be batched. This was originally added to detect regressions as GrTextureOp is refactored to
+ * be batched. This was originally added to detect regressions as TextureOp is refactored to
* use "dynamic state" for texture bindings. Everything is kept small as we're mostly interested in
* CPU overhead.
*/
diff --git a/gm/bigrrectaaeffect.cpp b/gm/bigrrectaaeffect.cpp
index 19e8fab..5ea95a4 100644
--- a/gm/bigrrectaaeffect.cpp
+++ b/gm/bigrrectaaeffect.cpp
@@ -24,8 +24,8 @@
#include "src/gpu/GrPaint.h"
#include "src/gpu/effects/GrPorterDuffXferProcessor.h"
#include "src/gpu/effects/GrRRectEffect.h"
+#include "src/gpu/ops/FillRectOp.h"
#include "src/gpu/ops/GrDrawOp.h"
-#include "src/gpu/ops/GrFillRectOp.h"
#include "src/gpu/v1/SurfaceDrawContext_v1.h"
#include "tools/ToolUtils.h"
@@ -105,7 +105,7 @@
SkRect bounds = testBounds;
bounds.offset(SkIntToScalar(x), SkIntToScalar(y));
- sdc->addDrawOp(GrFillRectOp::MakeNonAARect(
+ sdc->addDrawOp(skgpu::v1::FillRectOp::MakeNonAARect(
rContext, std::move(grPaint), SkMatrix::I(), bounds));
}
canvas->restore();
diff --git a/gm/crbug_224618.cpp b/gm/crbug_224618.cpp
index 0d3848b..9cdd32e 100644
--- a/gm/crbug_224618.cpp
+++ b/gm/crbug_224618.cpp
@@ -94,10 +94,10 @@
fillPaint.setAntiAlias(true);
fillPaint.setColor(faceColors[i]);
- // Leverages GrFillRectOp on GPU backend
+ // Leverages FillRectOp on GPU backend
canvas->drawRect(SkRect::MakeWH(viewportWidth, viewportWidth), fillPaint);
- // Leverages GrTextureOp on GPU backend, to ensure sure both quad paths handle clipping
+ // Leverages TextureOp on GPU backend, to ensure sure both quad paths handle clipping
canvas->drawImageRect(fCubeImage.get(),
SkRect::MakeWH(fCubeImage->width(), fCubeImage->height()),
SkRect::MakeWH(viewportWidth, viewportWidth),
diff --git a/gm/rrects.cpp b/gm/rrects.cpp
index 5ea219d..e056b7a 100644
--- a/gm/rrects.cpp
+++ b/gm/rrects.cpp
@@ -25,8 +25,8 @@
#include "src/gpu/GrPaint.h"
#include "src/gpu/effects/GrPorterDuffXferProcessor.h"
#include "src/gpu/effects/GrRRectEffect.h"
+#include "src/gpu/ops/FillRectOp.h"
#include "src/gpu/ops/GrDrawOp.h"
-#include "src/gpu/ops/GrFillRectOp.h"
#include "src/gpu/v1/SurfaceDrawContext_v1.h"
#include <memory>
@@ -135,7 +135,7 @@
SkRect bounds = rrect.getBounds();
bounds.outset(2.f, 2.f);
- sdc->addDrawOp(GrFillRectOp::MakeNonAARect(
+ sdc->addDrawOp(skgpu::v1::FillRectOp::MakeNonAARect(
rContext, std::move(grPaint), SkMatrix::I(), bounds));
} else {
drew = false;
diff --git a/gn/gpu.gni b/gn/gpu.gni
index 528d087..3c51832 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -521,15 +521,15 @@
"$_src/gpu/ops/DrawVerticesOp.h",
"$_src/gpu/ops/DrawableOp.cpp",
"$_src/gpu/ops/DrawableOp.h",
+ "$_src/gpu/ops/FillRRectOp.cpp",
+ "$_src/gpu/ops/FillRRectOp.h",
+ "$_src/gpu/ops/FillRectOp.cpp",
+ "$_src/gpu/ops/FillRectOp.h",
"$_src/gpu/ops/GrAtlasInstancedHelper.cpp",
"$_src/gpu/ops/GrAtlasInstancedHelper.h",
"$_src/gpu/ops/GrDrawAtlasPathOp.cpp",
"$_src/gpu/ops/GrDrawAtlasPathOp.h",
"$_src/gpu/ops/GrDrawOp.h",
- "$_src/gpu/ops/GrFillRRectOp.cpp",
- "$_src/gpu/ops/GrFillRRectOp.h",
- "$_src/gpu/ops/GrFillRectOp.cpp",
- "$_src/gpu/ops/GrFillRectOp.h",
"$_src/gpu/ops/GrLatticeOp.cpp",
"$_src/gpu/ops/GrLatticeOp.h",
"$_src/gpu/ops/GrMeshDrawOp.cpp",
diff --git a/src/gpu/GrOpsTypes.h b/src/gpu/GrOpsTypes.h
index 761ed56..f692841 100644
--- a/src/gpu/GrOpsTypes.h
+++ b/src/gpu/GrOpsTypes.h
@@ -14,7 +14,7 @@
#include "include/private/SkColorData.h"
#include "src/gpu/GrSurfaceProxyView.h"
-/** Used by SDC::drawQuadSet and GrFillRectOp */
+/** Used by SDC::drawQuadSet and FillRectOp */
struct GrQuadSetEntry {
SkRect fRect;
SkPMColor4f fColor; // Overrides any color on the GrPaint
@@ -22,7 +22,7 @@
GrQuadAAFlags fAAFlags;
};
-/** Used by SDC::drawTextureSet and GrTextureOp */
+/** Used by SDC::drawTextureSet and TextureOp */
struct GrTextureSetEntry {
GrSurfaceProxyView fProxyView;
SkAlphaType fSrcAlphaType;
diff --git a/src/gpu/ops/AtlasRenderTask.cpp b/src/gpu/ops/AtlasRenderTask.cpp
index e1336fa..e05908e 100644
--- a/src/gpu/ops/AtlasRenderTask.cpp
+++ b/src/gpu/ops/AtlasRenderTask.cpp
@@ -12,7 +12,7 @@
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrOpFlushState.h"
#include "src/gpu/GrOpsTypes.h"
-#include "src/gpu/ops/GrFillRectOp.h"
+#include "src/gpu/ops/FillRectOp.h"
#include "src/gpu/ops/PathStencilCoverOp.h"
namespace skgpu::v1 {
@@ -154,7 +154,7 @@
paint.setXPFactory(SkBlendMode_AsXPFactory(SkBlendMode::kSrc));
GrQuad quad(rect);
DrawQuad drawQuad{quad, quad, GrQuadAAFlags::kAll};
- auto op = GrFillRectOp::Make(rContext, std::move(paint), GrAAType::kMSAA, &drawQuad, stencil);
+ auto op = FillRectOp::Make(rContext, std::move(paint), GrAAType::kMSAA, &drawQuad, stencil);
this->addAtlasDrawOp(std::move(op), *rContext->priv().caps());
}
diff --git a/src/gpu/ops/GrFillRRectOp.cpp b/src/gpu/ops/FillRRectOp.cpp
similarity index 86%
rename from src/gpu/ops/GrFillRRectOp.cpp
rename to src/gpu/ops/FillRRectOp.cpp
index eb89aaa..613f7f7 100644
--- a/src/gpu/ops/GrFillRRectOp.cpp
+++ b/src/gpu/ops/FillRRectOp.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-#include "src/gpu/ops/GrFillRRectOp.h"
+#include "src/gpu/ops/FillRRectOp.h"
#include "include/gpu/GrRecordingContext.h"
#include "src/core/SkRRectPriv.h"
@@ -28,7 +28,7 @@
namespace {
-class FillRRectOp : public GrMeshDrawOp {
+class FillRRectOpImpl final : public GrMeshDrawOp {
private:
using Helper = GrSimpleMeshDrawOpHelper;
@@ -43,9 +43,9 @@
const SkRect& localRect,
GrAA);
- const char* name() const final { return "GrFillRRectOp"; }
+ const char* name() const override { return "FillRRectOp"; }
- FixedFunctionFlags fixedFunctionFlags() const final { return fHelper.fixedFunctionFlags(); }
+ FixedFunctionFlags fixedFunctionFlags() const override { return fHelper.fixedFunctionFlags(); }
ClipResult clipToShape(skgpu::v1::SurfaceDrawContext*,
SkClipOp,
@@ -53,8 +53,8 @@
const GrShape&,
GrAA) override;
- GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*, GrClampType) final;
- CombineResult onCombineIfPossible(GrOp*, SkArenaAlloc*, const GrCaps&) final;
+ GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*, GrClampType) override;
+ CombineResult onCombineIfPossible(GrOp*, SkArenaAlloc*, const GrCaps&) override;
void visitProxies(const GrVisitProxyFunc& func) const override {
if (fProgramInfo) {
@@ -64,9 +64,9 @@
}
}
- void onPrepareDraws(GrMeshDrawTarget*) final;
+ void onPrepareDraws(GrMeshDrawTarget*) override;
- void onExecute(GrOpFlushState*, const SkRect& chainBounds) final;
+ void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
private:
friend class ::GrSimpleMeshDrawOpHelper; // for access to ctor
@@ -86,15 +86,15 @@
class Processor;
- FillRRectOp(GrProcessorSet*,
- const SkPMColor4f& paintColor,
- SkArenaAlloc*,
- const SkMatrix& viewMatrix,
- const SkRRect&,
- const SkRect& localRect,
- ProcessorFlags);
+ FillRRectOpImpl(GrProcessorSet*,
+ const SkPMColor4f& paintColor,
+ SkArenaAlloc*,
+ const SkMatrix& viewMatrix,
+ const SkRRect&,
+ const SkRect& localRect,
+ ProcessorFlags);
- GrProgramInfo* programInfo() final { return fProgramInfo; }
+ GrProgramInfo* programInfo() override { return fProgramInfo; }
// Create a GrProgramInfo object in the provided arena
void onCreateProgramInfo(const GrCaps*,
@@ -104,7 +104,7 @@
GrAppliedClip&&,
const GrDstProxyView&,
GrXferBarrierFlags renderPassXferBarriers,
- GrLoadOp colorLoadOp) final;
+ GrLoadOp colorLoadOp) override;
Helper fHelper;
ProcessorFlags fProcessorFlags;
@@ -132,25 +132,23 @@
// If this op is prePrepared the created programInfo will be stored here for use in
// onExecute. In the prePrepared case it will have been stored in the record-time arena.
GrProgramInfo* fProgramInfo = nullptr;
-
- using INHERITED = GrMeshDrawOp;
};
-GR_MAKE_BITFIELD_CLASS_OPS(FillRRectOp::ProcessorFlags)
+GR_MAKE_BITFIELD_CLASS_OPS(FillRRectOpImpl::ProcessorFlags)
// Hardware derivatives are not always accurate enough for highly elliptical corners. This method
// checks to make sure the corners will still all look good if we use HW derivatives.
-static bool can_use_hw_derivatives_with_coverage(const GrShaderCaps&,
- const SkMatrix&,
- const SkRRect&);
+bool can_use_hw_derivatives_with_coverage(const GrShaderCaps&,
+ const SkMatrix&,
+ const SkRRect&);
-GrOp::Owner FillRRectOp::Make(GrRecordingContext* ctx,
- SkArenaAlloc* arena,
- GrPaint&& paint,
- const SkMatrix& viewMatrix,
- const SkRRect& rrect,
- const SkRect& localRect,
- GrAA aa) {
+GrOp::Owner FillRRectOpImpl::Make(GrRecordingContext* ctx,
+ SkArenaAlloc* arena,
+ GrPaint&& paint,
+ const SkMatrix& viewMatrix,
+ const SkRRect& rrect,
+ const SkRect& localRect,
+ GrAA aa) {
const GrCaps* caps = ctx->priv().caps();
if (!caps->drawInstancedSupport()) {
@@ -179,18 +177,18 @@
flags |= ProcessorFlags::kFakeNonAA;
}
- return Helper::FactoryHelper<FillRRectOp>(ctx, std::move(paint), arena, viewMatrix, rrect,
- localRect, flags);
+ return Helper::FactoryHelper<FillRRectOpImpl>(ctx, std::move(paint), arena, viewMatrix, rrect,
+ localRect, flags);
}
-FillRRectOp::FillRRectOp(GrProcessorSet* processorSet,
- const SkPMColor4f& paintColor,
- SkArenaAlloc* arena,
- const SkMatrix& viewMatrix,
- const SkRRect& rrect,
- const SkRect& localRect,
- ProcessorFlags processorFlags)
- : INHERITED(ClassID())
+FillRRectOpImpl::FillRRectOpImpl(GrProcessorSet* processorSet,
+ const SkPMColor4f& paintColor,
+ SkArenaAlloc* arena,
+ const SkMatrix& viewMatrix,
+ const SkRRect& rrect,
+ const SkRect& localRect,
+ ProcessorFlags processorFlags)
+ : GrMeshDrawOp(ClassID())
, fHelper(processorSet,
(processorFlags & ProcessorFlags::kFakeNonAA)
? GrAAType::kNone
@@ -207,9 +205,11 @@
GrOp::IsHairline::kNo);
}
-GrDrawOp::ClipResult FillRRectOp::clipToShape(skgpu::v1::SurfaceDrawContext* sdc, SkClipOp clipOp,
- const SkMatrix& clipMatrix, const GrShape& shape,
- GrAA aa) {
+GrDrawOp::ClipResult FillRRectOpImpl::clipToShape(skgpu::v1::SurfaceDrawContext* sdc,
+ SkClipOp clipOp,
+ const SkMatrix& clipMatrix,
+ const GrShape& shape,
+ GrAA aa) {
SkASSERT(fInstanceCount == 1); // This needs to be called before combining.
SkASSERT(fHeadInstance->fNext == nullptr);
@@ -296,8 +296,8 @@
return ClipResult::kFail;
}
-GrProcessorSet::Analysis FillRRectOp::finalize(const GrCaps& caps, const GrAppliedClip* clip,
- GrClampType clampType) {
+GrProcessorSet::Analysis FillRRectOpImpl::finalize(const GrCaps& caps, const GrAppliedClip* clip,
+ GrClampType clampType) {
SkASSERT(fInstanceCount == 1);
SkASSERT(fHeadInstance->fNext == nullptr);
@@ -314,20 +314,22 @@
return analysis;
}
-GrOp::CombineResult FillRRectOp::onCombineIfPossible(GrOp* op, SkArenaAlloc*, const GrCaps& caps) {
- const auto& that = *op->cast<FillRRectOp>();
- if (!fHelper.isCompatible(that.fHelper, caps, this->bounds(), that.bounds()) ||
- fProcessorFlags != that.fProcessorFlags) {
+GrOp::CombineResult FillRRectOpImpl::onCombineIfPossible(GrOp* op,
+ SkArenaAlloc*,
+ const GrCaps& caps) {
+ auto that = op->cast<FillRRectOpImpl>();
+ if (!fHelper.isCompatible(that->fHelper, caps, this->bounds(), that->bounds()) ||
+ fProcessorFlags != that->fProcessorFlags) {
return CombineResult::kCannotCombine;
}
- *fTailInstance = that.fHeadInstance;
- fTailInstance = that.fTailInstance;
- fInstanceCount += that.fInstanceCount;
+ *fTailInstance = that->fHeadInstance;
+ fTailInstance = that->fTailInstance;
+ fInstanceCount += that->fInstanceCount;
return CombineResult::kMerged;
}
-class FillRRectOp::Processor : public GrGeometryProcessor {
+class FillRRectOpImpl::Processor final : public GrGeometryProcessor {
public:
static GrGeometryProcessor* Make(SkArenaAlloc* arena, GrAAType aaType, ProcessorFlags flags) {
return arena->make([&](void* ptr) {
@@ -335,19 +337,19 @@
});
}
- const char* name() const final { return "GrFillRRectOp::Processor"; }
+ const char* name() const override { return "FillRRectOp::Processor"; }
- void addToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const final {
+ void addToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override {
b->addBits(kNumProcessorFlags, (uint32_t)fFlags, "flags");
}
- std::unique_ptr<ProgramImpl> makeProgramImpl(const GrShaderCaps&) const final;
+ std::unique_ptr<ProgramImpl> makeProgramImpl(const GrShaderCaps&) const override;
private:
class Impl;
Processor(GrAAType aaType, ProcessorFlags flags)
- : INHERITED(kGrFillRRectOp_Processor_ClassID)
+ : GrGeometryProcessor(kGrFillRRectOp_Processor_ClassID)
, fFlags(flags) {
this->setVertexAttributes(kVertexAttribs, SK_ARRAY_COUNT(kVertexAttribs));
@@ -376,11 +378,9 @@
constexpr static int kMaxInstanceAttribs = 6;
SkSTArray<kMaxInstanceAttribs, Attribute> fInstanceAttribs;
const Attribute* fColorAttrib;
-
- using INHERITED = GrGeometryProcessor;
};
-constexpr GrGeometryProcessor::Attribute FillRRectOp::Processor::kVertexAttribs[];
+constexpr GrGeometryProcessor::Attribute FillRRectOpImpl::Processor::kVertexAttribs[];
// Our coverage geometry consists of an inset octagon with solid coverage, surrounded by linear
// coverage ramps on the horizontal and vertical edges, and "arc coverage" pieces on the diagonal
@@ -510,7 +510,7 @@
GR_DECLARE_STATIC_UNIQUE_KEY(gIndexBufferKey);
-void FillRRectOp::onPrepareDraws(GrMeshDrawTarget* target) {
+void FillRRectOpImpl::onPrepareDraws(GrMeshDrawTarget* target) {
if (!fProgramInfo) {
this->createProgramInfo(target);
}
@@ -562,7 +562,7 @@
gVertexBufferKey);
}
-class FillRRectOp::Processor::Impl : public ProgramImpl {
+class FillRRectOpImpl::Processor::Impl : public ProgramImpl {
public:
void setData(const GrGLSLProgramDataManager&,
const GrShaderCaps&,
@@ -756,19 +756,19 @@
}
};
-std::unique_ptr<GrGeometryProcessor::ProgramImpl> FillRRectOp::Processor::makeProgramImpl(
+std::unique_ptr<GrGeometryProcessor::ProgramImpl> FillRRectOpImpl::Processor::makeProgramImpl(
const GrShaderCaps&) const {
return std::make_unique<Impl>();
}
-void FillRRectOp::onCreateProgramInfo(const GrCaps* caps,
- SkArenaAlloc* arena,
- const GrSurfaceProxyView& writeView,
- bool usesMSAASurface,
- GrAppliedClip&& appliedClip,
- const GrDstProxyView& dstProxyView,
- GrXferBarrierFlags renderPassXferBarriers,
- GrLoadOp colorLoadOp) {
+void FillRRectOpImpl::onCreateProgramInfo(const GrCaps* caps,
+ SkArenaAlloc* arena,
+ const GrSurfaceProxyView& writeView,
+ bool usesMSAASurface,
+ GrAppliedClip&& appliedClip,
+ const GrDstProxyView& dstProxyView,
+ GrXferBarrierFlags renderPassXferBarriers,
+ GrLoadOp colorLoadOp) {
if (usesMSAASurface) {
fProcessorFlags |= ProcessorFlags::kMSAAEnabled;
}
@@ -779,7 +779,7 @@
colorLoadOp);
}
-void FillRRectOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
+void FillRRectOpImpl::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
if (!fInstanceBuffer || !fIndexBuffer || !fVertexBuffer) {
return; // Setup failed.
}
@@ -793,7 +793,7 @@
}
// Will the given corner look good if we use HW derivatives?
-static bool can_use_hw_derivatives_with_coverage(const Sk2f& devScale, const Sk2f& cornerRadii) {
+bool can_use_hw_derivatives_with_coverage(const Sk2f& devScale, const Sk2f& cornerRadii) {
Sk2f devRadii = devScale * cornerRadii;
if (devRadii[1] < devRadii[0]) {
devRadii = SkNx_shuffle<1,0>(devRadii);
@@ -804,14 +804,14 @@
return minDevRadius * minDevRadius * 5 > devRadii[1];
}
-static bool can_use_hw_derivatives_with_coverage(
- const Sk2f& devScale, const SkVector& cornerRadii) {
+bool can_use_hw_derivatives_with_coverage(const Sk2f& devScale, const SkVector& cornerRadii) {
return can_use_hw_derivatives_with_coverage(devScale, Sk2f::Load(&cornerRadii));
}
// Will the given round rect look good if we use HW derivatives?
-static bool can_use_hw_derivatives_with_coverage(
- const GrShaderCaps& shaderCaps, const SkMatrix& viewMatrix, const SkRRect& rrect) {
+bool can_use_hw_derivatives_with_coverage(const GrShaderCaps& shaderCaps,
+ const SkMatrix& viewMatrix,
+ const SkRRect& rrect) {
if (!shaderCaps.shaderDerivativeSupport()) {
return false;
}
@@ -852,17 +852,19 @@
} // anonymous namespace
+namespace skgpu::v1::FillRRectOp {
-GrOp::Owner GrFillRRectOp::Make(GrRecordingContext* ctx,
- SkArenaAlloc* arena,
- GrPaint&& paint,
- const SkMatrix& viewMatrix,
- const SkRRect& rrect,
- const SkRect& localRect,
- GrAA aa) {
- return FillRRectOp::Make(ctx, arena, std::move(paint), viewMatrix, rrect, localRect, aa);
+GrOp::Owner Make(GrRecordingContext* ctx,
+ SkArenaAlloc* arena,
+ GrPaint&& paint,
+ const SkMatrix& viewMatrix,
+ const SkRRect& rrect,
+ const SkRect& localRect,
+ GrAA aa) {
+ return FillRRectOpImpl::Make(ctx, arena, std::move(paint), viewMatrix, rrect, localRect, aa);
}
+} // namespace skgpu::v1::FillRRectOp
#if GR_TEST_UTILS
@@ -881,13 +883,13 @@
// TODO: test out other rrect configurations
rrect.setNinePatch(rect, w / 3.0f, h / 4.0f, w / 5.0f, h / 6.0);
- return GrFillRRectOp::Make(context,
- &arena,
- std::move(paint),
- viewMatrix,
- rrect,
- rrect.rect(),
- aa);
+ return skgpu::v1::FillRRectOp::Make(context,
+ &arena,
+ std::move(paint),
+ viewMatrix,
+ rrect,
+ rrect.rect(),
+ aa);
}
#endif
diff --git a/src/gpu/ops/GrFillRRectOp.h b/src/gpu/ops/FillRRectOp.h
similarity index 76%
rename from src/gpu/ops/GrFillRRectOp.h
rename to src/gpu/ops/FillRRectOp.h
index 6590ad0..478cb6c 100644
--- a/src/gpu/ops/GrFillRRectOp.h
+++ b/src/gpu/ops/FillRRectOp.h
@@ -5,20 +5,20 @@
* found in the LICENSE file.
*/
-#ifndef GrFillRRectOp_DEFINED
-#define GrFillRRectOp_DEFINED
+#ifndef FillRRectOp_DEFINED
+#define FillRRectOp_DEFINED
#include "include/private/GrTypesPriv.h"
#include "src/gpu/ops/GrOp.h"
class GrCaps;
-class GrDrawOp;
class GrPaint;
class GrRecordingContext;
class SkMatrix;
-class SkRRect;
+struct SkRect;
-namespace GrFillRRectOp {
+namespace skgpu::v1::FillRRectOp {
+
GrOp::Owner Make(GrRecordingContext*,
SkArenaAlloc*,
GrPaint&&,
@@ -26,6 +26,7 @@
const SkRRect&,
const SkRect& localRect,
GrAA);
-} // namespace GrFillRRectOp
-#endif
+} // namespace skgpu::v1::FillRRectOp
+
+#endif // FillRRectOp_DEFINED
diff --git a/src/gpu/ops/GrFillRectOp.cpp b/src/gpu/ops/FillRectOp.cpp
similarity index 88%
rename from src/gpu/ops/GrFillRectOp.cpp
rename to src/gpu/ops/FillRectOp.cpp
index 6cd91e6..3acdb00 100644
--- a/src/gpu/ops/GrFillRectOp.cpp
+++ b/src/gpu/ops/FillRectOp.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-#include "src/gpu/ops/GrFillRectOp.h"
+#include "src/gpu/ops/FillRectOp.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkRect.h"
@@ -23,9 +23,7 @@
#include "src/gpu/ops/GrMeshDrawOp.h"
#include "src/gpu/ops/GrQuadPerEdgeAA.h"
#include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
-#if SK_GPU_V1
#include "src/gpu/v1/SurfaceDrawContext_v1.h"
-#endif
namespace {
@@ -33,9 +31,9 @@
using ColorType = GrQuadPerEdgeAA::ColorType;
#if GR_TEST_UTILS
-static SkString dump_quad_info(int index, const GrQuad* deviceQuad,
- const GrQuad* localQuad, const SkPMColor4f& color,
- GrQuadAAFlags aaFlags) {
+SkString dump_quad_info(int index, const GrQuad* deviceQuad,
+ const GrQuad* localQuad, const SkPMColor4f& color,
+ GrQuadAAFlags aaFlags) {
GrQuad safeLocal = localQuad ? *localQuad : GrQuad();
SkString str;
str.appendf("%d: Color: [%.2f, %.2f, %.2f, %.2f], Edge AA: l%u_t%u_r%u_b%u, \n"
@@ -60,7 +58,7 @@
}
#endif
-class FillRectOp final : public GrMeshDrawOp {
+class FillRectOpImpl final : public GrMeshDrawOp {
private:
using Helper = GrSimpleMeshDrawOpHelperWithStencil;
@@ -74,14 +72,15 @@
// Clean up deviations between aaType and edgeAA
GrQuadUtils::ResolveAAType(aaType, quad->fEdgeFlags, quad->fDevice,
&aaType, &quad->fEdgeFlags);
- return Helper::FactoryHelper<FillRectOp>(context, std::move(paint), aaType, quad,
- stencilSettings, inputFlags);
+ return Helper::FactoryHelper<FillRectOpImpl>(context, std::move(paint), aaType, quad,
+ stencilSettings, inputFlags);
}
// aaType is passed to Helper in the initializer list, so incongruities between aaType and
// edgeFlags must be resolved prior to calling this constructor.
- FillRectOp(GrProcessorSet* processorSet, SkPMColor4f paintColor, GrAAType aaType,
- DrawQuad* quad, const GrUserStencilSettings* stencil, Helper::InputFlags inputFlags)
+ FillRectOpImpl(GrProcessorSet* processorSet, SkPMColor4f paintColor, GrAAType aaType,
+ DrawQuad* quad, const GrUserStencilSettings* stencil,
+ Helper::InputFlags inputFlags)
: INHERITED(ClassID())
, fHelper(processorSet, aaType, stencil, inputFlags)
, fQuads(1, !fHelper.isTrivial()) {
@@ -180,7 +179,7 @@
DEFINE_OP_CLASS_ID
private:
- friend class ::GrFillRectOp; // for access to addQuad
+ friend class skgpu::v1::FillRectOp; // for access to addQuad
#if GR_TEST_UTILS
int numQuads() const final { return fQuads.count(); }
@@ -322,7 +321,7 @@
CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override {
TRACE_EVENT0("skia.gpu", TRACE_FUNC);
- const auto* that = t->cast<FillRectOp>();
+ auto that = t->cast<FillRectOpImpl>();
bool upgradeToCoverageAAOnMerge = false;
if (fHelper.aaType() != that->fHelper.aaType()) {
@@ -458,34 +457,36 @@
} // anonymous namespace
-GrOp::Owner GrFillRectOp::Make(GrRecordingContext* context,
+namespace skgpu::v1 {
+
+GrOp::Owner FillRectOp::Make(GrRecordingContext* context,
+ GrPaint&& paint,
+ GrAAType aaType,
+ DrawQuad* quad,
+ const GrUserStencilSettings* stencil,
+ InputFlags inputFlags) {
+ return FillRectOpImpl::Make(context, std::move(paint), aaType, std::move(quad), stencil,
+ inputFlags);
+}
+
+GrOp::Owner FillRectOp::MakeNonAARect(GrRecordingContext* context,
+ GrPaint&& paint,
+ const SkMatrix& view,
+ const SkRect& rect,
+ const GrUserStencilSettings* stencil) {
+ DrawQuad quad{GrQuad::MakeFromRect(rect, view), GrQuad(rect), GrQuadAAFlags::kNone};
+ return FillRectOpImpl::Make(context, std::move(paint), GrAAType::kNone, &quad, stencil,
+ InputFlags::kNone);
+}
+
+GrOp::Owner FillRectOp::MakeOp(GrRecordingContext* context,
GrPaint&& paint,
GrAAType aaType,
- DrawQuad* quad,
- const GrUserStencilSettings* stencil,
- InputFlags inputFlags) {
- return FillRectOp::Make(context, std::move(paint), aaType, std::move(quad), stencil,
- inputFlags);
-}
-
-GrOp::Owner GrFillRectOp::MakeNonAARect(GrRecordingContext* context,
- GrPaint&& paint,
- const SkMatrix& view,
- const SkRect& rect,
- const GrUserStencilSettings* stencil) {
- DrawQuad quad{GrQuad::MakeFromRect(rect, view), GrQuad(rect), GrQuadAAFlags::kNone};
- return FillRectOp::Make(context, std::move(paint), GrAAType::kNone, &quad, stencil,
- InputFlags::kNone);
-}
-
-GrOp::Owner GrFillRectOp::MakeOp(GrRecordingContext* context,
- GrPaint&& paint,
- GrAAType aaType,
- const SkMatrix& viewMatrix,
- const GrQuadSetEntry quads[],
- int cnt,
- const GrUserStencilSettings* stencilSettings,
- int* numConsumed) {
+ const SkMatrix& viewMatrix,
+ const GrQuadSetEntry quads[],
+ int cnt,
+ const GrUserStencilSettings* stencilSettings,
+ int* numConsumed) {
// First make a draw op for the first quad in the set
SkASSERT(cnt > 0);
@@ -495,7 +496,7 @@
paint.setColor4f(quads[0].fColor);
GrOp::Owner op = FillRectOp::Make(context, std::move(paint), aaType,
&quad, stencilSettings, InputFlags::kNone);
- FillRectOp* fillRects = op->cast<FillRectOp>();
+ auto fillRects = op->cast<FillRectOpImpl>();
*numConsumed = 1;
// Accumulate remaining quads similar to onCombineIfPossible() without creating an op
@@ -518,16 +519,15 @@
return op;
}
-#if SK_GPU_V1
-void GrFillRectOp::AddFillRectOps(skgpu::v1::SurfaceDrawContext* sdc,
- const GrClip* clip,
- GrRecordingContext* context,
- GrPaint&& paint,
- GrAAType aaType,
- const SkMatrix& viewMatrix,
- const GrQuadSetEntry quads[],
- int cnt,
- const GrUserStencilSettings* stencilSettings) {
+void FillRectOp::AddFillRectOps(skgpu::v1::SurfaceDrawContext* sdc,
+ const GrClip* clip,
+ GrRecordingContext* context,
+ GrPaint&& paint,
+ GrAAType aaType,
+ const SkMatrix& viewMatrix,
+ const GrQuadSetEntry quads[],
+ int cnt,
+ const GrUserStencilSettings* stencilSettings) {
int offset = 0;
int numLeft = cnt;
@@ -546,12 +546,13 @@
SkASSERT(offset == cnt);
}
-#endif
+
+} // namespace skgpu::v1
#if GR_TEST_UTILS
-uint32_t GrFillRectOp::ClassID() {
- return FillRectOp::ClassID();
+uint32_t skgpu::v1::FillRectOp::ClassID() {
+ return FillRectOpImpl::ClassID();
}
#include "src/gpu/GrDrawOpTest.h"
@@ -580,18 +581,18 @@
SkMatrix localMatrix = GrTest::TestMatrixInvertible(random);
DrawQuad quad = {GrQuad::MakeFromRect(rect, viewMatrix),
GrQuad::MakeFromRect(rect, localMatrix), aaFlags};
- return GrFillRectOp::Make(context, std::move(paint), aaType, &quad, stencil);
+ return skgpu::v1::FillRectOp::Make(context, std::move(paint), aaType, &quad, stencil);
} else {
// Pass local rect directly
SkRect localRect = GrTest::TestRect(random);
DrawQuad quad = {GrQuad::MakeFromRect(rect, viewMatrix),
GrQuad(localRect), aaFlags};
- return GrFillRectOp::Make(context, std::move(paint), aaType, &quad, stencil);
+ return skgpu::v1::FillRectOp::Make(context, std::move(paint), aaType, &quad, stencil);
}
} else {
// The simplest constructor
DrawQuad quad = {GrQuad::MakeFromRect(rect, viewMatrix), GrQuad(rect), aaFlags};
- return GrFillRectOp::Make(context, std::move(paint), aaType, &quad, stencil);
+ return skgpu::v1::FillRectOp::Make(context, std::move(paint), aaType, &quad, stencil);
}
}
diff --git a/src/gpu/ops/GrFillRectOp.h b/src/gpu/ops/FillRectOp.h
similarity index 86%
rename from src/gpu/ops/GrFillRectOp.h
rename to src/gpu/ops/FillRectOp.h
index 6408ffb..db3380b 100644
--- a/src/gpu/ops/GrFillRectOp.h
+++ b/src/gpu/ops/FillRectOp.h
@@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
-#ifndef GrFillRectOp_DEFINED
-#define GrFillRectOp_DEFINED
+#ifndef FillRectOp_DEFINED
+#define FillRectOp_DEFINED
#include "include/private/GrTypesPriv.h"
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
@@ -18,18 +18,21 @@
class GrQuad;
struct GrQuadSetEntry;
class GrRecordingContext;
-namespace skgpu { namespace v1 { class SurfaceDrawContext; }}
struct GrUserStencilSettings;
class SkMatrix;
struct SkRect;
+namespace skgpu::v1 {
+
+class SurfaceDrawContext;
+
/**
* A set of factory functions for drawing filled rectangles either coverage-antialiased, or
* non-antialiased. The non-antialiased ops can be used with MSAA. As with other GrDrawOp factories,
* the GrPaint is only consumed by these methods if a valid op is returned. If null is returned then
* the paint is unmodified and may still be used.
*/
-class GrFillRectOp {
+class FillRectOp {
public:
using InputFlags = GrSimpleMeshDrawOpHelper::InputFlags;
@@ -49,11 +52,9 @@
const SkRect&,
const GrUserStencilSettings* = nullptr);
- // TODO: remove this guard once GrFillRectOp is made V1-only
-#if SK_GPU_V1
// Bulk API for drawing quads with a single op
// TODO(michaelludwig) - remove if the bulk API is not useful for SkiaRenderer
- static void AddFillRectOps(skgpu::v1::SurfaceDrawContext*,
+ static void AddFillRectOps(SurfaceDrawContext*,
const GrClip*,
GrRecordingContext*,
GrPaint&&,
@@ -62,14 +63,13 @@
const GrQuadSetEntry quads[],
int quadCount,
const GrUserStencilSettings* = nullptr);
-#endif
#if GR_TEST_UTILS
static uint32_t ClassID();
#endif
private:
- // Create a GrFillRectOp that uses as many quads as possible from 'quads' w/o exceeding
+ // Create a FillRectOp that uses as many quads as possible from 'quads' w/o exceeding
// any index buffer size limits.
static GrOp::Owner MakeOp(GrRecordingContext*,
GrPaint&&,
@@ -81,4 +81,6 @@
int* numConsumed);
};
-#endif // GrFillRectOp_DEFINED
+} // namespace skgpu::v1
+
+#endif // FillRectOp_DEFINED
diff --git a/src/gpu/ops/GrDrawOp.h b/src/gpu/ops/GrDrawOp.h
index 5442d6a..19de7db 100644
--- a/src/gpu/ops/GrDrawOp.h
+++ b/src/gpu/ops/GrDrawOp.h
@@ -87,7 +87,7 @@
#endif
#if GR_TEST_UTILS
- // This is really only intended for GrTextureOp and GrFillRectOp to override
+ // This is really only intended for TextureOp and FillRectOp to override
virtual int numQuads() const { return -1; }
#endif
diff --git a/src/gpu/ops/GrQuadPerEdgeAA.cpp b/src/gpu/ops/GrQuadPerEdgeAA.cpp
index 52bc12e..64b93ee 100644
--- a/src/gpu/ops/GrQuadPerEdgeAA.cpp
+++ b/src/gpu/ops/GrQuadPerEdgeAA.cpp
@@ -87,7 +87,7 @@
SkASSERT(spec.hasVertexColors());
SkASSERT(!spec.requiresGeometrySubset());
SkASSERT(!spec.hasSubset());
- // We don't assert that localQuad == nullptr, since it is possible for GrFillRectOp to
+ // We don't assert that localQuad == nullptr, since it is possible for FillRectOp to
// accumulate local coords conservatively (paint not trivial), and then after analysis realize
// the processors don't need local coordinates.
@@ -702,7 +702,7 @@
args.fFragBuilder->codeAppend(");");
} else {
// Saturate is only intended for use with a proxy to account for the fact
- // that GrTextureOp skips SkPaint conversion, which normally handles this.
+ // that TextureOp skips SkPaint conversion, which normally handles this.
SkASSERT(gp.fSaturate == Saturate::kNo);
}
diff --git a/src/gpu/ops/OpsTask.h b/src/gpu/ops/OpsTask.h
index 4f5cc08..9a5972e 100644
--- a/src/gpu/ops/OpsTask.h
+++ b/src/gpu/ops/OpsTask.h
@@ -86,7 +86,7 @@
};
// Perform book-keeping for a fullscreen clear, regardless of how the clear is implemented later
- // (i.e. setColorLoadOp(), adding a ClearOp, or adding a GrFillRectOp that covers the device).
+ // (i.e. setColorLoadOp(), adding a ClearOp, or adding a FillRectOp that covers the device).
// Returns true if the clear can be converted into a load op (barring device caps).
bool resetForFullscreenClear(CanDiscardPreviousOps);
diff --git a/src/gpu/ops/StrokeRectOp.cpp b/src/gpu/ops/StrokeRectOp.cpp
index 9dc2430..c0ce25a 100644
--- a/src/gpu/ops/StrokeRectOp.cpp
+++ b/src/gpu/ops/StrokeRectOp.cpp
@@ -19,7 +19,7 @@
#include "src/gpu/GrProgramInfo.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/GrVertexWriter.h"
-#include "src/gpu/ops/GrFillRectOp.h"
+#include "src/gpu/ops/FillRectOp.h"
#include "src/gpu/ops/GrMeshDrawOp.h"
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
@@ -975,7 +975,7 @@
}
DrawQuad quad{GrQuad::MakeFromRect(rects[0], viewMatrix), GrQuad(rects[0]),
GrQuadAAFlags::kAll};
- return GrFillRectOp::Make(context, std::move(paint), GrAAType::kCoverage, &quad);
+ return FillRectOp::Make(context, std::move(paint), GrAAType::kCoverage, &quad);
}
return AAStrokeRectOp::Make(context, std::move(paint), viewMatrix, devOutside,
diff --git a/src/gpu/ops/TextureOp.cpp b/src/gpu/ops/TextureOp.cpp
index 4e11cc2..f33075e 100644
--- a/src/gpu/ops/TextureOp.cpp
+++ b/src/gpu/ops/TextureOp.cpp
@@ -37,7 +37,7 @@
#include "src/gpu/geometry/GrQuadUtils.h"
#include "src/gpu/geometry/GrRect.h"
#include "src/gpu/glsl/GrGLSLVarying.h"
-#include "src/gpu/ops/GrFillRectOp.h"
+#include "src/gpu/ops/FillRectOp.h"
#include "src/gpu/ops/GrMeshDrawOp.h"
#include "src/gpu/ops/GrQuadPerEdgeAA.h"
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
@@ -219,7 +219,7 @@
}
/**
- * Op that implements GrTextureOp::Make. It draws textured quads. Each quad can modulate against a
+ * Op that implements TextureOp::Make. It draws textured quads. Each quad can modulate against a
* the texture by color. The blend with the destination is always src-over. The edges are non-AA.
*/
class TextureOpImpl final : public GrMeshDrawOp {
@@ -336,7 +336,7 @@
};
struct ViewCountPair {
- // Normally this would be a GrSurfaceProxyView, but GrTextureOp applies the GrOrigin right
+ // Normally this would be a GrSurfaceProxyView, but TextureOp applies the GrOrigin right
// away so it doesn't need to be stored, and all ViewCountPairs in an op have the same
// swizzle so that is stored in the op metadata.
sk_sp<GrSurfaceProxy> fProxy;
@@ -522,7 +522,7 @@
GrMipmapped::kYes));
if (q == 0) {
// We do not placement new the first ViewCountPair since that one is allocated and
- // initialized as part of the GrTextureOp creation.
+ // initialized as part of the TextureOp creation.
fViewCountPairs[0].fProxy = set[0].fProxyView.detachProxy();
fViewCountPairs[0].fQuadCnt = 0;
curProxy = fViewCountPairs[0].fProxy.get();
@@ -1138,7 +1138,7 @@
GrAAType aaType,
DrawQuad* quad,
const SkRect* subset) {
- // Apply optimizations that are valid whether or not using GrTextureOp or GrFillRectOp
+ // Apply optimizations that are valid whether or not using TextureOp or FillRectOp
if (subset && subset->contains(proxyView.proxy()->backingStoreBoundsRect())) {
// No need for a shader-based subset if hardware clamping achieves the same effect
subset = nullptr;
@@ -1158,7 +1158,7 @@
return TextureOpImpl::Make(context, std::move(proxyView), std::move(textureXform), filter,
mm, color, saturate, aaType, std::move(quad), subset);
} else {
- // Emulate complex blending using GrFillRectOp
+ // Emulate complex blending using FillRectOp
GrSamplerState samplerState(GrSamplerState::WrapMode::kClamp, filter, mm);
GrPaint paint;
paint.setColor4f(color);
@@ -1185,7 +1185,7 @@
fp = GrFragmentProcessor::ClampOutput(std::move(fp));
}
paint.setColorFragmentProcessor(std::move(fp));
- return GrFillRectOp::Make(context, std::move(paint), aaType, quad);
+ return FillRectOp::Make(context, std::move(paint), aaType, quad);
}
}
@@ -1276,7 +1276,7 @@
!context->priv().caps()->dynamicStateArrayGeometryProcessorTextureSupport()) {
// Append each entry as its own op; these may still be GrTextureOps if the blend mode is
// src-over but the backend doesn't support dynamic state changes. Otherwise Make()
- // automatically creates the appropriate GrFillRectOp to emulate GrTextureOp.
+ // automatically creates the appropriate FillRectOp to emulate TextureOp.
SkMatrix ctm;
for (int i = 0; i < cnt; ++i) {
ctm = viewMatrix;
@@ -1362,7 +1362,7 @@
if (i >= GrResourceProvider::MaxNumNonAAQuads()) {
// Here we've found a consistent batch of non-AA quads that has gotten too
- // large. Calve it off as its own GrTextureOp.
+ // large. Calve it off as its own TextureOp.
state.createOp(set, GrResourceProvider::MaxNumNonAAQuads(),
GrAAType::kNone); // definitely downgrading AA here
clumped = true;
diff --git a/src/gpu/ops/TextureOp.h b/src/gpu/ops/TextureOp.h
index d976c90..998578c 100644
--- a/src/gpu/ops/TextureOp.h
+++ b/src/gpu/ops/TextureOp.h
@@ -43,9 +43,9 @@
* boundary for the strict src rect constraint. If GrAAType is kCoverage then AA is applied to
* the edges indicated by GrQuadAAFlags. Otherwise, GrQuadAAFlags is ignored.
*
- * This is functionally very similar to GrFillRectOp::Make, except that the GrPaint has been
+ * This is functionally very similar to FillRectOp::Make, except that the GrPaint has been
* deconstructed into the texture, filter, modulating color, and blend mode. When blend mode is
- * src over, this will return a GrFillRectOp with a paint that samples the proxy.
+ * src over, this will return a FillRectOp with a paint that samples the proxy.
*/
static GrOp::Owner Make(GrRecordingContext*,
GrSurfaceProxyView,
@@ -61,7 +61,7 @@
const SkRect* subset = nullptr);
#if SK_GPU_V1
- // Automatically falls back to using one GrFillRectOp per entry if dynamic states are not
+ // Automatically falls back to using one FillRectOp per entry if dynamic states are not
// supported, or if the blend mode is not src-over. 'cnt' is the size of the entry array.
// 'proxyCnt' <= 'cnt' and represents the number of proxy switches within the array.
static void AddTextureSetOps(skgpu::v1::SurfaceDrawContext*,
diff --git a/src/gpu/v1/SurfaceDrawContext.cpp b/src/gpu/v1/SurfaceDrawContext.cpp
index 15ca226..a9c9b15 100644
--- a/src/gpu/v1/SurfaceDrawContext.cpp
+++ b/src/gpu/v1/SurfaceDrawContext.cpp
@@ -57,9 +57,9 @@
#include "src/gpu/ops/DrawAtlasOp.h"
#include "src/gpu/ops/DrawVerticesOp.h"
#include "src/gpu/ops/DrawableOp.h"
+#include "src/gpu/ops/FillRRectOp.h"
+#include "src/gpu/ops/FillRectOp.h"
#include "src/gpu/ops/GrDrawOp.h"
-#include "src/gpu/ops/GrFillRRectOp.h"
-#include "src/gpu/ops/GrFillRectOp.h"
#include "src/gpu/ops/GrLatticeOp.h"
#include "src/gpu/ops/GrOp.h"
#include "src/gpu/ops/GrOvalOpFactory.h"
@@ -633,8 +633,8 @@
} else {
aaType = this->chooseAAType(aa);
}
- this->addDrawOp(finalClip, GrFillRectOp::Make(fContext, std::move(paint), aaType,
- quad, ss));
+ this->addDrawOp(finalClip, FillRectOp::Make(fContext, std::move(paint), aaType,
+ quad, ss));
}
// All other optimization levels were completely handled inside attempt(), so no extra op needed
}
@@ -653,7 +653,7 @@
SkCanvas::SrcRectConstraint constraint,
const SkMatrix& viewMatrix,
sk_sp<GrColorSpaceXform> colorSpaceXform) {
- // If we are using dmsaa then go through GrFillRRectOp (via fillRectToRect).
+ // If we are using dmsaa then go through FillRRectOp (via fillRectToRect).
if ((this->alwaysAntialias() || this->caps()->reducedShaderMode()) && aa == GrAA::kYes) {
GrPaint paint;
paint.setColor4f(color);
@@ -705,7 +705,7 @@
AutoCheckFlush acf(this->drawingManager());
// Functionally this is very similar to drawFilledQuad except that there's no constColor to
- // enable the kSubmitted optimizations, no stencil settings support, and its a GrTextureOp.
+ // enable the kSubmitted optimizations, no stencil settings support, and its a TextureOp.
QuadOptimization opt = this->attemptQuadOptimization(clip, nullptr/*stencil*/, &aa, quad,
nullptr/*paint*/);
@@ -788,11 +788,11 @@
DrawQuad quad{GrQuad::MakeFromRect(rectToDraw, viewMatrix), GrQuad(localRect),
aa == GrAA::kYes ? GrQuadAAFlags::kAll : GrQuadAAFlags::kNone};
- // If we are using dmsaa then attempt to draw the rect with GrFillRRectOp.
+ // If we are using dmsaa then attempt to draw the rect with FillRRectOp.
if ((fContext->priv().caps()->reducedShaderMode() || this->alwaysAntialias()) &&
this->caps()->drawInstancedSupport() &&
aa == GrAA::kYes) { // If aa is kNo when using dmsaa, the rect is axis aligned. Don't use
- // GrFillRRectOp because it might require dual source blending.
+ // FillRRectOp because it might require dual source blending.
// http://skbug.com/11756
QuadOptimization opt = this->attemptQuadOptimization(clip, nullptr/*stencil*/, &aa, &quad,
&paint);
@@ -817,15 +817,15 @@
optimizedClip = nullptr;
}
} else {
- // Even if attemptQuadOptimization gave us an optimized quad, GrFillRRectOp needs a rect
+ // Even if attemptQuadOptimization gave us an optimized quad, FillRRectOp needs a rect
// in pre-matrix space, so use the original rect. Also preserve the original clip.
croppedRect = rectToDraw;
croppedLocal = localRect;
}
- if (auto op = GrFillRRectOp::Make(fContext, this->arenaAlloc(), std::move(paint),
- viewMatrix, SkRRect::MakeRect(croppedRect), croppedLocal,
- GrAA::kYes)) {
+ if (auto op = FillRRectOp::Make(fContext, this->arenaAlloc(), std::move(paint),
+ viewMatrix, SkRRect::MakeRect(croppedRect), croppedLocal,
+ GrAA::kYes)) {
this->addDrawOp(optimizedClip, std::move(op));
return;
}
@@ -843,8 +843,8 @@
int cnt) {
GrAAType aaType = this->chooseAAType(aa);
- GrFillRectOp::AddFillRectOps(this, clip, fContext, std::move(paint), aaType, viewMatrix,
- quads, cnt);
+ FillRectOp::AddFillRectOps(this, clip, fContext, std::move(paint), aaType, viewMatrix,
+ quads, cnt);
}
int SurfaceDrawContext::maxWindowRectangles() const {
@@ -902,8 +902,8 @@
GrPaint paint;
paint.setXPFactory(GrDisableColorXPFactory::Get());
this->addDrawOp(nullptr,
- GrFillRectOp::MakeNonAARect(fContext, std::move(paint), SkMatrix::I(),
- SkRect::Make(scissorState.rect()), ss));
+ FillRectOp::MakeNonAARect(fContext, std::move(paint), SkMatrix::I(),
+ SkRect::Make(scissorState.rect()), ss));
} else {
this->addOp(ClearOp::MakeStencilClip(fContext, scissorState, insideStencilMask));
}
@@ -1095,8 +1095,8 @@
}
if (!op && style.isSimpleFill()) {
assert_alive(paint);
- op = GrFillRRectOp::Make(fContext, this->arenaAlloc(), std::move(paint), viewMatrix, rrect,
- rrect.rect(), GrAA(aaType != GrAAType::kNone));
+ op = FillRRectOp::Make(fContext, this->arenaAlloc(), std::move(paint), viewMatrix, rrect,
+ rrect.rect(), GrAA(aaType != GrAAType::kNone));
}
if (!op && (aaType == GrAAType::kCoverage || fCanUseDynamicMSAA)) {
assert_alive(paint);
@@ -1395,14 +1395,14 @@
this->caps()->shaderCaps());
}
if (!op && style.isSimpleFill()) {
- // GrFillRRectOp has special geometry and a fragment-shader branch to conditionally evaluate
+ // FillRRectOp has special geometry and a fragment-shader branch to conditionally evaluate
// the arc equation. This same special geometry and fragment branch also turn out to be a
// substantial optimization for drawing ovals (namely, by not evaluating the arc equation
// inside the oval's inner diamond). Given these optimizations, it's a clear win to draw
// ovals the exact same way we do round rects.
assert_alive(paint);
- op = GrFillRRectOp::Make(fContext, this->arenaAlloc(), std::move(paint), viewMatrix,
- SkRRect::MakeOval(oval), oval, GrAA(aaType != GrAAType::kNone));
+ op = FillRRectOp::Make(fContext, this->arenaAlloc(), std::move(paint), viewMatrix,
+ SkRRect::MakeOval(oval), oval, GrAA(aaType != GrAAType::kNone));
}
if (!op && (aaType == GrAAType::kCoverage || fCanUseDynamicMSAA)) {
assert_alive(paint);
diff --git a/src/gpu/v1/SurfaceFillContext_v1.cpp b/src/gpu/v1/SurfaceFillContext_v1.cpp
index 8f91023..2fef76a 100644
--- a/src/gpu/v1/SurfaceFillContext_v1.cpp
+++ b/src/gpu/v1/SurfaceFillContext_v1.cpp
@@ -14,7 +14,7 @@
#include "src/gpu/effects/GrTextureEffect.h"
#include "src/gpu/geometry/GrRect.h"
#include "src/gpu/ops/ClearOp.h"
-#include "src/gpu/ops/GrFillRectOp.h"
+#include "src/gpu/ops/FillRectOp.h"
#include "src/gpu/v1/SurfaceDrawContext_v1.h"
#define ASSERT_SINGLE_OWNER GR_ASSERT_SINGLE_OWNER(this->singleOwner())
@@ -64,8 +64,8 @@
GrPaint paint;
paint.setColorFragmentProcessor(std::move(fp));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- auto op = GrFillRectOp::MakeNonAARect(fContext, std::move(paint), SkMatrix::I(),
- SkRect::Make(dstRect));
+ auto op = FillRectOp::MakeNonAARect(fContext, std::move(paint), SkMatrix::I(),
+ SkRect::Make(dstRect));
this->addDrawOp(std::move(op));
}
@@ -218,8 +218,8 @@
if (clearAsDraw) {
GrPaint paint;
ClearToGrPaint(color, &paint);
- auto op = GrFillRectOp::MakeNonAARect(fContext, std::move(paint), SkMatrix::I(),
- SkRect::Make(scissorState.rect()));
+ auto op = FillRectOp::MakeNonAARect(fContext, std::move(paint), SkMatrix::I(),
+ SkRect::Make(scissorState.rect()));
this->addDrawOp(std::move(op));
} else {
color = this->writeSurfaceView().swizzle().applyTo(color);
diff --git a/tests/BulkRectTest.cpp b/tests/BulkRectTest.cpp
index 8fabae1..84f6806 100644
--- a/tests/BulkRectTest.cpp
+++ b/tests/BulkRectTest.cpp
@@ -11,7 +11,7 @@
#include "src/gpu/GrOpsTypes.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrResourceProvider.h"
-#include "src/gpu/ops/GrFillRectOp.h"
+#include "src/gpu/ops/FillRectOp.h"
#include "src/gpu/ops/TextureOp.h"
#include "src/gpu/v1/SurfaceDrawContext_v1.h"
#include "tests/Test.h"
@@ -70,8 +70,8 @@
GrPaint paint;
paint.setXPFactory(SkBlendMode_AsXPFactory(blendMode));
- GrFillRectOp::AddFillRectOps(sdc.get(), nullptr, dContext, std::move(paint), overallAA,
- SkMatrix::I(), quads, requestedTotNumQuads);
+ skgpu::v1::FillRectOp::AddFillRectOps(sdc.get(), nullptr, dContext, std::move(paint), overallAA,
+ SkMatrix::I(), quads, requestedTotNumQuads);
auto opsTask = sdc->testingOnly_PeekLastOpsTask();
int actualNumOps = opsTask->numOpChains();
@@ -80,7 +80,7 @@
for (int i = 0; i < actualNumOps; ++i) {
const GrOp* tmp = opsTask->getChain(i);
- REPORTER_ASSERT(reporter, tmp->classID() == GrFillRectOp::ClassID());
+ REPORTER_ASSERT(reporter, tmp->classID() == skgpu::v1::FillRectOp::ClassID());
REPORTER_ASSERT(reporter, tmp->isChainTail());
actualTotNumQuads += ((GrDrawOp*) tmp)->numQuads();
}
@@ -185,13 +185,13 @@
if (blendMode != SkBlendMode::kSrcOver ||
!dContext->priv().caps()->dynamicStateArrayGeometryProcessorTextureSupport()) {
- // In either of these two cases, GrTextureOp creates one op per quad instead. Since
+ // In either of these two cases, TextureOp creates one op per quad instead. Since
// each entry alternates proxies but overlaps geometrically, this will prevent the ops
// from being merged back into fewer ops.
expectedNumOps = requestedTotNumQuads;
}
uint32_t expectedOpID = blendMode == SkBlendMode::kSrcOver ? skgpu::v1::TextureOp::ClassID()
- : GrFillRectOp::ClassID();
+ : skgpu::v1::FillRectOp::ClassID();
for (int i = 0; i < actualNumOps; ++i) {
const GrOp* tmp = opsTask->getChain(i);
REPORTER_ASSERT(reporter, allUniqueProxies || tmp->isChainTail());
@@ -267,8 +267,8 @@
false, false, 2*GrResourceProvider::MaxNumAAQuads(), kNumExpectedOps);
}
- // In this case we use a blend mode other than src-over, which hits the GrFillRectOp fallback
- // code path for GrTextureOp. We pass in the expected results if batching was successful, to
+ // In this case we use a blend mode other than src-over, which hits the FillRectOp fallback
+ // code path for TextureOp. We pass in the expected results if batching was successful, to
// that bulk_fill_rect_create_test batches on all modes; bulk_texture_rect_create_test is
// responsible for revising its expectations.
{
diff --git a/tests/PathRendererCacheTests.cpp b/tests/PathRendererCacheTests.cpp
index 70cc02e..c3966ab 100644
--- a/tests/PathRendererCacheTests.cpp
+++ b/tests/PathRendererCacheTests.cpp
@@ -159,7 +159,7 @@
};
// Software path renderer creates a mask texture and renders with a non-AA rect, but the flush
- // only contains a single quad so GrFillRectOp doesn't need to use the shared index buffer.
+ // only contains a single quad so FillRectOp doesn't need to use the shared index buffer.
const int kExpectedResources = 1;
test_path(reporter, create_concave_path, createPR, kExpectedResources, true,