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

Side by Side Diff: ui/compositor/layer.cc

Issue 1912893002: cc : Stop pushing properties not used by LayerImpl to LayerImpl. (2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « ui/compositor/layer.h ('k') | ui/compositor/layer_unittest.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/compositor/layer.h" 5 #include "ui/compositor/layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 } // namespace 48 } // namespace
49 49
50 namespace ui { 50 namespace ui {
51 51
52 Layer::Layer() 52 Layer::Layer()
53 : type_(LAYER_TEXTURED), 53 : type_(LAYER_TEXTURED),
54 compositor_(NULL), 54 compositor_(NULL),
55 parent_(NULL), 55 parent_(NULL),
56 visible_(true), 56 visible_(true),
57 force_render_surface_(false),
58 fills_bounds_opaquely_(true), 57 fills_bounds_opaquely_(true),
59 fills_bounds_completely_(false), 58 fills_bounds_completely_(false),
60 background_blur_radius_(0), 59 background_blur_radius_(0),
61 layer_saturation_(0.0f), 60 layer_saturation_(0.0f),
62 layer_brightness_(0.0f), 61 layer_brightness_(0.0f),
63 layer_grayscale_(0.0f), 62 layer_grayscale_(0.0f),
64 layer_inverted_(false), 63 layer_inverted_(false),
65 layer_mask_(NULL), 64 layer_mask_(NULL),
66 layer_mask_back_link_(NULL), 65 layer_mask_back_link_(NULL),
67 zoom_(1), 66 zoom_(1),
68 zoom_inset_(0), 67 zoom_inset_(0),
69 delegate_(NULL), 68 delegate_(NULL),
70 owner_(NULL), 69 owner_(NULL),
71 cc_layer_(NULL), 70 cc_layer_(NULL),
72 device_scale_factor_(1.0f) { 71 device_scale_factor_(1.0f) {
73 CreateCcLayer(); 72 CreateCcLayer();
74 } 73 }
75 74
76 Layer::Layer(LayerType type) 75 Layer::Layer(LayerType type)
77 : type_(type), 76 : type_(type),
78 compositor_(NULL), 77 compositor_(NULL),
79 parent_(NULL), 78 parent_(NULL),
80 visible_(true), 79 visible_(true),
81 force_render_surface_(false),
82 fills_bounds_opaquely_(true), 80 fills_bounds_opaquely_(true),
83 fills_bounds_completely_(false), 81 fills_bounds_completely_(false),
84 background_blur_radius_(0), 82 background_blur_radius_(0),
85 layer_saturation_(0.0f), 83 layer_saturation_(0.0f),
86 layer_brightness_(0.0f), 84 layer_brightness_(0.0f),
87 layer_grayscale_(0.0f), 85 layer_grayscale_(0.0f),
88 layer_inverted_(false), 86 layer_inverted_(false),
89 layer_mask_(NULL), 87 layer_mask_(NULL),
90 layer_mask_back_link_(NULL), 88 layer_mask_back_link_(NULL),
91 zoom_(1), 89 zoom_(1),
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 texture_layer_ = NULL; 500 texture_layer_ = NULL;
503 surface_layer_ = NULL; 501 surface_layer_ = NULL;
504 502
505 for (size_t i = 0; i < children_.size(); ++i) { 503 for (size_t i = 0; i < children_.size(); ++i) {
506 DCHECK(children_[i]->cc_layer_); 504 DCHECK(children_[i]->cc_layer_);
507 cc_layer_->AddChild(children_[i]->cc_layer_); 505 cc_layer_->AddChild(children_[i]->cc_layer_);
508 } 506 }
509 cc_layer_->SetLayerClient(this); 507 cc_layer_->SetLayerClient(this);
510 cc_layer_->SetTransformOrigin(gfx::Point3F()); 508 cc_layer_->SetTransformOrigin(gfx::Point3F());
511 cc_layer_->SetContentsOpaque(fills_bounds_opaquely_); 509 cc_layer_->SetContentsOpaque(fills_bounds_opaquely_);
512 cc_layer_->SetForceRenderSurface(force_render_surface_);
513 cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN); 510 cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN);
514 cc_layer_->SetHideLayerAndSubtree(!visible_); 511 cc_layer_->SetHideLayerAndSubtree(!visible_);
515 512
516 SetLayerFilters(); 513 SetLayerFilters();
517 SetLayerBackgroundFilters(); 514 SetLayerBackgroundFilters();
518 } 515 }
519 516
520 bool Layer::HasPendingThreadedAnimationsForTesting() const { 517 bool Layer::HasPendingThreadedAnimationsForTesting() const {
521 return animator_->HasPendingThreadedAnimationsForTesting(); 518 return animator_->HasPendingThreadedAnimationsForTesting();
522 } 519 }
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 cc::TextureMailbox* mailbox, 761 cc::TextureMailbox* mailbox,
765 std::unique_ptr<cc::SingleReleaseCallback>* release_callback, 762 std::unique_ptr<cc::SingleReleaseCallback>* release_callback,
766 bool use_shared_memory) { 763 bool use_shared_memory) {
767 if (!mailbox_release_callback_) 764 if (!mailbox_release_callback_)
768 return false; 765 return false;
769 *mailbox = mailbox_; 766 *mailbox = mailbox_;
770 *release_callback = std::move(mailbox_release_callback_); 767 *release_callback = std::move(mailbox_release_callback_);
771 return true; 768 return true;
772 } 769 }
773 770
774 void Layer::SetForceRenderSurface(bool force) {
775 if (force_render_surface_ == force)
776 return;
777
778 force_render_surface_ = force;
779 cc_layer_->SetForceRenderSurface(force_render_surface_);
780 }
781
782 class LayerDebugInfo : public base::trace_event::ConvertableToTraceFormat { 771 class LayerDebugInfo : public base::trace_event::ConvertableToTraceFormat {
783 public: 772 public:
784 explicit LayerDebugInfo(const std::string& name) : name_(name) {} 773 explicit LayerDebugInfo(const std::string& name) : name_(name) {}
785 ~LayerDebugInfo() override {} 774 ~LayerDebugInfo() override {}
786 void AppendAsTraceFormat(std::string* out) const override { 775 void AppendAsTraceFormat(std::string* out) const override {
787 base::DictionaryValue dictionary; 776 base::DictionaryValue dictionary;
788 dictionary.SetString("layer_name", name_); 777 dictionary.SetString("layer_name", name_);
789 base::JSONWriter::Write(dictionary, out); 778 base::JSONWriter::Write(dictionary, out);
790 } 779 }
791 780
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 if (animator_) { 1016 if (animator_) {
1028 animator_->ResetCompositor(compositor); 1017 animator_->ResetCompositor(compositor);
1029 animator_->RemoveFromCollection(collection); 1018 animator_->RemoveFromCollection(collection);
1030 } 1019 }
1031 1020
1032 for (auto* child : children_) 1021 for (auto* child : children_)
1033 child->ResetCompositorForAnimatorsInTree(compositor); 1022 child->ResetCompositorForAnimatorsInTree(compositor);
1034 } 1023 }
1035 1024
1036 } // namespace ui 1025 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer.h ('k') | ui/compositor/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698