From 9768db8af685dc51d5dae62e860e60acc9b9de04 Mon Sep 17 00:00:00 2001 From: rachytski Date: Mon, 2 Jan 2012 18:59:04 +0400 Subject: [PATCH] VideoTimer should use RenderPolicy::NeedRedraw to check the "dirtyRect" status. --- android/jni/com/mapswithme/maps/Framework.cpp | 1 - map/basic_render_policy.cpp | 1 + map/render_policy_mt.cpp | 1 + map/render_policy_st.cpp | 1 + map/tiling_render_policy_mt.cpp | 1 + map/tiling_render_policy_st.cpp | 1 + map/window_handle.cpp | 8 +++++++- map/window_handle.hpp | 4 ++++ 8 files changed, 16 insertions(+), 2 deletions(-) diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index 69997b56db..acde71dc29 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -6,7 +6,6 @@ #include "../../../../../indexer/drawing_rules.hpp" -#include "../../../../../map/partial_render_policy.hpp" #include "../../../../../map/framework.hpp" #include "../../../../../std/shared_ptr.hpp" diff --git a/map/basic_render_policy.cpp b/map/basic_render_policy.cpp index 988e206018..9b2a2e207e 100644 --- a/map/basic_render_policy.cpp +++ b/map/basic_render_policy.cpp @@ -104,6 +104,7 @@ BasicRenderPolicy::BasicRenderPolicy(VideoTimer * videoTimer, m_windowHandle.reset(new WindowHandle()); m_windowHandle->setUpdatesEnabled(false); + m_windowHandle->setRenderPolicy(this); m_windowHandle->setVideoTimer(videoTimer); m_windowHandle->setRenderContext(primaryRC); } diff --git a/map/render_policy_mt.cpp b/map/render_policy_mt.cpp index e0cc654dc2..0efcd34387 100644 --- a/map/render_policy_mt.cpp +++ b/map/render_policy_mt.cpp @@ -127,6 +127,7 @@ RenderPolicyMT::RenderPolicyMT(VideoTimer * videoTimer, m_windowHandle.reset(new WindowHandle()); m_windowHandle->setUpdatesEnabled(false); + m_windowHandle->setRenderPolicy(this); m_windowHandle->setVideoTimer(videoTimer); m_windowHandle->setRenderContext(primaryRC); diff --git a/map/render_policy_st.cpp b/map/render_policy_st.cpp index 2675770310..d9f10941f9 100644 --- a/map/render_policy_st.cpp +++ b/map/render_policy_st.cpp @@ -128,6 +128,7 @@ RenderPolicyST::RenderPolicyST(VideoTimer * videoTimer, m_windowHandle.reset(new WindowHandle()); m_windowHandle->setUpdatesEnabled(false); + m_windowHandle->setRenderPolicy(this); m_windowHandle->setVideoTimer(videoTimer); m_windowHandle->setRenderContext(primaryRC); diff --git a/map/tiling_render_policy_mt.cpp b/map/tiling_render_policy_mt.cpp index fce06b5b55..d63fd85f40 100644 --- a/map/tiling_render_policy_mt.cpp +++ b/map/tiling_render_policy_mt.cpp @@ -155,6 +155,7 @@ TilingRenderPolicyMT::TilingRenderPolicyMT(VideoTimer * videoTimer, m_windowHandle.reset(new WindowHandle()); m_windowHandle->setUpdatesEnabled(false); + m_windowHandle->setRenderPolicy(this); m_windowHandle->setVideoTimer(videoTimer); m_windowHandle->setRenderContext(primaryRC); } diff --git a/map/tiling_render_policy_st.cpp b/map/tiling_render_policy_st.cpp index 70a7c00e30..6242a3fe40 100644 --- a/map/tiling_render_policy_st.cpp +++ b/map/tiling_render_policy_st.cpp @@ -175,6 +175,7 @@ TilingRenderPolicyST::TilingRenderPolicyST(VideoTimer * videoTimer, m_windowHandle.reset(new WindowHandle()); m_windowHandle->setUpdatesEnabled(false); + m_windowHandle->setRenderPolicy(this); m_windowHandle->setVideoTimer(videoTimer); m_windowHandle->setRenderContext(primaryRC); } diff --git a/map/window_handle.cpp b/map/window_handle.cpp index 909ec5dd03..b1b0fff36e 100644 --- a/map/window_handle.cpp +++ b/map/window_handle.cpp @@ -1,4 +1,5 @@ #include "window_handle.hpp" +#include "render_policy.hpp" WindowHandle::WindowHandle() : m_hasPendingUpdates(false), @@ -8,6 +9,11 @@ WindowHandle::WindowHandle() : { } +void WindowHandle::setRenderPolicy(RenderPolicy * renderPolicy) +{ + m_renderPolicy = renderPolicy; +} + void WindowHandle::setVideoTimer(VideoTimer * videoTimer) { m_videoTimer = videoTimer; @@ -18,7 +24,7 @@ void WindowHandle::setVideoTimer(VideoTimer * videoTimer) void WindowHandle::checkedFrameFn() { - if (needRedraw()) + if (m_renderPolicy->NeedRedraw()) m_stallsCount = 0; else ++m_stallsCount; diff --git a/map/window_handle.hpp b/map/window_handle.hpp index af9711c666..9d48d07b4a 100644 --- a/map/window_handle.hpp +++ b/map/window_handle.hpp @@ -16,9 +16,12 @@ namespace yg } } +class RenderPolicy; + class WindowHandle { shared_ptr m_renderContext; + RenderPolicy * m_renderPolicy; bool m_hasPendingUpdates; bool m_isUpdatesEnabled; @@ -33,6 +36,7 @@ public: WindowHandle(); virtual ~WindowHandle(); + void setRenderPolicy(RenderPolicy * renderPolicy); void setVideoTimer(VideoTimer * videoTimer); void checkedFrameFn();