| 513 | |
| 514 | |
| 515 | void Tr2FontMeasurer::DrawToTexture( TriTextureRes* texture ) |
| 516 | { |
| 517 | CCP_STATS_ZONE( __FUNCTION__ ); |
| 518 | |
| 519 | USE_MAIN_THREAD_RENDER_CONTEXT(); |
| 520 | |
| 521 | if( !texture ) |
| 522 | { |
| 523 | return; |
| 524 | } |
| 525 | |
| 526 | Tr2TextureAL* const tex = texture->GetTexture(); |
| 527 | if( !tex || !tex->IsValid() || GetBytesPerPixel( tex->GetFormat() ) != 4 ) |
| 528 | { |
| 529 | return; |
| 530 | } |
| 531 | |
| 532 | void* pBits; |
| 533 | uint32_t Pitch; |
| 534 | CR_RETURN( tex->MapForWriting( Tr2TextureSubresource( 0 ), pBits, Pitch, renderContext ) ); |
| 535 | ON_BLOCK_EXIT( [&] { tex->UnmapForWriting( renderContext ); } ); |
| 536 | |
| 537 | DrawToBuffer( texture->GetWidth(), |
| 538 | texture->GetHeight(), |
| 539 | pBits, |
| 540 | Pitch ); |
| 541 | } |
| 542 | |
| 543 | void Tr2FontMeasurer::DrawToHostBitmap( Tr2HostBitmap* hostBitmap ) |
| 544 | { |
nothing calls this directly
no test coverage detected