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

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

Issue 2749993002: compositor: Change how attributes are set during ui::Layer::Clone(). (Closed)
Patch Set: test Created 3 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 | « no previous file | 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 children_[i]->parent_ = NULL; 151 children_[i]->parent_ = NULL;
152 152
153 cc_layer_->RemoveFromParent(); 153 cc_layer_->RemoveFromParent();
154 if (mailbox_release_callback_) 154 if (mailbox_release_callback_)
155 mailbox_release_callback_->Run(gpu::SyncToken(), false); 155 mailbox_release_callback_->Run(gpu::SyncToken(), false);
156 } 156 }
157 157
158 std::unique_ptr<Layer> Layer::Clone() const { 158 std::unique_ptr<Layer> Layer::Clone() const {
159 auto clone = base::MakeUnique<Layer>(type_); 159 auto clone = base::MakeUnique<Layer>(type_);
160 160
161 clone->SetTransform(GetTargetTransform());
162 clone->SetBounds(bounds_);
163 clone->SetSubpixelPositionOffset(subpixel_position_offset_);
164 clone->SetMasksToBounds(GetMasksToBounds());
165 clone->SetOpacity(GetTargetOpacity());
166 clone->SetVisible(GetTargetVisibility());
167 clone->SetFillsBoundsOpaquely(fills_bounds_opaquely_);
168 clone->SetFillsBoundsCompletely(fills_bounds_completely_);
169 clone->set_name(name_);
170
171 // Background filters. 161 // Background filters.
172 clone->SetBackgroundBlur(background_blur_radius_); 162 clone->SetBackgroundBlur(background_blur_radius_);
173 clone->SetBackgroundZoom(zoom_, zoom_inset_); 163 clone->SetBackgroundZoom(zoom_, zoom_inset_);
174 164
175 // Filters. 165 // Filters.
176 clone->SetLayerSaturation(layer_saturation_); 166 clone->SetLayerSaturation(layer_saturation_);
177 clone->SetLayerBrightness(GetTargetBrightness()); 167 clone->SetLayerBrightness(GetTargetBrightness());
178 clone->SetLayerGrayscale(GetTargetGrayscale()); 168 clone->SetLayerGrayscale(GetTargetGrayscale());
179 clone->SetLayerInverted(layer_inverted_); 169 clone->SetLayerInverted(layer_inverted_);
180 if (alpha_shape_) 170 if (alpha_shape_)
181 clone->SetAlphaShape(base::MakeUnique<SkRegion>(*alpha_shape_)); 171 clone->SetAlphaShape(base::MakeUnique<SkRegion>(*alpha_shape_));
182 172
183 // cc::Layer state. 173 // cc::Layer state.
184 if (surface_layer_ && surface_layer_->primary_surface_info().is_valid()) { 174 if (surface_layer_ && surface_layer_->primary_surface_info().is_valid()) {
185 clone->SetShowPrimarySurface(surface_layer_->primary_surface_info(), 175 clone->SetShowPrimarySurface(surface_layer_->primary_surface_info(),
186 surface_layer_->surface_reference_factory()); 176 surface_layer_->surface_reference_factory());
187 } else if (type_ == LAYER_SOLID_COLOR) { 177 } else if (type_ == LAYER_SOLID_COLOR) {
188 clone->SetColor(GetTargetColor()); 178 clone->SetColor(GetTargetColor());
189 } 179 }
180
181 clone->SetTransform(GetTargetTransform());
182 clone->SetBounds(bounds_);
183 clone->SetSubpixelPositionOffset(subpixel_position_offset_);
184 clone->SetMasksToBounds(GetMasksToBounds());
185 clone->SetOpacity(GetTargetOpacity());
186 clone->SetVisible(GetTargetVisibility());
187 clone->SetFillsBoundsOpaquely(fills_bounds_opaquely_);
188 clone->SetFillsBoundsCompletely(fills_bounds_completely_);
189 clone->set_name(name_);
190
190 return clone; 191 return clone;
191 } 192 }
192 193
193 std::unique_ptr<Layer> Layer::Mirror() { 194 std::unique_ptr<Layer> Layer::Mirror() {
194 auto mirror = Clone(); 195 auto mirror = Clone();
195 mirrors_.emplace_back(base::MakeUnique<LayerMirror>(this, mirror.get())); 196 mirrors_.emplace_back(base::MakeUnique<LayerMirror>(this, mirror.get()));
196 return mirror; 197 return mirror;
197 } 198 }
198 199
199 const Compositor* Layer::GetCompositor() const { 200 const Compositor* Layer::GetCompositor() const {
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 const auto it = std::find_if(mirrors_.begin(), mirrors_.end(), 1176 const auto it = std::find_if(mirrors_.begin(), mirrors_.end(),
1176 [mirror](const std::unique_ptr<LayerMirror>& mirror_ptr) { 1177 [mirror](const std::unique_ptr<LayerMirror>& mirror_ptr) {
1177 return mirror_ptr.get() == mirror; 1178 return mirror_ptr.get() == mirror;
1178 }); 1179 });
1179 1180
1180 DCHECK(it != mirrors_.end()); 1181 DCHECK(it != mirrors_.end());
1181 mirrors_.erase(it); 1182 mirrors_.erase(it);
1182 } 1183 }
1183 1184
1184 } // namespace ui 1185 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/compositor/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698