| 55 | } |
| 56 | |
| 57 | CNativeTexture::CNativeTexture( u32 w, u32 h, ETextureFormat texture_format ) |
| 58 | : mTextureFormat( texture_format ) |
| 59 | , mWidth( w ) |
| 60 | , mHeight( h ) |
| 61 | , mCorrectedWidth( CorrectDimension( w ) ) |
| 62 | , mCorrectedHeight( CorrectDimension( h ) ) |
| 63 | , mTextureBlockWidth( GetTextureBlockWidth( mCorrectedWidth, texture_format ) ) |
| 64 | , mpData( NULL ) |
| 65 | , mpPalette( NULL ) |
| 66 | , mTextureId( 0 ) |
| 67 | { |
| 68 | glGenTextures( 1, &mTextureId ); |
| 69 | |
| 70 | size_t data_len = GetBytesRequired(); |
| 71 | mpData = malloc(data_len); |
| 72 | memset(mpData, 0, data_len); |
| 73 | |
| 74 | if (texture_format == TexFmt_CI4_8888) |
| 75 | { |
| 76 | mpPalette = malloc(kPalette8BytesRequired); |
| 77 | } |
| 78 | else if (texture_format == TexFmt_CI8_8888) |
| 79 | { |
| 80 | mpPalette = malloc(kPalette4BytesRequired); |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | CNativeTexture::~CNativeTexture() |
| 85 | { |
nothing calls this directly
no test coverage detected