#include "src/gpu/ganesh/ops/TriangulatingPathRenderer.h"
#include "include/core/SkData.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPath.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkScalar.h"
#include "include/core/SkString.h"
#include "include/core/SkSurfaceProps.h"
#include "include/core/SkTypes.h"
#include "include/gpu/ganesh/GrRecordingContext.h"
#include "include/private/SkColorData.h"
#include "include/private/SkIDChangeListener.h"
#include "include/private/base/SkMalloc.h"
#include "include/private/gpu/ganesh/GrTypesPriv.h"
#include "src/core/SkMessageBus.h"
#include "src/core/SkTraceEvent.h"
#include "src/gpu/ResourceKey.h"
#include "src/gpu/ganesh/GrAppliedClip.h"
#include "src/gpu/ganesh/GrAuditTrail.h"
#include "src/gpu/ganesh/GrBuffer.h"
#include "src/gpu/ganesh/GrCaps.h"
#include "src/gpu/ganesh/GrDefaultGeoProcFactory.h"
#include "src/gpu/ganesh/GrDrawOpTest.h"
#include "src/gpu/ganesh/GrEagerVertexAllocator.h"
#include "src/gpu/ganesh/GrGeometryProcessor.h"
#include "src/gpu/ganesh/GrGpuBuffer.h"
#include "src/gpu/ganesh/GrMeshDrawTarget.h"
#include "src/gpu/ganesh/GrOpFlushState.h"
#include "src/gpu/ganesh/GrPaint.h"
#include "src/gpu/ganesh/GrProcessorAnalysis.h"
#include "src/gpu/ganesh/GrProcessorSet.h"
#include "src/gpu/ganesh/GrProgramInfo.h"
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
#include "src/gpu/ganesh/GrResourceProvider.h"
#include "src/gpu/ganesh/GrSimpleMesh.h"
#include "src/gpu/ganesh/GrStyle.h"
#include "src/gpu/ganesh/GrThreadSafeCache.h"
#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/geometry/GrAATriangulator.h"
#include "src/gpu/ganesh/geometry/GrPathUtils.h"
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
#include "src/gpu/ganesh/geometry/GrTriangulator.h"
#include "src/gpu/ganesh/ops/GrMeshDrawOp.h"
#include "src/gpu/ganesh/ops/GrOp.h"
#include "src/gpu/ganesh/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
#if defined(GPU_TEST_UTILS)
#include "src/base/SkRandom.h"
#include "src/gpu/ganesh/GrTestUtils.h"
#endif
#include <array>
#include <cstdint>
#include <cstring>
#include <utility>
class GrDstProxyView;
class GrSurfaceProxyView;
class SkArenaAlloc;
enum class GrXferBarrierFlags;
struct GrUserStencilSettings;
#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
#ifndef GR_AA_TESSELLATOR_MAX_VERB_COUNT
#define GR_AA_TESSELLATOR_MAX_VERB_COUNT …
#endif
namespace {
struct TessInfo { … };
static sk_sp<SkData> create_data(int numVertices, bool isLinear, SkScalar tol) { … }
bool cache_match(const SkData* data, SkScalar tol) { … }
bool is_newer_better(SkData* incumbent, SkData* challenger) { … }
class UniqueKeyInvalidator : public SkIDChangeListener { … };
class StaticVertexAllocator : public GrEagerVertexAllocator { … };
class TriangulatingPathOp final : public GrMeshDrawOp { … };
}
#if defined(GPU_TEST_UTILS)
GR_DRAW_OP_TEST_DEFINE(TriangulatingPathOp) {
SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random);
const SkPath& path = GrTest::TestPath(random);
SkIRect devClipBounds = SkIRect::MakeLTRB(
random->nextU(), random->nextU(), random->nextU(), random->nextU());
devClipBounds.sort();
static constexpr GrAAType kAATypes[] = {GrAAType::kNone, GrAAType::kMSAA, GrAAType::kCoverage};
GrAAType aaType;
do {
aaType = kAATypes[random->nextULessThan(std::size(kAATypes))];
} while(GrAAType::kMSAA == aaType && numSamples <= 1);
GrStyle style;
do {
GrTest::TestStyle(random, &style);
} while (!style.isSimpleFill());
GrStyledShape shape(path, style);
return TriangulatingPathOp::Make(context, std::move(paint), shape, viewMatrix, devClipBounds,
aaType, GrGetRandomStencil(random, context));
}
#endif
namespace skgpu::ganesh {
TriangulatingPathRenderer::TriangulatingPathRenderer()
: … { … }
PathRenderer::CanDrawPath TriangulatingPathRenderer::onCanDrawPath(
const CanDrawPathArgs& args) const { … }
bool TriangulatingPathRenderer::onDrawPath(const DrawPathArgs& args) { … }
}
#endif