Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
GrBackendTexture Class Reference

#include <GrBackendSurface.h>

Public Member Functions

 GrBackendTexture ()
 
 GrBackendTexture (int width, int height, skgpu::Mipmapped, const GrMockTextureInfo &mockInfo, std::string_view label={})
 
 GrBackendTexture (const GrBackendTexture &that)
 
 ~GrBackendTexture ()
 
GrBackendTextureoperator= (const GrBackendTexture &that)
 
SkISize dimensions () const
 
int width () const
 
int height () const
 
std::string_view getLabel () const
 
skgpu::Mipmapped mipmapped () const
 
bool hasMipmaps () const
 
GrBackendApi backend () const
 
GrTextureType textureType () const
 
GrBackendFormat getBackendFormat () const
 
bool getMockTextureInfo (GrMockTextureInfo *) const
 
void setMutableState (const skgpu::MutableTextureState &)
 
bool isProtected () const
 
bool isValid () const
 
bool isSameTexture (const GrBackendTexture &)
 

Friends

class GrBackendSurfacePriv
 
class GrBackendTextureData
 
class GrVkGpu
 

Detailed Description

Definition at line 149 of file GrBackendSurface.h.

Constructor & Destructor Documentation

◆ GrBackendTexture() [1/3]

GrBackendTexture::GrBackendTexture ( )

Definition at line 261 of file GrBackendSurface.cpp.

261: fIsValid(false) {}

◆ GrBackendTexture() [2/3]

GrBackendTexture::GrBackendTexture ( int  width,
int  height,
skgpu::Mipmapped  mipmapped,
const GrMockTextureInfo mockInfo,
std::string_view  label = {} 
)

Definition at line 290 of file GrBackendSurface.cpp.

295 : fIsValid(true)
296 , fWidth(width)
297 , fHeight(height)
298 , fLabel(label)
299 , fMipmapped(mipmapped)
300 , fBackend(GrBackendApi::kMock)
301 , fTextureType(GrTextureType::k2D)
302 , fMockInfo(mockInfo) {}
skgpu::Mipmapped mipmapped() const
GrMockTextureInfo fMockInfo

◆ GrBackendTexture() [3/3]

GrBackendTexture::GrBackendTexture ( const GrBackendTexture that)

Definition at line 317 of file GrBackendSurface.cpp.

317 : fIsValid(false) {
318 *this = that;
319}

◆ ~GrBackendTexture()

GrBackendTexture::~GrBackendTexture ( )

Definition at line 304 of file GrBackendSurface.cpp.

304 {
305 this->cleanup();
306}

Member Function Documentation

◆ backend()

GrBackendApi GrBackendTexture::backend ( ) const
inline

Definition at line 179 of file GrBackendSurface.h.

179{return fBackend; }

◆ dimensions()

SkISize GrBackendTexture::dimensions ( ) const
inline

Definition at line 173 of file GrBackendSurface.h.

173{ return {fWidth, fHeight}; }

◆ getBackendFormat()

GrBackendFormat GrBackendTexture::getBackendFormat ( ) const

Definition at line 439 of file GrBackendSurface.cpp.

439 {
440 if (!this->isValid()) {
441 return GrBackendFormat();
442 }
443 switch (fBackend) {
447 return fTextureData->getBackendFormat();
448#ifdef SK_DIRECT3D
450 auto d3dInfo = fD3DInfo.snapTextureResourceInfo();
451 return GrBackendFormat::MakeDxgi(d3dInfo.fFormat);
452 }
453#endif
456 default:
457 return GrBackendFormat();
458 }
459}
virtual GrBackendFormat getBackendFormat() const =0
GrBackendFormat getBackendFormat() const

◆ getLabel()

std::string_view GrBackendTexture::getLabel ( ) const
inline

Definition at line 176 of file GrBackendSurface.h.

176{ return fLabel; }

◆ getMockTextureInfo()

bool GrBackendTexture::getMockTextureInfo ( GrMockTextureInfo outInfo) const

Definition at line 389 of file GrBackendSurface.cpp.

389 {
390 if (this->isValid() && GrBackendApi::kMock == fBackend) {
391 *outInfo = fMockInfo;
392 return true;
393 }
394 return false;
395}

◆ hasMipmaps()

bool GrBackendTexture::hasMipmaps ( ) const
inline

Definition at line 178 of file GrBackendSurface.h.

178{ return fMipmapped == skgpu::Mipmapped::kYes; }

