Flutter Engine
The Flutter Engine
Public Member Functions | Friends | List of all members
GrBackendRenderTarget Class Reference

#include <GrBackendSurface.h>

Public Member Functions

 GrBackendRenderTarget ()
 
 GrBackendRenderTarget (int width, int height, int sampleCnt, int stencilBits, const GrMockRenderTargetInfo &mockInfo)
 
 ~GrBackendRenderTarget ()
 
 GrBackendRenderTarget (const GrBackendRenderTarget &that)
 
GrBackendRenderTargetoperator= (const GrBackendRenderTarget &)
 
SkISize dimensions () const
 
int width () const
 
int height () const
 
int sampleCnt () const
 
int stencilBits () const
 
GrBackendApi backend () const
 
bool isFramebufferOnly () const
 
GrBackendFormat getBackendFormat () const
 
bool getMockRenderTargetInfo (GrMockRenderTargetInfo *) const
 
void setMutableState (const skgpu::MutableTextureState &)
 
bool isProtected () const
 
bool isValid () const
 

Friends

class GrBackendSurfacePriv
 
class GrBackendRenderTargetData
 
class GrVkGpu
 

Detailed Description

Definition at line 283 of file GrBackendSurface.h.

Constructor & Destructor Documentation

◆ GrBackendRenderTarget() [1/3]

GrBackendRenderTarget::GrBackendRenderTarget ( )

Definition at line 493 of file GrBackendSurface.cpp.

493: fIsValid(false) {}

◆ GrBackendRenderTarget() [2/3]

GrBackendRenderTarget::GrBackendRenderTarget ( int  width,
int  height,
int  sampleCnt,
int  stencilBits,
const GrMockRenderTargetInfo mockInfo 
)

Definition at line 516 of file GrBackendSurface.cpp.

521 : fIsValid(true)
522 , fWidth(width)
523 , fHeight(height)
524 , fSampleCnt(std::max(1, sampleCnt))
525 , fStencilBits(stencilBits)
526 , fBackend(GrBackendApi::kMock)
527 , fMockInfo(mockInfo) {}
GrMockRenderTargetInfo fMockInfo
static float max(float r, float g, float b)
Definition: hsl.cpp:49

◆ ~GrBackendRenderTarget()

GrBackendRenderTarget::~GrBackendRenderTarget ( )

Definition at line 529 of file GrBackendSurface.cpp.

529 {
530 this->cleanup();
531}

◆ GrBackendRenderTarget() [3/3]

GrBackendRenderTarget::GrBackendRenderTarget ( const GrBackendRenderTarget that)

Definition at line 542 of file GrBackendSurface.cpp.

542 : fIsValid(false) {
543 *this = that;
544}

Member Function Documentation

◆ backend()

GrBackendApi GrBackendRenderTarget::backend ( ) const
inline

Definition at line 310 of file GrBackendSurface.h.

310{return fBackend; }

◆ dimensions()

SkISize GrBackendRenderTarget::dimensions ( ) const
inline

Definition at line 305 of file GrBackendSurface.h.

305{ return {fWidth, fHeight}; }

◆ getBackendFormat()

GrBackendFormat GrBackendRenderTarget::getBackendFormat ( ) const

Definition at line 614 of file GrBackendSurface.cpp.

614 {
615 if (!this->isValid()) {
616 return GrBackendFormat();
617 }
618 switch (fBackend) {
622 return fRTData->getBackendFormat();
623#ifdef SK_DIRECT3D
625 auto info = fD3DInfo.snapTextureResourceInfo();
626 return GrBackendFormat::MakeDxgi(info.fFormat);
627 }
628#endif
631 default:
632 return GrBackendFormat();
633 }
634}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
virtual GrBackendFormat getBackendFormat() const =0
GrBackendFormat getBackendFormat() const
Definition: GrMockTypes.cpp:15

◆ getMockRenderTargetInfo()

bool GrBackendRenderTarget::getMockRenderTargetInfo ( GrMockRenderTargetInfo outInfo) const

Definition at line 636 of file GrBackendSurface.cpp.

