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 "nine_patch_layer_impl.h" | 5 #include "nine_patch_layer_impl.h" |
6 | 6 |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
| 8 #include "base/values.h" |
8 #include "cc/quad_sink.h" | 9 #include "cc/quad_sink.h" |
9 #include "cc/texture_draw_quad.h" | 10 #include "cc/texture_draw_quad.h" |
10 #include "ui/gfx/rect_f.h" | 11 #include "ui/gfx/rect_f.h" |
11 | 12 |
12 namespace cc { | 13 namespace cc { |
13 | 14 |
14 NinePatchLayerImpl::NinePatchLayerImpl(int id) | 15 NinePatchLayerImpl::NinePatchLayerImpl(int id) |
15 : LayerImpl(id) | 16 : LayerImpl(id) |
16 , m_resourceId(0) | 17 , m_resourceId(0) |
17 { | 18 { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 return "NinePatchLayer"; | 157 return "NinePatchLayer"; |
157 } | 158 } |
158 | 159 |
159 void NinePatchLayerImpl::dumpLayerProperties(std::string* str, int indent) const | 160 void NinePatchLayerImpl::dumpLayerProperties(std::string* str, int indent) const |
160 { | 161 { |
161 str->append(indentString(indent)); | 162 str->append(indentString(indent)); |
162 base::StringAppendF(str, "imageAperture: %s\n", m_imageAperture.ToString().c
_str()); | 163 base::StringAppendF(str, "imageAperture: %s\n", m_imageAperture.ToString().c
_str()); |
163 LayerImpl::dumpLayerProperties(str, indent); | 164 LayerImpl::dumpLayerProperties(str, indent); |
164 } | 165 } |
165 | 166 |
| 167 base::DictionaryValue* NinePatchLayerImpl::layerTreeAsJson() const |
| 168 { |
| 169 base::DictionaryValue* result = LayerImpl::layerTreeAsJson(); |
| 170 |
| 171 base::ListValue* list = new base::ListValue; |
| 172 list->AppendInteger(m_imageAperture.origin().x()); |
| 173 list->AppendInteger(m_imageAperture.origin().y()); |
| 174 list->AppendInteger(m_imageAperture.size().width()); |
| 175 list->AppendInteger(m_imageAperture.size().height()); |
| 176 result->Set("ImageAperture", list); |
| 177 |
| 178 return result; |
166 } | 179 } |
| 180 |
| 181 } |
OLD | NEW |