forked from flutter/flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start wiring up the entity playground.
- Loading branch information
1 parent
2747332
commit 97455db
Showing
8 changed files
with
85 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "impeller/entity/entity_playground.h" | ||
|
||
namespace impeller { | ||
|
||
EntityPlayground::EntityPlayground() = default; | ||
|
||
EntityPlayground::~EntityPlayground() = default; | ||
|
||
bool EntityPlayground::OpenPlaygroundHere(Entity entity) { | ||
if (!renderer_) { | ||
renderer_ = std::make_unique<EntityRenderer>(GetContext()); | ||
if (!renderer_) { | ||
return false; | ||
} | ||
} | ||
Renderer::RenderCallback callback = [&](const Surface& surface, | ||
RenderPass& pass) -> bool { | ||
std::vector<Entity> entities = {entity}; | ||
return renderer_->RenderEntities(surface, pass, entities); | ||
}; | ||
return Playground::OpenPlaygroundHere(callback); | ||
} | ||
|
||
} // namespace impeller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#pragma once | ||
|
||
#include "flutter/fml/macros.h" | ||
#include "impeller/entity/entity.h" | ||
#include "impeller/entity/entity_renderer.h" | ||
#include "impeller/playground/playground.h" | ||
|
||
namespace impeller { | ||
|
||
class EntityPlayground : public Playground { | ||
public: | ||
EntityPlayground(); | ||
|
||
~EntityPlayground(); | ||
|
||
bool OpenPlaygroundHere(Entity entity); | ||
|
||
private: | ||
std::unique_ptr<EntityRenderer> renderer_; | ||
|
||
FML_DISALLOW_COPY_AND_ASSIGN(EntityPlayground); | ||
}; | ||
|
||
} // namespace impeller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters