DALI_TEST_CHECK(defaultScene);
// consume the resize flag by first rendering
- defaultScene.IsSurfaceRectChanged();
+ defaultScene.GetSurfaceRectChangedCount();
// Ensure stage size matches the scene size
auto stage = Stage::GetCurrent();
Rect<int32_t> surfaceRect = defaultScene.GetCurrentSurfaceRect();
- bool surfaceResized;
+ uint32_t surfaceResized;
// check resized flag before surface is resized.
- surfaceResized = defaultScene.IsSurfaceRectChanged();
- DALI_TEST_EQUALS(surfaceResized, false, TEST_LOCATION);
+ surfaceResized = defaultScene.GetSurfaceRectChangedCount();
+ DALI_TEST_EQUALS(surfaceResized, 0u, TEST_LOCATION);
// Resize the scene
Vector2 newSize(1000.0f, 2000.0f);
application.SendNotification();
application.Render(0);
- surfaceResized = defaultScene.IsSurfaceRectChanged();
- DALI_TEST_EQUALS(surfaceResized, true, TEST_LOCATION);
+ surfaceResized = defaultScene.GetSurfaceRectChangedCount();
+ DALI_TEST_EQUALS(surfaceResized, 1u, TEST_LOCATION);
// Check that the viewport is handled properly
DALI_TEST_CHECK(callStack.FindIndexFromMethodAndParams("Viewport", viewportParams) >= 0);
DALI_TEST_EQUALS(newSurfaceRect.width, 1000, TEST_LOCATION);
DALI_TEST_EQUALS(newSurfaceRect.height, 2000, TEST_LOCATION);
+ // SurfaceRect should be changed.
+ surfaceRect = newSurfaceRect;
+
+ // Resize the scene multiple times
+ uint32_t resizeCount = 10u;
+
+ for(uint32_t i = 0u; i < resizeCount; ++i)
+ {
+ Vector2 newSize(1000.0f, 2100.0f + i);
+ DALI_TEST_CHECK(stage.GetSize() != newSize);
+ defaultScene.SurfaceResized(newSize.width, newSize.height);
+
+ DALI_TEST_EQUALS(stage.GetSize(), newSize, TEST_LOCATION);
+ DALI_TEST_EQUALS(defaultScene.GetSize(), newSize, TEST_LOCATION);
+
+ // Check current surface rect
+ Rect<int32_t> newSurfaceRect = defaultScene.GetCurrentSurfaceRect();
+
+ // It should not be changed yet.
+ DALI_TEST_CHECK(surfaceRect == newSurfaceRect);
+ }
+
+ // Render after resizing surface
+ application.SendNotification();
+ application.Render(0);
+
+ // Check whether the number of surface resized count get well.
+ surfaceResized = defaultScene.GetSurfaceRectChangedCount();
+ DALI_TEST_EQUALS(surfaceResized, resizeCount, TEST_LOCATION);
+
+ // Check current surface rect
+ newSurfaceRect = defaultScene.GetCurrentSurfaceRect();
+
+ // It should be changed
+ DALI_TEST_EQUALS(newSurfaceRect.x, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(newSurfaceRect.y, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(newSurfaceRect.width, 1000, TEST_LOCATION);
+ DALI_TEST_EQUALS(newSurfaceRect.height, 2100 + (resizeCount - 1), TEST_LOCATION);
+
END_TEST;
}
return GetImplementation(*this).GetCurrentSurfaceRect();
}
-bool Scene::IsSurfaceRectChanged() const
+uint32_t Scene::GetSurfaceRectChangedCount() const
{
- return GetImplementation(*this).IsSurfaceRectChanged();
+ return GetImplementation(*this).GetSurfaceRectChangedCount();
}
void Scene::SetRotationCompletedAcknowledgement()
const Rect<int32_t>& GetCurrentSurfaceRect() const;
/**
- * Query wheter the surface rect is changed or not.
- * @return true if the surface rect is changed.
+ * Query how many times the surface rect changed.
+ * @note It will reset surface rect changed count.
+ * @return The count of the surface rect changed.
*/
- bool IsSurfaceRectChanged() const;
+ uint32_t GetSurfaceRectChangedCount() const;
/**
* @brief Send message to acknowledge for completing window rotation with current window orientation.
}
}
-bool Scene::IsSurfaceRectChanged() const
+uint32_t Scene::GetSurfaceRectChangedCount() const
{
- return mSceneObject ? mSceneObject->IsSurfaceRectChanged() : false;
+ return mSceneObject ? mSceneObject->GetSurfaceRectChangedCount() : 0u;
}
bool Scene::IsRotationCompletedAcknowledgementSet() const
const Rect<int32_t>& GetCurrentSurfaceRect() const;
/**
- * @copydoc Dali::Integration::Scene::IsSurfaceRectChanged
+ * @copydoc Dali::Integration::Scene::GetSurfaceRectChangedCount
*/
- bool IsSurfaceRectChanged() const;
+ uint32_t GetSurfaceRectChangedCount() const;
/**
* @copydoc Dali::Integration::Scene::SetSurfaceRenderTarget
mSurfaceRect(),
mSurfaceOrientation(0),
mScreenOrientation(0),
- mSurfaceRectChanged(false),
- mRotationCompletedAcknowledgement(false)
+ mSurfaceRectChangedCount(0u)
{
}
void Scene::SetSurfaceRect(const Rect<int32_t>& rect)
{
- mSurfaceRect = rect;
- mSurfaceRectChanged = true;
+ DALI_LOG_RELEASE_INFO("update surfce rect in scene-graph, from width[%d], height[%d], to width[%d], height[%d]. Changed count [%d]\n", mSurfaceRect.width, mSurfaceRect.height, rect.width, rect.height, mSurfaceRectChangedCount + 1u);
- DALI_LOG_RELEASE_INFO("update surfce rect in scene-graph, width[%d], height[%d]\n", mSurfaceRect.width, mSurfaceRect.height);
+ mSurfaceRect = rect;
+ ++mSurfaceRectChangedCount;
if(mRoot)
{
return mSurfaceRect;
}
-bool Scene::IsSurfaceRectChanged()
+uint32_t Scene::GetSurfaceRectChangedCount()
{
- bool surfaceRectChanged = mSurfaceRectChanged;
- mSurfaceRectChanged = false;
+ uint32_t surfaceRectChangedCount = mSurfaceRectChangedCount;
+ mSurfaceRectChangedCount = 0u;
- return surfaceRectChanged;
+ return surfaceRectChangedCount;
}
void Scene::SetSurfaceOrientations(int32_t windowOrientation, int32_t screenOrienation)
{
+ DALI_LOG_RELEASE_INFO("update orientation in scene-graph, from surface [%d], screen[%d], to surface [%d], screen[%d]\n", mSurfaceOrientation, mScreenOrientation, windowOrientation, screenOrienation);
+
mSurfaceOrientation = windowOrientation;
mScreenOrientation = screenOrienation;
{
mRoot->SetUpdated(true);
}
-
- DALI_LOG_RELEASE_INFO("update orientation in scene-graph, surface [%d], screen[%d]\n", mSurfaceOrientation, mScreenOrientation);
}
int32_t Scene::GetSurfaceOrientation() const
int32_t GetScreenOrientation() const;
/**
- * Query wheter the surface rect is changed or not.
- * @return true if the surface rect is changed.
+ * Query how many times the surface rect changed.
+ * @note It will reset surface rect changed count.
+ * @return The count of the surface rect changed.
*/
- bool IsSurfaceRectChanged();
+ uint32_t GetSurfaceRectChangedCount();
/**
* @brief Set the internal flag to acknowledge surface rotation.
Rect<int32_t> mSurfaceRect; ///< The rectangle of surface which is related ot this scene.
int32_t mSurfaceOrientation; ///< The orientation of surface which is related of this scene
int32_t mScreenOrientation; ///< The orientation of screen
- bool mSurfaceRectChanged; ///< The flag of surface's rectangle is changed when is resized or moved.
bool mRotationCompletedAcknowledgement; ///< The flag of sending the acknowledgement to complete window rotation.
+ uint32_t mSurfaceRectChangedCount; ///< The numbero of surface's rectangle is changed when is resized or moved.
// Render pass and render target