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

Side by Side Diff: services/gfx/compositor/graph/snapshot.cc

Issue 1782733002: Mozart: The great RectF-ication. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-9
Patch Set: rebase 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 unified diff | Download patch
« no previous file with comments | « services/gfx/compositor/graph/snapshot.h ('k') | services/gfx/compositor/render/render_frame.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/gfx/compositor/graph/snapshot.h" 5 #include "services/gfx/compositor/graph/snapshot.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "mojo/skia/type_converters.h" 8 #include "mojo/skia/type_converters.h"
9 #include "services/gfx/compositor/graph/scene_content.h" 9 #include "services/gfx/compositor/graph/scene_content.h"
10 #include "services/gfx/compositor/graph/scene_def.h" 10 #include "services/gfx/compositor/graph/scene_def.h"
(...skipping 11 matching lines...) Expand all
22 bool Snapshot::HasDependency(const SceneDef* scene) const { 22 bool Snapshot::HasDependency(const SceneDef* scene) const {
23 return dependencies_.find(scene->label().token()) != dependencies_.end(); 23 return dependencies_.find(scene->label().token()) != dependencies_.end();
24 } 24 }
25 25
26 std::shared_ptr<RenderFrame> Snapshot::CreateFrame( 26 std::shared_ptr<RenderFrame> Snapshot::CreateFrame(
27 const mojo::Rect& viewport, 27 const mojo::Rect& viewport,
28 const mojo::gfx::composition::FrameInfo& frame_info) const { 28 const mojo::gfx::composition::FrameInfo& frame_info) const {
29 DCHECK(!is_blocked()); 29 DCHECK(!is_blocked());
30 DCHECK(root_scene_content_); 30 DCHECK(root_scene_content_);
31 31
32 SkRect sk_viewport = viewport.To<SkRect>(); 32 SkIRect sk_viewport = viewport.To<SkIRect>();
33
33 SkPictureRecorder recorder; 34 SkPictureRecorder recorder;
34 recorder.beginRecording(sk_viewport); 35 recorder.beginRecording(SkRect::Make(sk_viewport));
35 root_scene_content_->RecordPicture(this, recorder.getRecordingCanvas()); 36 root_scene_content_->RecordPicture(this, recorder.getRecordingCanvas());
36 return RenderFrame::Create(skia::AdoptRef(recorder.endRecordingAsPicture()), 37 return RenderFrame::Create(skia::AdoptRef(recorder.endRecordingAsPicture()),
37 sk_viewport, frame_info); 38 sk_viewport, frame_info);
38 } 39 }
39 40
40 void Snapshot::HitTest(const mojo::Point& point, 41 void Snapshot::HitTest(const mojo::PointF& point,
41 mojo::gfx::composition::HitTestResult* result) const { 42 mojo::gfx::composition::HitTestResult* result) const {
42 DCHECK(result); 43 DCHECK(result);
43 DCHECK(!is_blocked()); 44 DCHECK(!is_blocked());
44 DCHECK(root_scene_content_); 45 DCHECK(root_scene_content_);
45 46
46 root_scene_content_->HitTest(this, point.To<SkPoint>(), SkMatrix::I(), 47 root_scene_content_->HitTest(this, point.To<SkPoint>(), SkMatrix::I(),
47 &result->root); 48 &result->root);
48 } 49 }
49 50
50 bool Snapshot::IsNodeBlocked(const NodeDef* node) const { 51 bool Snapshot::IsNodeBlocked(const NodeDef* node) const {
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 213
213 if (snapshot_->is_blocked()) { 214 if (snapshot_->is_blocked()) {
214 snapshot_->root_scene_content_ = nullptr; 215 snapshot_->root_scene_content_ = nullptr;
215 snapshot_->resolved_scene_contents_.clear(); 216 snapshot_->resolved_scene_contents_.clear();
216 snapshot_->node_dispositions_.clear(); 217 snapshot_->node_dispositions_.clear();
217 } 218 }
218 return std::move(snapshot_); 219 return std::move(snapshot_);
219 } 220 }
220 221
221 } // namespace compositor 222 } // namespace compositor
OLDNEW
« no previous file with comments | « services/gfx/compositor/graph/snapshot.h ('k') | services/gfx/compositor/render/render_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698