void TopographyThread::Trigger(const WindowProjection &_projection) { assert(_projection.IsValid()); const GeoBounds new_bounds = _projection.GetScreenBounds(); if (last_bounds.IsValid() && last_bounds.IsInside(new_bounds)) { /* still inside cache bounds - now check if we crossed a scale threshold for at least one file, which would mean we have to update a file which was not updated for the current cache bounds */ if (scale_threshold < 0 || _projection.GetMapScale() >= scale_threshold) /* the cache is still fresh */ return; } last_bounds = new_bounds.Scale(1.1); scale_threshold = store.GetNextScaleThreshold(_projection.GetMapScale()); { const ScopeLock protect(mutex); next_projection = _projection; StandbyThread::Trigger(); } }
void TransparentRendererCache::AlphaBlendTo(Canvas &canvas, const WindowProjection &projection, uint8_t alpha) const { assert(canvas.IsDefined()); assert(buffer.IsDefined()); assert(projection.IsValid()); assert(compare_projection.IsDefined()); assert(Check(projection)); if (empty) return; const unsigned width = projection.GetScreenWidth(), height = projection.GetScreenHeight(); #ifdef USE_MEMORY_CANVAS canvas.AlphaBlendNotWhite(0, 0, width, height, buffer, 0, 0, width, height, alpha); #else canvas.AlphaBlend(0, 0, width, height, buffer, 0, 0, width, height, alpha); #endif }
bool TransparentRendererCache::Check(const WindowProjection &projection) const { assert(projection.IsValid()); return buffer.IsDefined() && buffer.GetWidth() == projection.GetScreenWidth() && buffer.GetHeight() == projection.GetScreenHeight() && compare_projection.Compare(projection); }
void TransparentRendererCache::Commit(Canvas &canvas, const WindowProjection &projection) { assert(canvas.IsDefined()); assert(projection.IsValid()); assert(compare_projection.IsDefined()); assert(buffer.IsDefined()); assert(Check(projection)); empty = false; }