| OLD | NEW |
| 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/nodes.h" | 5 #include "services/gfx/compositor/graph/nodes.h" |
| 6 | 6 |
| 7 #include <ostream> | 7 #include <ostream> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "mojo/services/gfx/composition/cpp/formatting.h" | 10 #include "mojo/services/gfx/composition/cpp/formatting.h" |
| 11 #include "mojo/skia/type_converters.h" | 11 #include "mojo/skia/type_converters.h" |
| 12 #include "services/gfx/compositor/graph/scene_content.h" | 12 #include "services/gfx/compositor/graph/scene_content.h" |
| 13 #include "services/gfx/compositor/graph/scene_def.h" | |
| 14 #include "services/gfx/compositor/graph/snapshot.h" | 13 #include "services/gfx/compositor/graph/snapshot.h" |
| 15 #include "services/gfx/compositor/graph/transform_pair.h" | 14 #include "services/gfx/compositor/graph/transform_pair.h" |
| 16 #include "services/gfx/compositor/render/render_image.h" | 15 #include "services/gfx/compositor/render/render_image.h" |
| 17 #include "third_party/skia/include/core/SkCanvas.h" | 16 #include "third_party/skia/include/core/SkCanvas.h" |
| 18 #include "third_party/skia/include/core/SkColor.h" | 17 #include "third_party/skia/include/core/SkColor.h" |
| 19 #include "third_party/skia/include/core/SkMatrix.h" | 18 #include "third_party/skia/include/core/SkMatrix.h" |
| 20 #include "third_party/skia/include/core/SkPaint.h" | 19 #include "third_party/skia/include/core/SkPaint.h" |
| 21 #include "third_party/skia/include/core/SkPoint.h" | 20 #include "third_party/skia/include/core/SkPoint.h" |
| 22 #include "third_party/skia/include/core/SkRect.h" | 21 #include "third_party/skia/include/core/SkRect.h" |
| 23 #include "third_party/skia/include/utils/SkMatrix44.h" | 22 #include "third_party/skia/include/utils/SkMatrix44.h" |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 builder->RequireResource(scene_resource_id_, Resource::Type::kScene, | 437 builder->RequireResource(scene_resource_id_, Resource::Type::kScene, |
| 439 node_id()); | 438 node_id()); |
| 440 } | 439 } |
| 441 | 440 |
| 442 Snapshot::Disposition SceneNode::RecordSnapshot( | 441 Snapshot::Disposition SceneNode::RecordSnapshot( |
| 443 const SceneContent* content, | 442 const SceneContent* content, |
| 444 SnapshotBuilder* builder) const { | 443 SnapshotBuilder* builder) const { |
| 445 DCHECK(content); | 444 DCHECK(content); |
| 446 DCHECK(builder); | 445 DCHECK(builder); |
| 447 | 446 |
| 448 auto scene_resource = static_cast<const SceneResource*>( | |
| 449 content->GetResource(scene_resource_id_, Resource::Type::kScene)); | |
| 450 DCHECK(scene_resource); | |
| 451 | |
| 452 SceneDef* referenced_scene = scene_resource->referenced_scene().get(); | |
| 453 if (!referenced_scene) { | |
| 454 if (builder->block_log()) { | |
| 455 *builder->block_log() | |
| 456 << "Scene node blocked because its referenced scene is unavailable: " | |
| 457 << FormattedLabel(content) << std::endl; | |
| 458 } | |
| 459 return Snapshot::Disposition::kBlocked; | |
| 460 } | |
| 461 | |
| 462 Snapshot::Disposition disposition = | 447 Snapshot::Disposition disposition = |
| 463 builder->SnapshotScene(referenced_scene, scene_version_, this, content); | 448 builder->SnapshotReferencedScene(this, content); |
| 464 if (disposition != Snapshot::Disposition::kSuccess) | 449 if (disposition != Snapshot::Disposition::kSuccess) |
| 465 return disposition; | 450 return disposition; |
| 466 return Node::RecordSnapshot(content, builder); | 451 return Node::RecordSnapshot(content, builder); |
| 467 } | 452 } |
| 468 | 453 |
| 469 void SceneNode::RecordPictureInner(const SceneContent* content, | 454 void SceneNode::RecordPictureInner(const SceneContent* content, |
| 470 const Snapshot* snapshot, | 455 const Snapshot* snapshot, |
| 471 SkCanvas* canvas) const { | 456 SkCanvas* canvas) const { |
| 472 DCHECK(content); | 457 DCHECK(content); |
| 473 DCHECK(snapshot); | 458 DCHECK(snapshot); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 | 524 |
| 540 SkPaint paint; | 525 SkPaint paint; |
| 541 SetPaintForBlend(&paint, blend_.get()); | 526 SetPaintForBlend(&paint, blend_.get()); |
| 542 | 527 |
| 543 canvas->saveLayer(layer_rect_.To<SkRect>(), &paint); | 528 canvas->saveLayer(layer_rect_.To<SkRect>(), &paint); |
| 544 Node::RecordPictureInner(content, snapshot, canvas); | 529 Node::RecordPictureInner(content, snapshot, canvas); |
| 545 canvas->restore(); | 530 canvas->restore(); |
| 546 } | 531 } |
| 547 | 532 |
| 548 } // namespace compositor | 533 } // namespace compositor |
| OLD | NEW |