#include "src/gpu/ganesh/ops/AALinearizingConvexPathRenderer.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.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/SkStrokeRec.h"
#include "include/gpu/ganesh/GrRecordingContext.h"
#include "include/private/SkColorData.h"
#include "include/private/base/SkAssert.h"
#include "include/private/base/SkDebug.h"
#include "include/private/base/SkMalloc.h"
#include "include/private/base/SkMath.h"
#include "include/private/base/SkTArray.h"
#include "include/private/base/SkTDArray.h"
#include "include/private/gpu/ganesh/GrTypesPriv.h"
#include "src/gpu/BufferWriter.h"
#include "src/gpu/ganesh/GrAppliedClip.h"
#include "src/gpu/ganesh/GrAuditTrail.h"
#include "src/gpu/ganesh/GrBuffer.h"
#include "src/gpu/ganesh/GrDefaultGeoProcFactory.h"
#include "src/gpu/ganesh/GrDrawOpTest.h"
#include "src/gpu/ganesh/GrGeometryProcessor.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/GrSimpleMesh.h"
#include "src/gpu/ganesh/GrStyle.h"
#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/geometry/GrAAConvexTessellator.h"
#include "src/gpu/ganesh/geometry/GrStyledShape.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 <algorithm>
#include <cstdint>
#include <cstring>
#include <utility>
class GrCaps;
class GrDstProxyView;
class GrSurfaceProxyView;
class SkArenaAlloc;
enum class GrXferBarrierFlags;
struct GrUserStencilSettings;
usingnamespaceskia_private;
namespace skgpu::ganesh {
namespace {
static const int DEFAULT_BUFFER_SIZE = …;
static const SkScalar kMaxStrokeWidth = …;
void extract_verts(const GrAAConvexTessellator& tess,
const SkMatrix* localCoordsMatrix,
void* vertData,
const VertexColor& color,
uint16_t firstIndex,
uint16_t* idxs) { … }
GrGeometryProcessor* create_lines_only_gp(SkArenaAlloc* arena,
bool tweakAlphaForCoverage,
bool usesLocalCoords,
bool wideColor) { … }
class AAFlatteningConvexPathOp final : public GrMeshDrawOp { … };
}
PathRenderer::CanDrawPath
AALinearizingConvexPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { … }
bool AALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) { … }
}
#if defined(GPU_TEST_UTILS)
GR_DRAW_OP_TEST_DEFINE(AAFlatteningConvexPathOp) {
SkMatrix viewMatrix = GrTest::TestMatrixPreservesRightAngles(random);
const SkPath& path = GrTest::TestPathConvex(random);
SkStrokeRec::Style styles[3] = { SkStrokeRec::kFill_Style,
SkStrokeRec::kStroke_Style,
SkStrokeRec::kStrokeAndFill_Style };
SkStrokeRec::Style style = styles[random->nextU() % 3];
SkScalar strokeWidth = -1.f;
SkPaint::Join join = SkPaint::kMiter_Join;
SkScalar miterLimit = 0.5f;
if (SkStrokeRec::kFill_Style != style) {
strokeWidth = random->nextRangeF(1.0f, 10.0f);
if (random->nextBool()) {
join = SkPaint::kMiter_Join;
} else {
join = SkPaint::kBevel_Join;
}
miterLimit = random->nextRangeF(0.5f, 2.0f);
}
const GrUserStencilSettings* stencilSettings = GrGetRandomStencil(random, context);
return skgpu::ganesh::AAFlatteningConvexPathOp::Make(context,
std::move(paint),
viewMatrix,
path,
strokeWidth,
style,
join,
miterLimit,
stencilSettings);
}
#endif