Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
PromiseImageCallbackContext Class Reference

#include <DDLPromiseImageHelper.h>

Inheritance diagram for PromiseImageCallbackContext:
SkRefCnt SkRefCntBase

Public Member Functions

 PromiseImageCallbackContext (GrDirectContext *direct, GrBackendFormat backendFormat)
 
 ~PromiseImageCallbackContext () override
 
const GrBackendFormatbackendFormat () const
 
void setBackendTexture (const GrBackendTexture &backendTexture)
 
void destroyBackendTexture ()
 
sk_sp< GrPromiseImageTexturefulfill ()
 
void release ()
 
void wasAddedToImage ()
 
const GrPromiseImageTexturepromiseImageTexture () const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Static Public Member Functions

static sk_sp< GrPromiseImageTexturePromiseImageFulfillProc (void *textureContext)
 
static void PromiseImageReleaseProc (void *textureContext)
 

Detailed Description

Definition at line 34 of file DDLPromiseImageHelper.h.

Constructor & Destructor Documentation

◆ PromiseImageCallbackContext()

PromiseImageCallbackContext::PromiseImageCallbackContext ( GrDirectContext direct,
GrBackendFormat  backendFormat 
)
inline

Definition at line 36 of file DDLPromiseImageHelper.h.

37 : fContext(direct)
38 , fBackendFormat(backendFormat) {}
const GrBackendFormat & backendFormat() const

◆ ~PromiseImageCallbackContext()

PromiseImageCallbackContext::~PromiseImageCallbackContext ( )
override

Definition at line 74 of file DDLPromiseImageHelper.cpp.

74 {
75 SkASSERT(fDoneCnt == fNumImages);
76 SkASSERT(!fTotalFulfills || fDoneCnt);
77
78 if (fPromiseImageTexture) {
79 fContext->deleteBackendTexture(fPromiseImageTexture->backendTexture());
80 }
81}
#define SkASSERT(cond)
Definition: SkAssert.h:116
void deleteBackendTexture(const GrBackendTexture &)
GrBackendTexture backendTexture() const

Member Function Documentation

◆ backendFormat()

const GrBackendFormat & PromiseImageCallbackContext::backendFormat ( ) const
inline

Definition at line 42 of file DDLPromiseImageHelper.h.

42{ return fBackendFormat; }

◆ destroyBackendTexture()

void PromiseImageCallbackContext::destroyBackendTexture ( )

Definition at line 89 of file DDLPromiseImageHelper.cpp.

89 {
90 SkASSERT(!fPromiseImageTexture || fPromiseImageTexture->unique());
91
92 if (fPromiseImageTexture) {
93 fContext->deleteBackendTexture(fPromiseImageTexture->backendTexture());
94 }
95 fPromiseImageTexture = nullptr;
96}
bool unique() const
Definition: SkRefCnt.h:175

◆ fulfill()

sk_sp< GrPromiseImageTexture > PromiseImageCallbackContext::fulfill ( )
inline

Definition at line 48 of file DDLPromiseImageHelper.h.

48 {
49 ++fTotalFulfills;
50 return fPromiseImageTexture;
51 }

◆ PromiseImageFulfillProc()

static sk_sp< GrPromiseImageTexture > PromiseImageCallbackContext::PromiseImageFulfillProc ( void *  textureContext)
inlinestatic

Definition at line 64 of file DDLPromiseImageHelper.h.

64 {
65 auto callbackContext = static_cast<PromiseImageCallbackContext*>(textureContext);
66 return callbackContext->fulfill();
67 }
sk_sp< GrPromiseImageTexture > fulfill()

◆ PromiseImageReleaseProc()

static void PromiseImageCallbackContext::PromiseImageReleaseProc ( void *  textureContext)
inlinestatic

Definition at line 69 of file DDLPromiseImageHelper.h.

69 {
70 auto callbackContext = static_cast<PromiseImageCallbackContext*>(textureContext);
71 callbackContext->release();
72 callbackContext->unref();
73 }

◆ promiseImageTexture()

const GrPromiseImageTexture * PromiseImageCallbackContext::promiseImageTexture ( ) const
inline

Definition at line 60 of file DDLPromiseImageHelper.h.

60 {
61 return fPromiseImageTexture.get();
62 }
T * get() const
Definition: SkRefCnt.h:303

◆ release()

void PromiseImageCallbackContext::release ( )
inline

Definition at line 53 of file DDLPromiseImageHelper.h.

53 {
54 ++fDoneCnt;
55 SkASSERT(fDoneCnt <= fNumImages);
56 }

◆ setBackendTexture()

void PromiseImageCallbackContext::setBackendTexture ( const GrBackendTexture backendTexture)

Definition at line 83 of file DDLPromiseImageHelper.cpp.

83 {
84 SkASSERT(!fPromiseImageTexture);
85 SkASSERT(fBackendFormat == backendTexture.getBackendFormat());
86 fPromiseImageTexture = GrPromiseImageTexture::Make(backendTexture);
87}
GrBackendFormat getBackendFormat() const
static sk_sp< GrPromiseImageTexture > Make(const GrBackendTexture &backendTexture)

◆ wasAddedToImage()

void PromiseImageCallbackContext::wasAddedToImage ( )
inline

Definition at line 58 of file DDLPromiseImageHelper.h.

58{ fNumImages++; }

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