| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#pragma once |
| 18 |
|
| 19 |
#include <gui/Surface.h> |
| 20 |
#include <utils/StrongPointer.h> |
| 21 |
|
| 22 |
#include <map> |
| 23 |
#include <string> |
| 24 |
|
| 25 |
namespace android { |
| 26 |
|
| 27 |
class Canvas; |
| 28 |
|
| 29 |
namespace uirenderer { |
| 30 |
class RenderNode; |
| 31 |
class RecordingCanvas; |
| 32 |
|
| 33 |
namespace test { |
| 34 |
|
| 35 |
class TestScene { |
| 36 |
public: |
| 37 |
struct Options { |
| 38 |
int frameCount = 150; |
| 39 |
int repeatCount = 1; |
| 40 |
int reportFrametimeWeight = 0; |
| 41 |
bool renderOffscreen = true; |
| 42 |
bool reportGpuMemoryUsage = false; |
| 43 |
bool reportGpuMemoryUsageVerbose = false; |
| 44 |
}; |
| 45 |
|
| 46 |
template <class T> |
| 47 |
static test::TestScene* simpleCreateScene(const TestScene::Options&) { |
| 48 |
return new T(); |
| 49 |
} |
| 50 |
|
| 51 |
typedef test::TestScene* (*CreateScene)(const TestScene::Options&); |
| 52 |
|
| 53 |
struct Info { |
| 54 |
std::string name; |
| 55 |
std::string description; |
| 56 |
CreateScene createScene; |
| 57 |
}; |
| 58 |
|
| 59 |
class Registrar { |
| 60 |
public: |
| 61 |
explicit Registrar(const TestScene::Info& info) { TestScene::registerScene(info); } |
| 62 |
|
| 63 |
private: |
| 64 |
Registrar() = delete; |
| 65 |
Registrar(const Registrar&) = delete; |
| 66 |
Registrar& operator=(const Registrar&) = delete; |
| 67 |
}; |
| 68 |
|
| 69 |
virtual ~TestScene() {} |
| 70 |
virtual void createContent(int width, int height, Canvas& renderer) = 0; |
| 71 |
virtual void doFrame(int frameNr) = 0; |
| 72 |
|
| 73 |
static std::map<std::string, Info>& testMap(); |
| 74 |
static void registerScene(const Info& info); |
| 75 |
|
| 76 |
sp<Surface> renderTarget; |
| 77 |
}; |
| 78 |
|
| 79 |
} |
| 80 |
} |
| 81 |
} |