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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "nine_patch_layer_impl.h" | 7 #include "nine_patch_layer_impl.h" |
8 | 8 |
9 #include "base/stringprintf.h" | |
9 #include "cc/quad_sink.h" | 10 #include "cc/quad_sink.h" |
10 #include "cc/texture_draw_quad.h" | 11 #include "cc/texture_draw_quad.h" |
11 #include "ui/gfx/rect_f.h" | 12 #include "ui/gfx/rect_f.h" |
12 | 13 |
13 namespace cc { | 14 namespace cc { |
14 | 15 |
15 NinePatchLayerImpl::NinePatchLayerImpl(int id) | 16 NinePatchLayerImpl::NinePatchLayerImpl(int id) |
16 : LayerImpl(id) | 17 : LayerImpl(id) |
17 , m_resourceId(0) | 18 , m_resourceId(0) |
18 { | 19 { |
19 } | 20 } |
20 | 21 |
21 NinePatchLayerImpl::~NinePatchLayerImpl() | 22 NinePatchLayerImpl::~NinePatchLayerImpl() |
22 { | 23 { |
23 } | 24 } |
24 | 25 |
25 ResourceProvider::ResourceId NinePatchLayerImpl::contentsResourceId() const | 26 ResourceProvider::ResourceId NinePatchLayerImpl::contentsResourceId() const |
26 { | 27 { |
27 return 0; | 28 return 0; |
28 } | 29 } |
29 | 30 |
30 void NinePatchLayerImpl::dumpLayerProperties(std::string* str, int indent) const | |
31 { | |
32 LayerImpl::dumpLayerProperties(str, indent); | |
33 } | |
34 | |
35 | |
36 void NinePatchLayerImpl::willDraw(ResourceProvider* resourceProvider) | 31 void NinePatchLayerImpl::willDraw(ResourceProvider* resourceProvider) |
37 { | 32 { |
38 } | 33 } |
39 | 34 |
40 static gfx::RectF normalizedRect(float x, float y, float width, float height, fl oat totalWidth, float totalHeight) | 35 static gfx::RectF normalizedRect(float x, float y, float width, float height, fl oat totalWidth, float totalHeight) |
41 { | 36 { |
42 return gfx::RectF(x / totalWidth, y / totalHeight, width / totalWidth, heigh t / totalHeight); | 37 return gfx::RectF(x / totalWidth, y / totalHeight, width / totalWidth, heigh t / totalHeight); |
43 } | 38 } |
44 | 39 |
45 void NinePatchLayerImpl::setLayout(const gfx::Size& imageBounds, const gfx::Rect & aperture) | 40 void NinePatchLayerImpl::setLayout(const gfx::Size& imageBounds, const gfx::Rect & aperture) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 void NinePatchLayerImpl::didLoseContext() | 102 void NinePatchLayerImpl::didLoseContext() |
108 { | 103 { |
109 m_resourceId = 0; | 104 m_resourceId = 0; |
110 } | 105 } |
111 | 106 |
112 const char* NinePatchLayerImpl::layerTypeAsString() const | 107 const char* NinePatchLayerImpl::layerTypeAsString() const |
113 { | 108 { |
114 return "NinePatchLayer"; | 109 return "NinePatchLayer"; |
115 } | 110 } |
116 | 111 |
112 void NinePatchLayerImpl::dumpLayerProperties(std::string* str, int indent) const | |
113 { | |
114 str->append(indentString(indent)); | |
115 base::StringAppendF(str, "m_imageAperture: %s\n", m_imageAperture.ToString() .c_str()); | |
danakj
2012/11/07 21:31:35
nit: drop the m_ it's cleaner.
maybe consider put
| |
116 LayerImpl::dumpLayerProperties(str, indent); | |
117 } | 117 } |
118 | |
119 } | |
danakj
2012/11/07 19:00:01
} // namespace cc
| |
OLD | NEW |