[Impeller] Move GetSecondsElapsed to Playground (flutter/engine#38375)
This commit is contained in:
@@ -62,8 +62,4 @@ std::string ComputePlaygroundTest::GetWindowTitle() const {
|
||||
return FormatWindowTitle(flutter::testing::GetCurrentTestName());
|
||||
}
|
||||
|
||||
Scalar ComputePlaygroundTest::GetSecondsElapsed() const {
|
||||
return (fml::TimePoint::Now().ToEpochDelta() - start_time_).ToSecondsF();
|
||||
}
|
||||
|
||||
} // namespace impeller
|
||||
|
||||
@@ -36,10 +36,6 @@ class ComputePlaygroundTest
|
||||
// |Playground|
|
||||
std::string GetWindowTitle() const override;
|
||||
|
||||
/// @brief Get the amount of time elapsed from the start of the playground
|
||||
/// test's execution.
|
||||
Scalar GetSecondsElapsed() const;
|
||||
|
||||
private:
|
||||
fml::TimeDelta start_time_;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <optional>
|
||||
#include <sstream>
|
||||
|
||||
#include "fml/time/time_point.h"
|
||||
#include "impeller/image/decompressed_image.h"
|
||||
#include "impeller/renderer/command_buffer.h"
|
||||
#include "impeller/runtime_stage/runtime_stage.h"
|
||||
@@ -126,6 +127,8 @@ void Playground::SetupWindow() {
|
||||
return;
|
||||
}
|
||||
renderer_ = std::move(renderer);
|
||||
|
||||
start_time_ = fml::TimePoint::Now().ToEpochDelta();
|
||||
}
|
||||
|
||||
void Playground::TeardownWindow() {
|
||||
@@ -165,6 +168,10 @@ Point Playground::GetContentScale() const {
|
||||
return impl_->GetContentScale();
|
||||
}
|
||||
|
||||
Scalar Playground::GetSecondsElapsed() const {
|
||||
return (fml::TimePoint::Now().ToEpochDelta() - start_time_).ToSecondsF();
|
||||
}
|
||||
|
||||
void Playground::SetCursorPosition(Point pos) {
|
||||
cursor_position_ = pos;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "flutter/fml/closure.h"
|
||||
#include "flutter/fml/macros.h"
|
||||
#include "flutter/fml/time/time_delta.h"
|
||||
|
||||
#include "impeller/geometry/point.h"
|
||||
#include "impeller/renderer/renderer.h"
|
||||
@@ -50,6 +51,10 @@ class Playground {
|
||||
|
||||
Point GetContentScale() const;
|
||||
|
||||
/// @brief Get the amount of time elapsed from the start of the playground's
|
||||
/// execution.
|
||||
Scalar GetSecondsElapsed() const;
|
||||
|
||||
std::shared_ptr<Context> GetContext() const;
|
||||
|
||||
bool OpenPlaygroundHere(const Renderer::RenderCallback& render_callback);
|
||||
@@ -80,6 +85,8 @@ class Playground {
|
||||
static const bool is_enabled_ = false;
|
||||
#endif // IMPELLER_ENABLE_PLAYGROUND
|
||||
|
||||
fml::TimeDelta start_time_;
|
||||
|
||||
struct GLFWInitializer;
|
||||
std::unique_ptr<GLFWInitializer> glfw_initializer_;
|
||||
std::unique_ptr<PlaygroundImpl> impl_;
|
||||
|
||||
@@ -25,8 +25,6 @@ void PlaygroundTest::SetUp() {
|
||||
|
||||
SetupContext(GetParam());
|
||||
SetupWindow();
|
||||
|
||||
start_time_ = fml::TimePoint::Now().ToEpochDelta();
|
||||
}
|
||||
|
||||
void PlaygroundTest::TearDown() {
|
||||
@@ -63,8 +61,4 @@ std::string PlaygroundTest::GetWindowTitle() const {
|
||||
return FormatWindowTitle(flutter::testing::GetCurrentTestName());
|
||||
}
|
||||
|
||||
Scalar PlaygroundTest::GetSecondsElapsed() const {
|
||||
return (fml::TimePoint::Now().ToEpochDelta() - start_time_).ToSecondsF();
|
||||
}
|
||||
|
||||
} // namespace impeller
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <memory>
|
||||
|
||||
#include "flutter/fml/macros.h"
|
||||
#include "flutter/fml/time/time_delta.h"
|
||||
#include "flutter/testing/testing.h"
|
||||
#include "impeller/geometry/scalar.h"
|
||||
#include "impeller/playground/playground.h"
|
||||
@@ -35,13 +34,7 @@ class PlaygroundTest : public Playground,
|
||||
// |Playground|
|
||||
std::string GetWindowTitle() const override;
|
||||
|
||||
/// @brief Get the amount of time elapsed from the start of the playground
|
||||
/// test's execution.
|
||||
Scalar GetSecondsElapsed() const;
|
||||
|
||||
private:
|
||||
fml::TimeDelta start_time_;
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(PlaygroundTest);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user