forked from mia/Aegisub
Only age the renderer caches when a new block is created
Originally committed to SVN as r6441.
This commit is contained in:
parent
fc932dddc7
commit
bd38cfc305
2 changed files with 10 additions and 2 deletions
|
@ -200,6 +200,7 @@ const wxBitmap *AudioRenderer::GetCachedBitmap(int i, AudioRenderingStyle style)
|
||||||
if (created)
|
if (created)
|
||||||
{
|
{
|
||||||
renderer->Render(*bmp, i*cache_bitmap_width, style);
|
renderer->Render(*bmp, i*cache_bitmap_width, style);
|
||||||
|
needs_age = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(bmp->IsOk());
|
assert(bmp->IsOk());
|
||||||
|
@ -243,14 +244,19 @@ void AudioRenderer::Render(wxDC &dc, wxPoint origin, int start, int length, Audi
|
||||||
renderer->RenderBlank(dc, wxRect(origin.x-1, origin.y, lastx-origin.x+1, pixel_height), style);
|
renderer->RenderBlank(dc, wxRect(origin.x-1, origin.y, lastx-origin.x+1, pixel_height), style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (needs_age)
|
||||||
|
{
|
||||||
bitmaps[style].Age(cache_bitmap_maxsize);
|
bitmaps[style].Age(cache_bitmap_maxsize);
|
||||||
renderer->AgeCache(cache_renderer_maxsize);
|
renderer->AgeCache(cache_renderer_maxsize);
|
||||||
|
needs_age = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AudioRenderer::Invalidate()
|
void AudioRenderer::Invalidate()
|
||||||
{
|
{
|
||||||
for_each(bitmaps, bind(&AudioRendererBitmapCache::Age, _1, 0));
|
for_each(bitmaps, bind(&AudioRendererBitmapCache::Age, _1, 0));
|
||||||
|
needs_age = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -115,6 +115,8 @@ class AudioRenderer {
|
||||||
size_t cache_bitmap_maxsize;
|
size_t cache_bitmap_maxsize;
|
||||||
/// The maximum allowed size of the renderer's cache, in bytes
|
/// The maximum allowed size of the renderer's cache, in bytes
|
||||||
size_t cache_renderer_maxsize;
|
size_t cache_renderer_maxsize;
|
||||||
|
/// Do the caches need to be aged?
|
||||||
|
bool needs_age;
|
||||||
|
|
||||||
/// Actual renderer for bitmaps
|
/// Actual renderer for bitmaps
|
||||||
AudioRendererBitmapProvider *renderer;
|
AudioRendererBitmapProvider *renderer;
|
||||||
|
|
Loading…
Reference in a new issue