RageSurface *RageDisplay::CreateSurfaceFromPixfmt( RagePixelFormat pixfmt, void *pixels, int width, int height, int pitch ) { const RagePixelFormatDesc *tpf = GetPixelFormatDesc(pixfmt); RageSurface *surf = CreateSurfaceFrom( width, height, tpf->bpp, tpf->masks[0], tpf->masks[1], tpf->masks[2], tpf->masks[3], (uint8_t *) pixels, pitch ); return surf; }
void CreateTexture() { if( m_uTexHandle ) return; RageSurface *pSurface = CreateSurfaceFrom( m_iImageWidth, m_iImageHeight, m_SurfaceFormat.BitsPerPixel, m_SurfaceFormat.Mask[0], m_SurfaceFormat.Mask[1], m_SurfaceFormat.Mask[2], m_SurfaceFormat.Mask[3], nullptr, 1 ); m_uTexHandle = DISPLAY->CreateTexture( m_PixFmt, pSurface, false ); delete pSurface; }