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/GrMeshDrawOp.cpp b/src/gpu/ops/GrMeshDrawOp.cpp
index 3250a22..1974fc6 100644
--- a/src/gpu/ops/GrMeshDrawOp.cpp
+++ b/src/gpu/ops/GrMeshDrawOp.cpp
@@ -100,10 +100,14 @@
GrPipeline::FixedDynamicState* GrMeshDrawOp::Target::MakeFixedDynamicState(
SkArenaAlloc* arena, const GrAppliedClip* clip, int numPrimProcTextures) {
- if ((clip && clip->scissorState().enabled()) || numPrimProcTextures) {
- const SkIRect& scissor = (clip) ? clip->scissorState().rect() : SkIRect::MakeEmpty();
+ bool haveScissor = clip && clip->scissorState().enabled();
- auto result = arena->make<GrPipeline::FixedDynamicState>(scissor);
+ if (haveScissor || numPrimProcTextures) {
+ auto result = arena->make<GrPipeline::FixedDynamicState>();
+
+ if (haveScissor) {
+ result->fScissorRect = clip->scissorState().rect();
+ }
if (numPrimProcTextures) {
result->fPrimitiveProcessorTextures = arena->makeArrayDefault<GrTextureProxy*>(