Only access the scissorState's rect when it is valid
It is odd asan/valgrind hasn't been complaining about this
Change-Id: I8e7952e6fc554450ff8c5c5940500f09be48d6b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255144
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ops/GrDrawPathOp.cpp b/src/gpu/ops/GrDrawPathOp.cpp
index c0cc4d4..51f5291 100644
--- a/src/gpu/ops/GrDrawPathOp.cpp
+++ b/src/gpu/ops/GrDrawPathOp.cpp
@@ -89,7 +89,14 @@
void GrDrawPathOp::onExecute(GrOpFlushState* state, const SkRect& chainBounds) {
GrAppliedClip appliedClip = state->detachAppliedClip();
- GrPipeline::FixedDynamicState fixedDynamicState(appliedClip.scissorState().rect());
+
+ GrPipeline::FixedDynamicState* fixedDynamicState = nullptr, storage;
+
+ if (appliedClip.scissorState().enabled()) {
+ storage.fScissorRect = appliedClip.scissorState().rect();
+ fixedDynamicState = &storage;
+ }
+
GrPipeline pipeline(this->pipelineInitArgs(*state), this->detachProcessors(),
std::move(appliedClip));
sk_sp<GrPathProcessor> pathProc(GrPathProcessor::Create(this->color(), this->viewMatrix()));
@@ -99,7 +106,7 @@
state->drawOpArgs().origin(),
&pipeline,
pathProc.get(),
- &fixedDynamicState,
+ fixedDynamicState,
nullptr, 0,
GrPrimitiveType::kPath);