| 276 | //========================================================================== |
| 277 | |
| 278 | uint8_t* GetWritablePixels(FTextureID texid, bool reload) |
| 279 | { |
| 280 | if (!texid.isValid()) return nullptr; |
| 281 | auto gtex = TexMan.GetGameTexture(texid); |
| 282 | auto tex = dynamic_cast<FImageTexture*>(gtex->GetTexture()); |
| 283 | |
| 284 | if (!tex || !tex->GetImage()) return nullptr; |
| 285 | auto timg = dynamic_cast<FWritableTile*>(tex->GetImage()); |
| 286 | if (!timg) return nullptr; |
| 287 | |
| 288 | if (reload) |
| 289 | timg->Reload(); |
| 290 | |
| 291 | gtex->CleanHardwareData(); // we can safely assume that this only gets called when the texture is about to be changed. |
| 292 | return timg->GetRawData(); |
| 293 | } |
| 294 | |
| 295 | |
| 296 | //========================================================================== |
no test coverage detected