blob: 7ca4063b967c6297f64eb9e40f5d177d0295aa53 [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"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "src/gpu/GrMemoryPool.h"
12#include "src/gpu/GrOpFlushState.h"
Greg Daniel2d41d0d2019-08-26 11:08:51 -040013#include "src/gpu/GrOpsRenderPass.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050014#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) {
Greg Daniel2d41d0d2019-08-26 11:08:51 -040026 SkASSERT(state->opsRenderPass());
27 state->opsRenderPass()->clearStencilClip(fClip, fInsideStencilMask);
Robert Phillips7c525e62018-06-12 10:11:12 -040028}