32 : Color::kPremulGrColorAttribute_Type;
34 LocalCoords::kUsePosition_Type, viewMatrix);
50 return Helper::FactoryHelper<RegionOpImpl>(context, std::move(
paint), viewMatrix,
region,
51 aaType, stencilSettings);
58 , fHelper(processorSet, aaType, stencilSettings)
60 RegionInfo&
info = fRegions.push_back();
65 this->setTransformedBounds(
bounds, viewMatrix, HasAABloat::kNo, IsHairline::kNo);
68 const char*
name()
const override {
return "GrRegionOp"; }
78 FixedFunctionFlags fixedFunctionFlags()
const override {
return fHelper.
fixedFunctionFlags(); }
83 &fRegions[0].
fColor, &fWideColor);
87 GrProgramInfo* programInfo()
override {
return fProgramInfo; }
89 void onCreateProgramInfo(
const GrCaps* caps,
99 SkDebugf(
"Couldn't create GrGeometryProcessor\n");
104 std::move(appliedClip), dstProxyView,
106 renderPassXferBarriers, colorLoadOp);
111 this->createProgramInfo(
target);
117 int numRegions = fRegions.size();
119 for (
int i = 0;
i < numRegions;
i++) {
120 numRects += fRegions[
i].fRegion.computeRegionComplexity();
131 SkDebugf(
"Could not allocate vertices\n");
135 for (
int i = 0;
i < numRegions;
i++) {
138 while (!iter.
done()) {
145 fMesh = helper.mesh();
149 if (!fProgramInfo || !fMesh) {
159 auto that = t->
cast<RegionOpImpl>();
160 if (!fHelper.
isCompatible(that->fHelper, caps, this->bounds(), that->bounds())) {
161 return CombineResult::kCannotCombine;
165 return CombineResult::kCannotCombine;
168 fRegions.push_back_n(that->fRegions.size(), that->fRegions.begin());
169 fWideColor |= that->fWideColor;
170 return CombineResult::kMerged;
173#if defined(GR_TEST_UTILS)
174 SkString onDumpInfo()
const override {
176 for (
int i = 0;
i < fRegions.size(); ++
i) {
177 const RegionInfo&
info = fRegions[
i];
178 str.
appendf(
"%d: Color: 0x%08x, Region with %d rects\n",
i,
info.fColor.toBytes_RGBA(),
179 info.fRegion.computeRegionComplexity());
181 str += fHelper.dumpInfo();
219#if defined(GR_TEST_UTILS)
223GR_DRAW_OP_TEST_DEFINE(RegionOp) {
225 int n = random->nextULessThan(200);
226 for (
int i = 0;
i < n; ++
i) {
228 center.fX = random->nextULessThan(1000);
229 center.fY = random->nextULessThan(1000);
230 int w = random->nextRangeU(10, 1000);
231 int h = random->nextRangeU(10, 1000);
243 SkMatrix viewMatrix = GrTest::TestMatrix(random);
245 if (numSamples > 1 && random->nextBool()) {
253 GrGetRandomStencil(random, context));
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
#define DEFINE_OP_CLASS_ID
std::function< void(GrSurfaceProxy *, skgpu::Mipmapped)> GrVisitProxyFunc
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
#define INHERITED(method,...)
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
static SkScalar center(float pos0, float pos1)
size_t vertexStride() const
void drawMesh(const GrSimpleMesh &mesh)
void bindPipelineAndScissorClip(const GrProgramInfo &programInfo, const SkRect &drawBounds)
void bindTextures(const GrGeometryProcessor &geomProc, const GrSurfaceProxy &singleGeomProcTexture, const GrPipeline &pipeline)
std::unique_ptr< GrOp > Owner
const GrPipeline & pipeline() const
const GrGeometryProcessor & geomProc() const
void visitFPProxies(const GrVisitProxyFunc &func) const
GrProcessorSet::Analysis finalizeProcessors(const GrCaps &caps, const GrAppliedClip *clip, GrClampType clampType, GrProcessorAnalysisCoverage geometryCoverage, GrProcessorAnalysisColor *geometryColor)
void visitProxies(const GrVisitProxyFunc &func) const
GrDrawOp::FixedFunctionFlags fixedFunctionFlags() const
bool isCompatible(const GrSimpleMeshDrawOpHelperWithStencil &that, const GrCaps &, const SkRect &thisBounds, const SkRect &thatBounds, bool ignoreAAType=false) const
GrProgramInfo * createProgramInfoWithStencil(const GrCaps *, SkArenaAlloc *, const GrSurfaceProxyView &writeView, bool usesMSAASurface, GrAppliedClip &&, const GrDstProxyView &, GrGeometryProcessor *, GrPrimitiveType, GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp)
const SkIRect & rect() const
@ kReplace_Op
replace target with operand
const SkIRect & getBounds() const
bool op(const SkIRect &rect, Op op)
void void void appendf(const char format[],...) SK_PRINTF_LIKE(2
GrGeometryProcessor * Make(SkArenaAlloc *, const Color &, const Coverage &, const LocalCoords &, const SkMatrix &viewMatrix)
Optional< SkRect > bounds
ClipOpAndAA opAA SkRegion region
sk_sp< SkBlender > blender SkRect rect
DEF_SWITCHES_START aot vmservice shared library name
GrOp::Owner Make(GrRecordingContext *context, GrPaint &&paint, const SkMatrix &viewMatrix, const SkRegion ®ion, GrAAType aaType, const GrUserStencilSettings *stencilSettings)
static SkRect Make(const SkISize &size)
static TriStrip< float > TriStripFromRect(const SkRect &r)