Reland "GrClips provided as pointers to GrRTC"
This reverts commit 074414fed53efcab7f33b06454958707419e37d8.
Reason for revert: updated to guard against nullptr before calling
quickContains(rrect).
Original change's description:
> Revert "GrClips provided as pointers to GrRTC"
>
> This reverts commit 226b689471a0fbb7400bc166032458278957541b.
>
> Reason for revert: Breaks Android roller
>
> Original change's description:
> > GrClips provided as pointers to GrRTC
> >
> > A null clip represents no high-level clipping is necessary (the implicit
> > clip to the render target's logical dimensions is fine).
> >
> > This also removes GrNoClip and GrFixedClip::Disabled() since they are
> > replaced with just nullptr.
> >
> > By allowing nullptr to represent no intended clipping, it makes it easier
> > to require GrClip and GrAppliedClip objects to know about the dimensions
> > of the device. If we required a non-null clip object to represent no
> > clipping, we'd have to have an instance for each device based on its
> > size and that just became cumbersome.
> >
> > Bug: skia:10205
> > Change-Id: Ie30cc71820b92d99356d393a4c98c8677082e761
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290539
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,csmartdalton@google.com,michaelludwig@google.com
>
> Change-Id: I42c4828bcf016ee3d30d5c20b771be96e125817b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10205
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292856
> Reviewed-by: Weston Tracey <westont@google.com>
> Commit-Queue: Weston Tracey <westont@google.com>
TBR=bsalomon@google.com,csmartdalton@google.com,michaelludwig@google.com,westont@google.com
# Not skipping CQ checks because this is a reland.
Bug: skia:10205
Change-Id: I5715a4de3b7c8847b73020dc4937d3816d879803
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292876
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index ec0ce46..9212325 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -68,15 +68,17 @@
// Gets the shape bounds, the clip bounds, and the intersection (if any). Returns false if there
// is no intersection.
bool GrSoftwarePathRenderer::GetShapeAndClipBounds(GrRenderTargetContext* renderTargetContext,
- const GrClip& clip,
+ const GrClip* clip,
const GrStyledShape& shape,
const SkMatrix& matrix,
SkIRect* unclippedDevShapeBounds,
SkIRect* clippedDevShapeBounds,
SkIRect* devClipBounds) {
// compute bounds as intersection of rt size, clip, and path
- *devClipBounds = clip.getConservativeBounds(renderTargetContext->width(),
- renderTargetContext->height());
+ *devClipBounds = clip ? clip->getConservativeBounds(renderTargetContext->width(),
+ renderTargetContext->height())
+ : SkIRect::MakeWH(renderTargetContext->width(),
+ renderTargetContext->height());
if (!get_unclipped_shape_dev_bounds(shape, matrix, unclippedDevShapeBounds)) {
*unclippedDevShapeBounds = SkIRect::MakeEmpty();
@@ -95,7 +97,7 @@
void GrSoftwarePathRenderer::DrawNonAARect(GrRenderTargetContext* renderTargetContext,
GrPaint&& paint,
const GrUserStencilSettings& userStencilSettings,
- const GrClip& clip,
+ const GrClip* clip,
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkMatrix& localMatrix) {
@@ -106,7 +108,7 @@
void GrSoftwarePathRenderer::DrawAroundInvPath(GrRenderTargetContext* renderTargetContext,
GrPaint&& paint,
const GrUserStencilSettings& userStencilSettings,
- const GrClip& clip,
+ const GrClip* clip,
const SkMatrix& viewMatrix,
const SkIRect& devClipBounds,
const SkIRect& devPathBounds) {
@@ -147,7 +149,7 @@
GrRenderTargetContext* renderTargetContext,
GrPaint&& paint,
const GrUserStencilSettings& userStencilSettings,
- const GrClip& clip,
+ const GrClip* clip,
const SkMatrix& viewMatrix,
const SkIPoint& textureOriginInDeviceSpace,
const SkIRect& deviceSpaceRectToDraw) {
@@ -241,13 +243,13 @@
args.fShape->hasUnstyledKey() && (GrAAType::kCoverage == args.fAAType);
if (!GetShapeAndClipBounds(args.fRenderTargetContext,
- *args.fClip, *args.fShape,
+ args.fClip, *args.fShape,
*args.fViewMatrix, &unclippedDevShapeBounds,
&clippedDevShapeBounds,
&devClipBounds)) {
if (inverseFilled) {
DrawAroundInvPath(args.fRenderTargetContext, std::move(args.fPaint),
- *args.fUserStencilSettings, *args.fClip, *args.fViewMatrix,
+ *args.fUserStencilSettings, args.fClip, *args.fViewMatrix,
devClipBounds, unclippedDevShapeBounds);
}
return true;
@@ -382,11 +384,11 @@
SkASSERT(view);
if (inverseFilled) {
DrawAroundInvPath(args.fRenderTargetContext, GrPaint::Clone(args.fPaint),
- *args.fUserStencilSettings, *args.fClip, *args.fViewMatrix, devClipBounds,
+ *args.fUserStencilSettings, args.fClip, *args.fViewMatrix, devClipBounds,
unclippedDevShapeBounds);
}
DrawToTargetWithShapeMask(std::move(view), args.fRenderTargetContext, std::move(args.fPaint),
- *args.fUserStencilSettings, *args.fClip, *args.fViewMatrix,
+ *args.fUserStencilSettings, args.fClip, *args.fViewMatrix,
SkIPoint{boundsForMask->fLeft, boundsForMask->fTop}, *boundsForMask);
return true;