OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/layers/nine_patch_layer_impl.h" | 5 #include "cc/layers/nine_patch_layer_impl.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
10 #include "cc/quads/texture_draw_quad.h" | 10 #include "cc/quads/texture_draw_quad.h" |
11 #include "cc/trees/layer_tree_impl.h" | 11 #include "cc/trees/layer_tree_impl.h" |
12 #include "cc/trees/occlusion_tracker.h" | 12 #include "cc/trees/occlusion_tracker.h" |
13 #include "ui/gfx/rect_f.h" | 13 #include "ui/gfx/rect_f.h" |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 | 16 |
17 NinePatchLayerImpl::NinePatchLayerImpl(LayerTreeImpl* tree_impl, int id) | 17 NinePatchLayerImpl::NinePatchLayerImpl(LayerTreeImpl* tree_impl, int id) |
18 : UIResourceLayerImpl(tree_impl, id), | 18 : UIResourceLayerImpl(tree_impl, id), |
19 fill_center_(false) {} | 19 fill_center_(false) {} |
20 | 20 |
21 NinePatchLayerImpl::~NinePatchLayerImpl() {} | 21 NinePatchLayerImpl::~NinePatchLayerImpl() {} |
22 | 22 |
23 scoped_ptr<LayerImpl> NinePatchLayerImpl::CreateLayerImpl( | 23 scoped_ptr<LayerImpl> NinePatchLayerImpl::CreateLayerImpl( |
24 LayerTreeImpl* tree_impl) { | 24 LayerTreeImpl* tree_impl) { |
25 return NinePatchLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); | 25 return NinePatchLayerImpl::Create(tree_impl, id()); |
26 } | 26 } |
27 | 27 |
28 void NinePatchLayerImpl::PushPropertiesTo(LayerImpl* layer) { | 28 void NinePatchLayerImpl::PushPropertiesTo(LayerImpl* layer) { |
29 UIResourceLayerImpl::PushPropertiesTo(layer); | 29 UIResourceLayerImpl::PushPropertiesTo(layer); |
30 NinePatchLayerImpl* layer_impl = static_cast<NinePatchLayerImpl*>(layer); | 30 NinePatchLayerImpl* layer_impl = static_cast<NinePatchLayerImpl*>(layer); |
31 | 31 |
32 layer_impl->SetLayout(image_aperture_, border_, fill_center_); | 32 layer_impl->SetLayout(image_aperture_, border_, fill_center_); |
33 } | 33 } |
34 | 34 |
35 static gfx::RectF NormalizedRect(float x, | 35 static gfx::RectF NormalizedRect(float x, |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 result->Set("ImageBounds", list); | 392 result->Set("ImageBounds", list); |
393 | 393 |
394 result->Set("Border", MathUtil::AsValue(border_).release()); | 394 result->Set("Border", MathUtil::AsValue(border_).release()); |
395 | 395 |
396 result->SetBoolean("FillCenter", fill_center_); | 396 result->SetBoolean("FillCenter", fill_center_); |
397 | 397 |
398 return result; | 398 return result; |
399 } | 399 } |
400 | 400 |
401 } // namespace cc | 401 } // namespace cc |
OLD | NEW |