Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(423)

Unified Diff: services/gfx/compositor/graph/scene_content.cc

Issue 1774373002: Mozart: Implement hit testing. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-4
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: services/gfx/compositor/graph/scene_content.cc
diff --git a/services/gfx/compositor/graph/scene_content.cc b/services/gfx/compositor/graph/scene_content.cc
index ad4fcf464993442315a64794ab623efba44e0a56..7d76309f2956a64eb085b4686080e3603a6f7abc 100644
--- a/services/gfx/compositor/graph/scene_content.cc
+++ b/services/gfx/compositor/graph/scene_content.cc
@@ -22,6 +22,36 @@ SceneContent::SceneContent(const SceneLabel& label,
SceneContent::~SceneContent() {}
+void SceneContent::RecordPicture(const Snapshot* snapshot,
+ SkCanvas* canvas) const {
+ const NodeDef* root = GetRootNodeIfExists();
+ if (root)
+ root->RecordPicture(this, snapshot, canvas);
+}
+
+mojo::gfx::composition::SceneHitPtr SceneContent::HitTest(
+ const Snapshot* snapshot,
+ const SkPoint& global_point,
+ const SkMatrix& scene_transform,
+ bool* opaque) const {
+ DCHECK(snapshot);
+ DCHECK(opaque);
+
+ mojo::Array<mojo::gfx::composition::HitPtr> hits;
+ const NodeDef* root = GetRootNodeIfExists();
+ if (root)
+ root->HitTest(this, snapshot, global_point, scene_transform, opaque, &hits);
+ if (!hits.size())
+ return nullptr;
+
+ auto scene_hit = mojo::gfx::composition::SceneHit::New();
+ scene_hit->scene_token = mojo::gfx::composition::SceneToken::New();
+ scene_hit->scene_token->value = label_.token();
+ scene_hit->scene_version = version_;
+ scene_hit->hits = hits.Pass();
+ return scene_hit.Pass();
+}
+
const ResourceDef* SceneContent::GetResource(
uint32_t resource_id,
ResourceDef::Type resource_type) const {

Powered by Google App Engine
This is Rietveld 408576698