636 {
637 if (this->isValid() && GrBackendApi::kMock == fBackend) {
638 *outInfo = fMockInfo;
639 return true;
640 }
641 return false;
642}

◆ height()

int GrBackendRenderTarget::height ( ) const
inline

Definition at line 307 of file GrBackendSurface.h.

307{ return fHeight; }

◆ isFramebufferOnly()

bool GrBackendRenderTarget::isFramebufferOnly ( ) const
inline

Definition at line 311 of file GrBackendSurface.h.

311{ return fFramebufferOnly; }

◆ isProtected()

bool GrBackendRenderTarget::isProtected ( ) const

Definition at line 648 of file GrBackendSurface.cpp.

648 {
649 if (!this->isValid()) {
650 return false;
651 }
652 if (this->backend() == GrBackendApi::kOpenGL || this->backend() == GrBackendApi::kVulkan) {
653 return fRTData->isProtected();
654 }
655 if (this->backend() == GrBackendApi::kMock) {
656 return fMockInfo.isProtected();
657 }
658
659 return false;
660}
virtual bool isProtected() const =0
GrBackendApi backend() const
bool isProtected() const
Definition: GrMockTypes.h:93

◆ isValid()

bool GrBackendRenderTarget::isValid ( ) const
inline

Definition at line 341 of file GrBackendSurface.h.

341{ return fIsValid; }

◆ operator=()

GrBackendRenderTarget & GrBackendRenderTarget::operator= ( const GrBackendRenderTarget that)

Definition at line 546 of file GrBackendSurface.cpp.

546 {
547 if (this == &that) {
548 return *this;
549 }
550
551 if (!that.isValid()) {
552 this->cleanup();
553 fIsValid = false;
554 return *this;
555 } else if (fIsValid && this->fBackend != that.fBackend) {
556 this->cleanup();
557 fIsValid = false;
558 }
559 fWidth = that.fWidth;
560 fHeight = that.fHeight;
561 fSampleCnt = that.fSampleCnt;
562 fStencilBits = that.fStencilBits;
563 fBackend = that.fBackend;
564
565 switch (that.fBackend) {
569 fRTData.reset();
570 that.fRTData->copyTo(fRTData);
571 break;
572#ifdef SK_DIRECT3D
574 fD3DInfo.assign(that.fD3DInfo, this->isValid());
575 break;
576#endif
578 fMockInfo = that.fMockInfo;
579 break;
580 default:
581 SK_ABORT("Unknown GrBackend");
582 }
583 fIsValid = that.fIsValid;
584 return *this;
585}
#define SK_ABORT(message,...)
Definition: SkAssert.h:70
virtual void copyTo(AnyRenderTargetData &) const =0

◆ sampleCnt()

int GrBackendRenderTarget::sampleCnt ( ) const
inline

Definition at line 308 of file GrBackendSurface.h.

308{ return fSampleCnt; }

◆ setMutableState()

void GrBackendRenderTarget::setMutableState ( const skgpu::MutableTextureState state)

Definition at line 644 of file GrBackendSurface.cpp.

644 {
645 fRTData->setMutableState(state);
646}
virtual void setMutableState(const skgpu::MutableTextureState &)
AtkStateType state

◆ stencilBits()

int GrBackendRenderTarget::stencilBits ( ) const
inline

Definition at line 309 of file GrBackendSurface.h.

309{ return fStencilBits; }

◆ width()

int GrBackendRenderTarget::width ( ) const
inline

Definition at line 306 of file GrBackendSurface.h.

306{ return fWidth; }

Friends And Related Function Documentation

◆ GrBackendRenderTargetData

friend class GrBackendRenderTargetData
friend

Definition at line 355 of file GrBackendSurface.h.

◆ GrBackendSurfacePriv

friend class GrBackendSurfacePriv
friend

Definition at line 354 of file GrBackendSurface.h.

◆ GrVkGpu

friend class GrVkGpu
friend

Definition at line 377 of file GrBackendSurface.h.

Member Data Documentation

◆ fMockInfo

GrMockRenderTargetInfo GrBackendRenderTarget::fMockInfo

Definition at line 405 of file GrBackendSurface.h.


The documentation for this class was generated from the following files: