Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CTextureBase Class Reference

Base texture class, which holds the state of the texture, as well as all conversion functions. More...

#include <TextureBase.h>

Inheritance diagram for CTextureBase:
CTexture CDXTexture CGLESTexture CGLTexture

Public Member Functions

 CTextureBase ()=default
 
 ~CTextureBase ()=default
 
bool HasAlpha () const
 
void SetAlpha (bool hasAlpha)
 
void SetMipmapping ()
 sets mipmapping. do not use in new code. will be replaced with proper scaling.
 
bool IsMipmapped () const
 return true if we want to mipmap
 
void SetScalingMethod (TEXTURE_SCALING scalingMethod)
 sets the scaling method. scanout systems might support more than NN/linear.
 
TEXTURE_SCALING GetScalingMethod () const
 returns the scaling method.
 
int32_t GetOrientation () const
 
void SetOrientation (int orientation)
 
void SetCacheMemory (bool bCacheMemory)
 retains a shadow copy of the texture on the CPU side.
 
bool GetCacheMemory () const
 returns true if a shadow copy is kept on the CPU side.
 
uint8_tGetPixels () const
 returns a pointer to the staging texture.
 
uint32_t GetPitch () const
 return the size of one row in bytes.
 
uint32_t GetRows () const
 return the number of rows (number of blocks in the Y direction).
 
uint32_t GetTextureWidth () const
 return the total width of the texture, which might be scaled to fit its displayed size.
 
uint32_t GetTextureHeight () const
 return the total height of the texture, which might be scaled to fit its displayed size.
 
uint32_t GetWidth () const
 return the total width of "active" area, which might be equal or lower than the texture width due to alignment.
 
uint32_t GetHeight () const
 return the total height of "active" area, which might be equal or lower than the texture height due to alignment.
 
uint32_t GetOriginalWidth () const
 return the original width of the image, before scaling/cropping
 
uint32_t GetOriginalHeight () const
 return the original height of the image, before scaling/cropping
 
KD_TEX_SWIZ GetSwizzle () const
 return the texture swizzle
 
void Allocate (uint32_t width, uint32_t height, XB_FMT format)
 
void ClampToEdge ()
 

Static Public Member Functions

static uint32_t PadPow2 (uint32_t x)
 rounds to power of two. deprecated.
 
static bool SwapBlueRed (uint8_t *pixels, uint32_t height, uint32_t pitch, uint32_t elements=4, uint32_t offset=0)
 swaps the blue/red channel. deprecated in this form.
 

Protected Member Functions

uint32_t GetPitch (uint32_t width) const
 
uint32_t GetRows (uint32_t height) const
 
uint32_t GetBlockWidth () const
 
uint32_t GetBlockHeight () const
 
uint32_t GetBlockSize () const
 return the size of a compression block (tile) in bytes.
 
void SetKDFormat (XB_FMT xbFMT)
 
bool ConvertToLegacy (uint32_t width, uint32_t height, uint8_t *src)
 Textures might be in a single/dual channel format with L/A/I/LA swizzle. DX and GLES 2.0 don't handle some/all at the moment. This function can convert the texture into a traditional BGRA format.
 

Protected Attributes

uint32_t m_imageWidth {0}
 
uint32_t m_imageHeight {0}
 
uint32_t m_textureWidth {0}
 
uint32_t m_textureHeight {0}
 
uint32_t m_originalWidth {0}
 original image width before scaling or cropping
 
uint32_t m_originalHeight {0}
 original image height before scaling or cropping
 
uint8_tm_pixels {nullptr}
 
bool m_loadedToGPU {false}
 
KD_TEX_FMT m_textureFormat {KD_TEX_FMT_UNKNOWN}
 
KD_TEX_SWIZ m_textureSwizzle {KD_TEX_SWIZ_RGBA}
 
KD_TEX_COL m_textureColorspace {KD_TEX_COL_REC709}
 
KD_TEX_TRANSFER m_textureTransfer {KD_TEX_TRANSFER_SRGB}
 
KD_TEX_ALPHA m_textureAlpha {KD_TEX_ALPHA_STRAIGHT}
 
XB_FMT m_format {XB_FMT_UNKNOWN}
 
int32_t m_orientation {0}
 
bool m_mipmapping {false}
 
TEXTURE_SCALING m_scalingMethod {TEXTURE_SCALING::LINEAR}
 
bool m_bCacheMemory {false}
 

Detailed Description

Base texture class, which holds the state of the texture, as well as all conversion functions.

Constructor & Destructor Documentation

◆ CTextureBase()

CTextureBase::CTextureBase ( )
default

◆ ~CTextureBase()

CTextureBase::~CTextureBase ( )
default

Member Function Documentation

◆ Allocate()

void CTextureBase::Allocate ( uint32_t width,
uint32_t height,
XB_FMT format )

◆ ClampToEdge()

void CTextureBase::ClampToEdge ( )

◆ ConvertToLegacy()

bool CTextureBase::ConvertToLegacy ( uint32_t width,
uint32_t height,
uint8_t * src )
protected

Textures might be in a single/dual channel format with L/A/I/LA swizzle. DX and GLES 2.0 don't handle some/all at the moment. This function can convert the texture into a traditional BGRA format.

◆ GetBlockHeight()

uint32_t CTextureBase::GetBlockHeight ( ) const
protected

◆ GetBlockSize()

uint32_t CTextureBase::GetBlockSize ( ) const
protected

return the size of a compression block (tile) in bytes.

◆ GetBlockWidth()

uint32_t CTextureBase::GetBlockWidth ( ) const
protected

◆ GetCacheMemory()

