Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrRenderTarget.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2011 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
10
11#include "src/core/SkRectPriv.h"
16
18 const SkISize& dimensions,
19 int sampleCount,
20 GrProtected isProtected,
21 std::string_view label,
22 sk_sp<GrAttachment> stencil)
23 : INHERITED(gpu, dimensions, isProtected, label)
24 , fSampleCnt(sampleCount) {
25 if (this->numSamples() > 1) {
26 fMSAAStencilAttachment = std::move(stencil);
27 } else {
28 fStencilAttachment = std::move(stencil);
29 }
30}
31
33
35 fStencilAttachment = nullptr;
36 fMSAAStencilAttachment = nullptr;
37
39}
40
42 fStencilAttachment = nullptr;
43 fMSAAStencilAttachment = nullptr;
44
46}
47
49 auto stencilAttachment = (useMSAASurface) ? &GrRenderTarget::fMSAAStencilAttachment
50 : &GrRenderTarget::fStencilAttachment;
51 if (!stencil && !(this->*stencilAttachment)) {
52 // No need to do any work since we currently don't have a stencil attachment and
53 // we're not actually adding one.
54 return;
55 }
56
57 if (!this->completeStencilAttachment(stencil.get(), useMSAASurface)) {
58 return;
59 }
60
61 this->*stencilAttachment = std::move(stencil);
62}
63
64int GrRenderTarget::numStencilBits(bool useMSAASurface) const {
65 return GrBackendFormatStencilBits(this->getStencilAttachment(useMSAASurface)->backendFormat());
66}
int GrBackendFormatStencilBits(const GrBackendFormat &format)
Definition GrGpu.h:62
GrAttachment * getStencilAttachment() const
void onAbandon() override
void onRelease() override
void attachStencilAttachment(sk_sp< GrAttachment > stencil, bool useMSAASurface)
int numSamples() const
GrRenderTarget(GrGpu *, const SkISize &, int sampleCount, GrProtected, std::string_view label, sk_sp< GrAttachment > stenicl=nullptr)
virtual bool completeStencilAttachment(GrAttachment *stencil, bool useMSAASurface)=0
~GrRenderTarget() override
int numStencilBits(bool useMSAASurface) const
virtual GrBackendFormat backendFormat() const =0
void onAbandon() override
Definition GrSurface.cpp:86
void onRelease() override
Definition GrSurface.cpp:81
T * get() const
Definition SkRefCnt.h:303
Protected
Definition GpuTypes.h:61