blob: dfe826806d6357b572b734e246a827adc8569d51 [file] [log] [blame]
Robert Phillips7c525e62018-06-12 10:11:12 -04001/*
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
Mike Kleinc0bd9f92019-04-23 12:05:21 -05008#include "src/gpu/ops/GrClearStencilClipOp.h"
Robert Phillips7c525e62018-06-12 10:11:12 -04009
Mike Kleinc0bd9f92019-04-23 12:05:21 -050010#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"
Robert Phillips7c525e62018-06-12 10:11:12 -040015
Robert Phillipsb97da532019-02-12 15:24:12 -050016std::unique_ptr<GrOp> GrClearStencilClipOp::Make(GrRecordingContext* context,
Robert Phillips7c525e62018-06-12 10:11:12 -040017 const GrFixedClip& clip,
18 bool insideStencilMask,
19 GrRenderTargetProxy* proxy) {
Robert Phillips9da87e02019-02-04 13:26:26 -050020 GrOpMemoryPool* pool = context->priv().opMemoryPool();
Robert Phillipsc994a932018-06-19 13:09:54 -040021
22 return pool->allocate<GrClearStencilClipOp>(clip, insideStencilMask, proxy);
Robert Phillips7c525e62018-06-12 10:11:12 -040023}
24
Brian Salomon588cec72018-11-14 13:56:37 -050025void GrClearStencilClipOp::onExecute(GrOpFlushState* state, const SkRect& chainBounds) {
Robert Phillips7c525e62018-06-12 10:11:12 -040026 SkASSERT(state->rtCommandBuffer());
27 state->rtCommandBuffer()->clearStencilClip(fClip, fInsideStencilMask);
28}