bool CTextureBase::GetCacheMemory ( ) const
inline

returns true if a shadow copy is kept on the CPU side.

◆ GetHeight()

uint32_t CTextureBase::GetHeight ( ) const
inline

return the total height of "active" area, which might be equal or lower than the texture height due to alignment.

◆ GetOrientation()

int32_t CTextureBase::GetOrientation ( ) const
inline

◆ GetOriginalHeight()

uint32_t CTextureBase::GetOriginalHeight ( ) const
inline

return the original height of the image, before scaling/cropping

◆ GetOriginalWidth()

uint32_t CTextureBase::GetOriginalWidth ( ) const
inline

return the original width of the image, before scaling/cropping

◆ GetPitch() [1/2]

uint32_t CTextureBase::GetPitch ( ) const
inline

return the size of one row in bytes.

◆ GetPitch() [2/2]

uint32_t CTextureBase::GetPitch ( uint32_t width) const
protected

◆ GetPixels()

uint8_t * CTextureBase::GetPixels ( ) const
inline

returns a pointer to the staging texture.

◆ GetRows() [1/2]

uint32_t CTextureBase::GetRows ( ) const
inline

return the number of rows (number of blocks in the Y direction).

◆ GetRows() [2/2]

uint32_t CTextureBase::GetRows ( uint32_t height) const
protected

◆ GetScalingMethod()

TEXTURE_SCALING CTextureBase::GetScalingMethod ( ) const
inline

returns the scaling method.

◆ GetSwizzle()

KD_TEX_SWIZ CTextureBase::GetSwizzle ( ) const
inline

return the texture swizzle

◆ GetTextureHeight()

uint32_t CTextureBase::GetTextureHeight ( ) const
inline

return the total height of the texture, which might be scaled to fit its displayed size.

◆ GetTextureWidth()

uint32_t CTextureBase::GetTextureWidth ( ) const
inline

return the total width of the texture, which might be scaled to fit its displayed size.

◆ GetWidth()

uint32_t CTextureBase::GetWidth ( ) const
inline

return the total width of "active" area, which might be equal or lower than the texture width due to alignment.

◆ HasAlpha()

bool CTextureBase::HasAlpha ( ) const
inline

◆ IsMipmapped()

bool CTextureBase::IsMipmapped ( ) const
inline

return true if we want to mipmap

◆ PadPow2()

uint32_t CTextureBase::PadPow2 ( uint32_t x)
static

rounds to power of two. deprecated.

◆ SetAlpha()

void CTextureBase::SetAlpha ( bool hasAlpha)
inline

◆ SetCacheMemory()

void CTextureBase::SetCacheMemory ( bool bCacheMemory)
inline

retains a shadow copy of the texture on the CPU side.

◆ SetKDFormat()

void CTextureBase::SetKDFormat ( XB_FMT xbFMT)
protected

◆ SetMipmapping()

void CTextureBase::SetMipmapping ( )
inline

sets mipmapping. do not use in new code. will be replaced with proper scaling.

◆ SetOrientation()

void CTextureBase::SetOrientation ( int orientation)
inline

◆ SetScalingMethod()

void CTextureBase::SetScalingMethod ( TEXTURE_SCALING scalingMethod)
inline

sets the scaling method. scanout systems might support more than NN/linear.

◆ SwapBlueRed()

bool CTextureBase::SwapBlueRed ( uint8_t * pixels,
uint32_t height,
uint32_t pitch,
uint32_t elements = 4,
uint32_t offset = 0 )
static

swaps the blue/red channel. deprecated in this form.

Member Data Documentation

◆ m_bCacheMemory

bool CTextureBase::m_bCacheMemory {false}
protected

◆ m_format

XB_FMT CTextureBase::m_format {XB_FMT_UNKNOWN}
protected

◆ m_imageHeight

uint32_t CTextureBase::m_imageHeight {0}
protected

◆ m_imageWidth

uint32_t CTextureBase::m_imageWidth {0}
protected

◆ m_loadedToGPU

bool CTextureBase::m_loadedToGPU {false}
protected

◆ m_mipmapping

bool CTextureBase::m_mipmapping {false}
protected

◆ m_orientation

int32_t CTextureBase::m_orientation {0}
protected

◆ m_originalHeight

uint32_t CTextureBase::m_originalHeight {0}
protected

original image height before scaling or cropping

◆ m_originalWidth

uint32_t CTextureBase::m_originalWidth {0}
protected

original image width before scaling or cropping

◆ m_pixels

uint8_t* CTextureBase::m_pixels {nullptr}
protected

◆ m_scalingMethod

TEXTURE_SCALING CTextureBase::m_scalingMethod {TEXTURE_SCALING::LINEAR}
protected

◆ m_textureAlpha

KD_TEX_ALPHA CTextureBase::m_textureAlpha {KD_TEX_ALPHA_STRAIGHT}
protected

◆ m_textureColorspace

KD_TEX_COL CTextureBase::m_textureColorspace {KD_TEX_COL_REC709}
protected

◆ m_textureFormat

KD_TEX_FMT CTextureBase::m_textureFormat {KD_TEX_FMT_UNKNOWN}
protected

◆ m_textureHeight

uint32_t CTextureBase::m_textureHeight {0}
protected

◆ m_textureSwizzle

KD_TEX_SWIZ CTextureBase::m_textureSwizzle {KD_TEX_SWIZ_RGBA}
protected

◆ m_textureTransfer

KD_TEX_TRANSFER CTextureBase::m_textureTransfer {KD_TEX_TRANSFER_SRGB}
protected

◆ m_textureWidth

uint32_t CTextureBase::m_textureWidth {0}
protected

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