forked from mia/Aegisub
parent
5dd58aca8b
commit
f501567e2d
3 changed files with 7 additions and 4 deletions
|
@ -50,19 +50,22 @@ namespace {
|
|||
}
|
||||
|
||||
AudioRendererBitmapCacheBitmapFactory::AudioRendererBitmapCacheBitmapFactory(AudioRenderer *renderer)
|
||||
: renderer(renderer)
|
||||
: renderer(renderer), block_size(0)
|
||||
{
|
||||
assert(renderer);
|
||||
}
|
||||
|
||||
std::unique_ptr<wxBitmap> AudioRendererBitmapCacheBitmapFactory::ProduceBlock(int /* i */)
|
||||
{
|
||||
return agi::make_unique<wxBitmap>(renderer->cache_bitmap_width, renderer->pixel_height, 24);
|
||||
std::unique_ptr<wxBitmap> ret = agi::make_unique<wxBitmap>(renderer->cache_bitmap_width, renderer->pixel_height);
|
||||
block_size = sizeof(wxBitmap) + static_cast<size_t>(ret->GetWidth()) * ret->GetHeight() * ((ret->GetDepth() + 7) / 8);
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t AudioRendererBitmapCacheBitmapFactory::GetBlockSize() const
|
||||
{
|
||||
return sizeof(wxBitmap) + renderer->cache_bitmap_width * renderer->pixel_height * 3;
|
||||
assert(block_size);
|
||||
return block_size;
|
||||
}
|
||||
|
||||
AudioRenderer::AudioRenderer()
|
||||
|
|
|
@ -61,6 +61,7 @@ struct AudioRendererBitmapCacheBitmapFactory {
|
|||
/// Produces a wxBitmap with dimensions pulled from our master AudioRenderer.
|
||||
std::unique_ptr<wxBitmap> ProduceBlock(int i);
|
||||
|
||||
size_t block_size;
|
||||
/// @brief Calculate the size of bitmaps
|
||||
/// @return The size of bitmaps created
|
||||
size_t GetBlockSize() const;
|
||||
|
|
|
@ -215,7 +215,6 @@ void AudioSpectrumRenderer::Render(wxBitmap &bmp, int start, AudioRenderingStyle
|
|||
return;
|
||||
|
||||
assert(bmp.IsOk());
|
||||
assert(bmp.GetDepth() == 24);
|
||||
|
||||
int end = start + bmp.GetWidth();
|
||||
|
||||
|
|
Loading…
Reference in a new issue