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

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
« no previous file with comments | « services/gfx/compositor/graph/scene_content.h ('k') | services/gfx/compositor/graph/scene_def.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..77c3a8cc770c1e1e3cab822161d53be199060389 100644
--- a/services/gfx/compositor/graph/scene_content.cc
+++ b/services/gfx/compositor/graph/scene_content.cc
@@ -22,6 +22,39 @@ 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);
+}
+
+bool SceneContent::HitTest(
+ const Snapshot* snapshot,
+ const SkPoint& scene_point,
+ const SkMatrix& global_to_scene_transform,
+ mojo::gfx::composition::SceneHitPtr* out_scene_hit) const {
+ DCHECK(snapshot);
+ DCHECK(out_scene_hit);
+
+ const NodeDef* root = GetRootNodeIfExists();
+ if (!root)
+ return false;
+
+ mojo::Array<mojo::gfx::composition::HitPtr> hits;
+ bool opaque = root->HitTest(this, snapshot, scene_point,
+ global_to_scene_transform, &hits);
+ if (hits.size()) {
+ 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();
+ *out_scene_hit = scene_hit.Pass();
+ }
+ return opaque;
+}
+
const ResourceDef* SceneContent::GetResource(
uint32_t resource_id,
ResourceDef::Type resource_type) const {
« no previous file with comments | « services/gfx/compositor/graph/scene_content.h ('k') | services/gfx/compositor/graph/scene_def.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698