1 /*
2 * Copyright 2018 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "src/gpu/ops/GrClearStencilClipOp.h"
9
10 #include "include/private/GrRecordingContext.h"
11 #include "src/gpu/GrGpuCommandBuffer.h"
12 #include "src/gpu/GrMemoryPool.h"
13 #include "src/gpu/GrOpFlushState.h"
14 #include "src/gpu/GrRecordingContextPriv.h"
15
Make(GrRecordingContext * context,const GrFixedClip & clip,bool insideStencilMask,GrRenderTargetProxy * proxy)16 std::unique_ptr<GrOp> GrClearStencilClipOp::Make(GrRecordingContext* context,
17 const GrFixedClip& clip,
18 bool insideStencilMask,
19 GrRenderTargetProxy* proxy) {
20 GrOpMemoryPool* pool = context->priv().opMemoryPool();
21
22 return pool->allocate<GrClearStencilClipOp>(clip, insideStencilMask, proxy);
23 }
24
onExecute(GrOpFlushState * state,const SkRect & chainBounds)25 void GrClearStencilClipOp::onExecute(GrOpFlushState* state, const SkRect& chainBounds) {
26 SkASSERT(state->rtCommandBuffer());
27 state->rtCommandBuffer()->clearStencilClip(fClip, fInsideStencilMask);
28 }
29