OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 "cc/layer.h" | 5 #include "cc/layer.h" |
6 | 6 |
7 #include "cc/active_animation.h" | 7 #include "cc/active_animation.h" |
8 #include "cc/animation_events.h" | 8 #include "cc/animation_events.h" |
9 #include "cc/layer_animation_controller.h" | 9 #include "cc/layer_animation_controller.h" |
10 #include "cc/layer_impl.h" | 10 #include "cc/layer_impl.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 209 |
210 void Layer::setBounds(const gfx::Size& size) | 210 void Layer::setBounds(const gfx::Size& size) |
211 { | 211 { |
212 if (bounds() == size) | 212 if (bounds() == size) |
213 return; | 213 return; |
214 | 214 |
215 bool firstResize = bounds().IsEmpty() && !size.IsEmpty(); | 215 bool firstResize = bounds().IsEmpty() && !size.IsEmpty(); |
216 | 216 |
217 m_bounds = size; | 217 m_bounds = size; |
218 | 218 |
| 219 didUpdateBounds(); |
| 220 |
219 if (firstResize) | 221 if (firstResize) |
220 setNeedsDisplay(); | 222 setNeedsDisplay(); |
221 else | 223 else |
222 setNeedsCommit(); | 224 setNeedsCommit(); |
223 } | 225 } |
224 | 226 |
| 227 void Layer::didUpdateBounds() |
| 228 { |
| 229 m_drawProperties.content_bounds = bounds(); |
| 230 } |
| 231 |
225 Layer* Layer::rootLayer() | 232 Layer* Layer::rootLayer() |
226 { | 233 { |
227 Layer* layer = this; | 234 Layer* layer = this; |
228 while (layer->parent()) | 235 while (layer->parent()) |
229 layer = layer->parent(); | 236 layer = layer->parent(); |
230 return layer; | 237 return layer; |
231 } | 238 } |
232 | 239 |
233 void Layer::removeAllChildren() | 240 void Layer::removeAllChildren() |
234 { | 241 { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 } | 274 } |
268 | 275 |
269 void Layer::setBackgroundColor(SkColor backgroundColor) | 276 void Layer::setBackgroundColor(SkColor backgroundColor) |
270 { | 277 { |
271 if (m_backgroundColor == backgroundColor) | 278 if (m_backgroundColor == backgroundColor) |
272 return; | 279 return; |
273 m_backgroundColor = backgroundColor; | 280 m_backgroundColor = backgroundColor; |
274 setNeedsCommit(); | 281 setNeedsCommit(); |
275 } | 282 } |
276 | 283 |
277 gfx::Size Layer::contentBounds() const | 284 void Layer::updateContentsScale(float ideal_contents_scale) |
278 { | 285 { |
279 return bounds(); | 286 m_drawProperties.contents_scale_x = 1; |
| 287 m_drawProperties.contents_scale_y = 1; |
| 288 m_drawProperties.content_bounds = bounds(); |
280 } | 289 } |
281 | 290 |
282 void Layer::setMasksToBounds(bool masksToBounds) | 291 void Layer::setMasksToBounds(bool masksToBounds) |
283 { | 292 { |
284 if (m_masksToBounds == masksToBounds) | 293 if (m_masksToBounds == masksToBounds) |
285 return; | 294 return; |
286 m_masksToBounds = masksToBounds; | 295 m_masksToBounds = masksToBounds; |
287 setNeedsCommit(); | 296 setNeedsCommit(); |
288 } | 297 } |
289 | 298 |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 { | 635 { |
627 return false; | 636 return false; |
628 } | 637 } |
629 | 638 |
630 void Layer::setDebugName(const std::string& debugName) | 639 void Layer::setDebugName(const std::string& debugName) |
631 { | 640 { |
632 m_debugName = debugName; | 641 m_debugName = debugName; |
633 setNeedsCommit(); | 642 setNeedsCommit(); |
634 } | 643 } |
635 | 644 |
636 float Layer::contentsScaleX() const | |
637 { | |
638 return 1.0; | |
639 } | |
640 | |
641 float Layer::contentsScaleY() const | |
642 { | |
643 return 1.0; | |
644 } | |
645 | |
646 void Layer::setRasterScale(float scale) | 645 void Layer::setRasterScale(float scale) |
647 { | 646 { |
648 if (m_rasterScale == scale) | 647 if (m_rasterScale == scale) |
649 return; | 648 return; |
650 m_rasterScale = scale; | 649 m_rasterScale = scale; |
651 | 650 |
652 if (!m_automaticallyComputeRasterScale) | 651 if (!m_automaticallyComputeRasterScale) |
653 return; | 652 return; |
654 setNeedsDisplay(); | 653 setNeedsDisplay(); |
655 } | 654 } |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 { | 819 { |
821 return 0; | 820 return 0; |
822 } | 821 } |
823 | 822 |
824 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) | 823 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) |
825 { | 824 { |
826 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. | 825 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. |
827 } | 826 } |
828 | 827 |
829 } // namespace cc | 828 } // namespace cc |
OLD | NEW |