◆ height()

int GrBackendTexture::height ( ) const
inline

Definition at line 175 of file GrBackendSurface.h.

175{ return fHeight; }

◆ isProtected()

bool GrBackendTexture::isProtected ( ) const

Definition at line 401 of file GrBackendSurface.cpp.

401 {
402 if (!this->isValid()) {
403 return false;
404 }
405 if (this->backend() == GrBackendApi::kOpenGL || this->backend() == GrBackendApi::kVulkan) {
406 return fTextureData->isProtected();
407 }
408 if (this->backend() == GrBackendApi::kMock) {
409 return fMockInfo.isProtected();
410 }
411
412 return false;
413}
virtual bool isProtected() const =0
GrBackendApi backend() const
bool isProtected() const
Definition GrMockTypes.h:59

◆ isSameTexture()

bool GrBackendTexture::isSameTexture ( const GrBackendTexture that)

Definition at line 415 of file GrBackendSurface.cpp.

415 {
416 if (!this->isValid() || !that.isValid()) {
417 return false;
418 }
419 if (fBackend != that.fBackend) {
420 return false;
421 }
422 switch (fBackend) {
426 return fTextureData->isSameTexture(that.fTextureData.get());
427#ifdef SK_DIRECT3D
429 return fD3DInfo.snapTextureResourceInfo().fResource ==
430 that.fD3DInfo.snapTextureResourceInfo().fResource;
431#endif
433 return fMockInfo.id() == that.fMockInfo.id();
434 default:
435 return false;
436 }
437}
virtual bool isSameTexture(const GrBackendTextureData *) const =0
const Base * get() const
int id() const
Definition GrMockTypes.h:56

◆ isValid()

bool GrBackendTexture::isValid ( ) const
inline

Definition at line 211 of file GrBackendSurface.h.

211{ return fIsValid; }

◆ mipmapped()

skgpu::Mipmapped GrBackendTexture::mipmapped ( ) const
inline

Definition at line 177 of file GrBackendSurface.h.

177{ return fMipmapped; }

◆ operator=()

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

Definition at line 321 of file GrBackendSurface.cpp.

321 {
322 if (this == &that) {
323 return *this;
324 }
325
326 if (!that.isValid()) {
327 this->cleanup();
328 fIsValid = false;
329 return *this;
330 } else if (fIsValid && this->fBackend != that.fBackend) {
331 this->cleanup();
332 fIsValid = false;
333 }
334 fWidth = that.fWidth;
335 fHeight = that.fHeight;
336 fMipmapped = that.fMipmapped;
337 fBackend = that.fBackend;
338 fTextureType = that.fTextureType;
339
340 switch (that.fBackend) {
344 fTextureData.reset();
345 that.fTextureData->copyTo(fTextureData);
346 break;
347#ifdef SK_DIRECT3D
349 fD3DInfo.assign(that.fD3DInfo, this->isValid());
350 break;
351#endif
353 fMockInfo = that.fMockInfo;
354 break;
355 default:
356 SK_ABORT("Unknown GrBackend");
357 }
358 fIsValid = true;
359 return *this;
360}
#define SK_ABORT(message,...)
Definition SkAssert.h:70
virtual void copyTo(AnyTextureData &) const =0

◆ setMutableState()

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

Definition at line 397 of file GrBackendSurface.cpp.

397 {
398 fTextureData->setMutableState(state);
399}
virtual void setMutableState(const skgpu::MutableTextureState &)
AtkStateType state

◆ textureType()

GrTextureType GrBackendTexture::textureType ( ) const
inline

Definition at line 180 of file GrBackendSurface.h.

180{ return fTextureType; }

◆ width()

int GrBackendTexture::width ( ) const
inline

Definition at line 174 of file GrBackendSurface.h.

174{ return fWidth; }

Friends And Related Symbol Documentation

◆ GrBackendSurfacePriv

friend class GrBackendSurfacePriv
friend

Definition at line 226 of file GrBackendSurface.h.

◆ GrBackendTextureData

friend class GrBackendTextureData
friend

Definition at line 227 of file GrBackendSurface.h.

◆ GrVkGpu

friend class GrVkGpu
friend

Definition at line 249 of file GrBackendSurface.h.

Member Data Documentation

◆ fMockInfo

GrMockTextureInfo GrBackendTexture::fMockInfo

Definition at line 276 of file GrBackendSurface.h.


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