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

Side by Side Diff: trunk/src/cc/layers/nine_patch_layer_impl.cc

Issue 23740010: Revert 223162 "Update the nine patch layer to use UI resources" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
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"
10 #include "cc/layers/quad_sink.h" 9 #include "cc/layers/quad_sink.h"
11 #include "cc/quads/texture_draw_quad.h" 10 #include "cc/quads/texture_draw_quad.h"
12 #include "cc/trees/layer_tree_impl.h"
13 #include "ui/gfx/rect_f.h" 11 #include "ui/gfx/rect_f.h"
14 12
15 namespace cc { 13 namespace cc {
16 14
17 NinePatchLayerImpl::NinePatchLayerImpl(LayerTreeImpl* tree_impl, int id) 15 NinePatchLayerImpl::NinePatchLayerImpl(LayerTreeImpl* tree_impl, int id)
18 : LayerImpl(tree_impl, id), 16 : LayerImpl(tree_impl, id),
19 fill_center_(false), 17 resource_id_(0) {}
20 ui_resource_id_(0) {}
21 18
22 NinePatchLayerImpl::~NinePatchLayerImpl() {} 19 NinePatchLayerImpl::~NinePatchLayerImpl() {}
23 20
24 ResourceProvider::ResourceId NinePatchLayerImpl::ContentsResourceId() const { 21 ResourceProvider::ResourceId NinePatchLayerImpl::ContentsResourceId() const {
25 return 0; 22 return 0;
26 } 23 }
27 24
28 scoped_ptr<LayerImpl> NinePatchLayerImpl::CreateLayerImpl( 25 scoped_ptr<LayerImpl> NinePatchLayerImpl::CreateLayerImpl(
29 LayerTreeImpl* tree_impl) { 26 LayerTreeImpl* tree_impl) {
30 return NinePatchLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); 27 return NinePatchLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>();
31 } 28 }
32 29
33 void NinePatchLayerImpl::PushPropertiesTo(LayerImpl* layer) { 30 void NinePatchLayerImpl::PushPropertiesTo(LayerImpl* layer) {
34 LayerImpl::PushPropertiesTo(layer); 31 LayerImpl::PushPropertiesTo(layer);
35 NinePatchLayerImpl* layer_impl = static_cast<NinePatchLayerImpl*>(layer); 32 NinePatchLayerImpl* layer_impl = static_cast<NinePatchLayerImpl*>(layer);
36 33
37 layer_impl->SetUIResourceId(ui_resource_id_); 34 if (!resource_id_)
38 layer_impl->SetLayout(image_bounds_, image_aperture_, border_, fill_center_); 35 return;
36
37 layer_impl->SetResourceId(resource_id_);
38 layer_impl->SetLayout(image_bounds_, image_aperture_);
39 } 39 }
40 40
41 static gfx::RectF NormalizedRect(float x, 41 static gfx::RectF NormalizedRect(float x,
42 float y, 42 float y,
43 float width, 43 float width,
44 float height, 44 float height,
45 float total_width, 45 float total_width,
46 float total_height) { 46 float total_height) {
47 return gfx::RectF(x / total_width, 47 return gfx::RectF(x / total_width,
48 y / total_height, 48 y / total_height,
49 width / total_width, 49 width / total_width,
50 height / total_height); 50 height / total_height);
51 } 51 }
52 52
53 void NinePatchLayerImpl::SetUIResourceId(UIResourceId uid) { 53 void NinePatchLayerImpl::SetLayout(gfx::Size image_bounds, gfx::Rect aperture) {
54 if (uid == ui_resource_id_)
55 return;
56 ui_resource_id_ = uid;
57 NoteLayerPropertyChanged();
58 }
59
60 void NinePatchLayerImpl::SetLayout(gfx::Size image_bounds,
61 gfx::Rect aperture,
62 gfx::Rect border,
63 bool fill_center) {
64 // This check imposes an ordering on the call sequence. An UIResource must
65 // exist before SetLayout can be called.
66 DCHECK(ui_resource_id_);
67
68 // |border| is in layer space. It cannot exceed the bounds of the layer.
69 DCHECK(!border.size().IsEmpty());
70 DCHECK_GT(bounds().width(), border.width());
71 DCHECK_GT(bounds().height(), border.height());
72
73 // Sanity Check on |border|
74 DCHECK_LT(border.x(), border.width());
75 DCHECK_LT(border.y(), border.height());
76 DCHECK_GT(border.x(), 0);
77 DCHECK_GT(border.y(), 0);
78
79 // |aperture| is in image space. It cannot exceed the bounds of the bitmap.
80 DCHECK(!aperture.size().IsEmpty());
81 DCHECK(gfx::Rect(image_bounds.width(), image_bounds.height())
82 .Contains(aperture));
83
84 // Avoid the degenerate cases where the aperture touches the edge of the
85 // image.
86 DCHECK_LT(aperture.width(), image_bounds.width() - 1);
87 DCHECK_LT(aperture.height(), image_bounds.height() - 1);
88 DCHECK_GT(aperture.x(), 0);
89 DCHECK_GT(aperture.y(), 0);
90
91 if (image_bounds_ == image_bounds && image_aperture_ == aperture &&
92 border_ == border && fill_center_ == fill_center)
93 return;
94
95 image_bounds_ = image_bounds; 54 image_bounds_ = image_bounds;
96 image_aperture_ = aperture; 55 image_aperture_ = aperture;
97 border_ = border;
98 fill_center_ = fill_center;
99
100 NoteLayerPropertyChanged();
101 } 56 }
102 57
103 bool NinePatchLayerImpl::WillDraw(DrawMode draw_mode, 58 bool NinePatchLayerImpl::WillDraw(DrawMode draw_mode,
104 ResourceProvider* resource_provider) { 59 ResourceProvider* resource_provider) {
105 if (!ui_resource_id_ || draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE) 60 if (!resource_id_ || draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE)
106 return false; 61 return false;
107 return LayerImpl::WillDraw(draw_mode, resource_provider); 62 return LayerImpl::WillDraw(draw_mode, resource_provider);
108 } 63 }
109 64
110 void NinePatchLayerImpl::AppendQuads(QuadSink* quad_sink, 65 void NinePatchLayerImpl::AppendQuads(QuadSink* quad_sink,
111 AppendQuadsData* append_quads_data) { 66 AppendQuadsData* append_quads_data) {
112 SharedQuadState* shared_quad_state = 67 SharedQuadState* shared_quad_state =
113 quad_sink->UseSharedQuadState(CreateSharedQuadState()); 68 quad_sink->UseSharedQuadState(CreateSharedQuadState());
114 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data); 69 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data);
115 70
116 if (!ui_resource_id_) 71 if (!resource_id_)
117 return;
118
119 ResourceProvider::ResourceId resource =
120 layer_tree_impl()->ResourceIdForUIResource(ui_resource_id_);
121
122 if (!resource)
123 return; 72 return;
124 73
125 static const bool flipped = false; 74 static const bool flipped = false;
126 static const bool premultiplied_alpha = true; 75 static const bool premultiplied_alpha = true;
127 76
128 DCHECK(!bounds().IsEmpty()); 77 DCHECK(!bounds().IsEmpty());
129 78
130 // NinePatch border widths in layer space. 79 // NinePatch border widths in bitmap pixel space
131 int layer_left_width = border_.x(); 80 int left_width = image_aperture_.x();
132 int layer_top_height = border_.y(); 81 int top_height = image_aperture_.y();
133 int layer_right_width = border_.width() - layer_left_width; 82 int right_width = image_bounds_.width() - image_aperture_.right();
134 int layer_bottom_height = border_.height() - layer_top_height; 83 int bottom_height = image_bounds_.height() - image_aperture_.bottom();
135 84
136 int layer_middle_width = bounds().width() - border_.width(); 85 // If layer can't fit the corners, clip to show the outer edges of the
137 int layer_middle_height = bounds().height() - border_.height(); 86 // image.
87 int corner_total_width = left_width + right_width;
88 int middle_width = bounds().width() - corner_total_width;
89 if (middle_width < 0) {
90 float left_width_proportion =
91 static_cast<float>(left_width) / corner_total_width;
92 int left_width_crop = middle_width * left_width_proportion;
93 left_width += left_width_crop;
94 right_width = bounds().width() - left_width;
95 middle_width = 0;
96 }
97 int corner_total_height = top_height + bottom_height;
98 int middle_height = bounds().height() - corner_total_height;
99 if (middle_height < 0) {
100 float top_height_proportion =
101 static_cast<float>(top_height) / corner_total_height;
102 int top_height_crop = middle_height * top_height_proportion;
103 top_height += top_height_crop;
104 bottom_height = bounds().height() - top_height;
105 middle_height = 0;
106 }
138 107
139 // Patch positions in layer space 108 // Patch positions in layer space
140 gfx::Rect layer_top_left(0, 0, layer_left_width, layer_top_height); 109 gfx::Rect top_left(0, 0, left_width, top_height);
141 gfx::Rect layer_top_right(bounds().width() - layer_right_width, 110 gfx::Rect top_right(
142 0, 111 bounds().width() - right_width, 0, right_width, top_height);
143 layer_right_width, 112 gfx::Rect bottom_left(
144 layer_top_height); 113 0, bounds().height() - bottom_height, left_width, bottom_height);
145 gfx::Rect layer_bottom_left(0, 114 gfx::Rect bottom_right(
146 bounds().height() - layer_bottom_height, 115 top_right.x(), bottom_left.y(), right_width, bottom_height);
147 layer_left_width, 116 gfx::Rect top(top_left.right(), 0, middle_width, top_height);
148 layer_bottom_height); 117 gfx::Rect left(0, top_left.bottom(), left_width, middle_height);
149 gfx::Rect layer_bottom_right(layer_top_right.x(), 118 gfx::Rect right(top_right.x(),
150 layer_bottom_left.y(), 119 top_right.bottom(),
151 layer_right_width, 120 right_width,
152 layer_bottom_height); 121 left.height());
153 gfx::Rect layer_top( 122 gfx::Rect bottom(top.x(), bottom_left.y(), top.width(), bottom_height);
154 layer_top_left.right(), 0, layer_middle_width, layer_top_height);
155 gfx::Rect layer_left(
156 0, layer_top_left.bottom(), layer_left_width, layer_middle_height);
157 gfx::Rect layer_right(layer_top_right.x(),
158 layer_top_right.bottom(),
159 layer_right_width,
160 layer_left.height());
161 gfx::Rect layer_bottom(layer_top.x(),
162 layer_bottom_left.y(),
163 layer_top.width(),
164 layer_bottom_height);
165 gfx::Rect layer_center(layer_left_width,
166 layer_top_height,
167 layer_middle_width,
168 layer_middle_height);
169 123
170 // Note the following values are in image (bitmap) space. 124 float img_width = image_bounds_.width();
171 float image_width = image_bounds_.width(); 125 float img_height = image_bounds_.height();
172 float image_height = image_bounds_.height();
173 126
174 int image_aperture_left_width = image_aperture_.x();
175 int image_aperture_top_height = image_aperture_.y();
176 int image_aperture_right_width = image_width - image_aperture_.right();
177 int image_aperture_bottom_height = image_height - image_aperture_.bottom();
178 // Patch positions in bitmap UV space (from zero to one) 127 // Patch positions in bitmap UV space (from zero to one)
179 gfx::RectF uv_top_left = NormalizedRect(0, 128 gfx::RectF uv_top_left = NormalizedRect(0,
180 0, 129 0,
181 image_aperture_left_width, 130 left_width,
182 image_aperture_top_height, 131 top_height,
183 image_width, 132 img_width,
184 image_height); 133 img_height);
185 gfx::RectF uv_top_right = 134 gfx::RectF uv_top_right = NormalizedRect(img_width - right_width,
186 NormalizedRect(image_width - image_aperture_right_width, 135 0,
187 0, 136 right_width,
188 image_aperture_right_width, 137 top_height,
189 image_aperture_top_height, 138 img_width,
190 image_width, 139 img_height);
191 image_height); 140 gfx::RectF uv_bottom_left = NormalizedRect(0,
192 gfx::RectF uv_bottom_left = 141 img_height - bottom_height,
193 NormalizedRect(0, 142 left_width,
194 image_height - image_aperture_bottom_height, 143 bottom_height,
195 image_aperture_left_width, 144 img_width,
196 image_aperture_bottom_height, 145 img_height);
197 image_width, 146 gfx::RectF uv_bottom_right = NormalizedRect(img_width - right_width,
198 image_height); 147 img_height - bottom_height,
199 gfx::RectF uv_bottom_right = 148 right_width,
200 NormalizedRect(image_width - image_aperture_right_width, 149 bottom_height,
201 image_height - image_aperture_bottom_height, 150 img_width,
202 image_aperture_right_width, 151 img_height);
203 image_aperture_bottom_height, 152 gfx::RectF uv_top(uv_top_left.right(),
204 image_width, 153 0,
205 image_height); 154 (img_width - left_width - right_width) / img_width,
206 gfx::RectF uv_top( 155 (top_height) / img_height);
207 uv_top_left.right(),
208 0,
209 (image_width - image_aperture_left_width - image_aperture_right_width) /
210 image_width,
211 (image_aperture_top_height) / image_height);
212 gfx::RectF uv_left(0, 156 gfx::RectF uv_left(0,
213 uv_top_left.bottom(), 157 uv_top_left.bottom(),
214 image_aperture_left_width / image_width, 158 left_width / img_width,
215 (image_height - image_aperture_top_height - 159 (img_height - top_height - bottom_height) / img_height);
216 image_aperture_bottom_height) /
217 image_height);
218 gfx::RectF uv_right(uv_top_right.x(), 160 gfx::RectF uv_right(uv_top_right.x(),
219 uv_top_right.bottom(), 161 uv_top_right.bottom(),
220 image_aperture_right_width / image_width, 162 right_width / img_width,
221 uv_left.height()); 163 uv_left.height());
222 gfx::RectF uv_bottom(uv_top.x(), 164 gfx::RectF uv_bottom(uv_top.x(),
223 uv_bottom_left.y(), 165 uv_bottom_left.y(),
224 uv_top.width(), 166 uv_top.width(),
225 image_aperture_bottom_height / image_height); 167 bottom_height / img_height);
226 gfx::RectF uv_center(uv_top_left.right(),
227 uv_top_left.bottom(),
228 uv_top.width(),
229 uv_left.height());
230 168
231 // Nothing is opaque here. 169 // Nothing is opaque here.
232 // TODO(danakj): Should we look at the SkBitmaps to determine opaqueness? 170 // TODO(danakj): Should we look at the SkBitmaps to determine opaqueness?
233 gfx::Rect opaque_rect; 171 gfx::Rect opaque_rect;
234 const float vertex_opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; 172 const float vertex_opacity[] = {1.0f, 1.0f, 1.0f, 1.0f};
235 scoped_ptr<TextureDrawQuad> quad; 173 scoped_ptr<TextureDrawQuad> quad;
236 174
237 quad = TextureDrawQuad::Create(); 175 quad = TextureDrawQuad::Create();
238 quad->SetNew(shared_quad_state, 176 quad->SetNew(shared_quad_state,
239 layer_top_left, 177 top_left,
240 opaque_rect, 178 opaque_rect,
241 resource, 179 resource_id_,
242 premultiplied_alpha, 180 premultiplied_alpha,
243 uv_top_left.origin(), 181 uv_top_left.origin(),
244 uv_top_left.bottom_right(), 182 uv_top_left.bottom_right(),
245 SK_ColorTRANSPARENT, 183 SK_ColorTRANSPARENT,
246 vertex_opacity, 184 vertex_opacity,
247 flipped); 185 flipped);
248 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data); 186 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data);
249 187
250 quad = TextureDrawQuad::Create(); 188 quad = TextureDrawQuad::Create();
251 quad->SetNew(shared_quad_state, 189 quad->SetNew(shared_quad_state,
252 layer_top_right, 190 top_right,
253 opaque_rect, 191 opaque_rect,
254 resource, 192 resource_id_,
255 premultiplied_alpha, 193 premultiplied_alpha,
256 uv_top_right.origin(), 194 uv_top_right.origin(),
257 uv_top_right.bottom_right(), 195 uv_top_right.bottom_right(),
258 SK_ColorTRANSPARENT, 196 SK_ColorTRANSPARENT,
259 vertex_opacity, 197 vertex_opacity,
260 flipped); 198 flipped);
261 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data); 199 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data);
262 200
263 quad = TextureDrawQuad::Create(); 201 quad = TextureDrawQuad::Create();
264 quad->SetNew(shared_quad_state, 202 quad->SetNew(shared_quad_state,
265 layer_bottom_left, 203 bottom_left,
266 opaque_rect, 204 opaque_rect,
267 resource, 205 resource_id_,
268 premultiplied_alpha, 206 premultiplied_alpha,
269 uv_bottom_left.origin(), 207 uv_bottom_left.origin(),
270 uv_bottom_left.bottom_right(), 208 uv_bottom_left.bottom_right(),
271 SK_ColorTRANSPARENT, 209 SK_ColorTRANSPARENT,
272 vertex_opacity, 210 vertex_opacity,
273 flipped); 211 flipped);
274 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data); 212 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data);
275 213
276 quad = TextureDrawQuad::Create(); 214 quad = TextureDrawQuad::Create();
277 quad->SetNew(shared_quad_state, 215 quad->SetNew(shared_quad_state,
278 layer_bottom_right, 216 bottom_right,
279 opaque_rect, 217 opaque_rect,
280 resource, 218 resource_id_,
281 premultiplied_alpha, 219 premultiplied_alpha,
282 uv_bottom_right.origin(), 220 uv_bottom_right.origin(),
283 uv_bottom_right.bottom_right(), 221 uv_bottom_right.bottom_right(),
284 SK_ColorTRANSPARENT, 222 SK_ColorTRANSPARENT,
285 vertex_opacity, 223 vertex_opacity,
286 flipped); 224 flipped);
287 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data); 225 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data);
288 226
289 quad = TextureDrawQuad::Create(); 227 quad = TextureDrawQuad::Create();
290 quad->SetNew(shared_quad_state, 228 quad->SetNew(shared_quad_state,
291 layer_top, 229 top,
292 opaque_rect, 230 opaque_rect,
293 resource, 231 resource_id_,
294 premultiplied_alpha, 232 premultiplied_alpha,
295 uv_top.origin(), 233 uv_top.origin(),
296 uv_top.bottom_right(), 234 uv_top.bottom_right(),
297 SK_ColorTRANSPARENT, 235 SK_ColorTRANSPARENT,
298 vertex_opacity, 236 vertex_opacity,
299 flipped); 237 flipped);
300 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data); 238 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data);
301 239
302 quad = TextureDrawQuad::Create(); 240 quad = TextureDrawQuad::Create();
303 quad->SetNew(shared_quad_state, 241 quad->SetNew(shared_quad_state,
304 layer_left, 242 left,
305 opaque_rect, 243 opaque_rect,
306 resource, 244 resource_id_,
307 premultiplied_alpha, 245 premultiplied_alpha,
308 uv_left.origin(), 246 uv_left.origin(),
309 uv_left.bottom_right(), 247 uv_left.bottom_right(),
310 SK_ColorTRANSPARENT, 248 SK_ColorTRANSPARENT,
311 vertex_opacity, 249 vertex_opacity,
312 flipped); 250 flipped);
313 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data); 251 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data);
314 252
315 quad = TextureDrawQuad::Create(); 253 quad = TextureDrawQuad::Create();
316 quad->SetNew(shared_quad_state, 254 quad->SetNew(shared_quad_state,
317 layer_right, 255 right,
318 opaque_rect, 256 opaque_rect,
319 resource, 257 resource_id_,
320 premultiplied_alpha, 258 premultiplied_alpha,
321 uv_right.origin(), 259 uv_right.origin(),
322 uv_right.bottom_right(), 260 uv_right.bottom_right(),
323 SK_ColorTRANSPARENT, 261 SK_ColorTRANSPARENT,
324 vertex_opacity, 262 vertex_opacity,
325 flipped); 263 flipped);
326 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data); 264 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data);
327 265
328 quad = TextureDrawQuad::Create(); 266 quad = TextureDrawQuad::Create();
329 quad->SetNew(shared_quad_state, 267 quad->SetNew(shared_quad_state,
330 layer_bottom, 268 bottom,
331 opaque_rect, 269 opaque_rect,
332 resource, 270 resource_id_,
333 premultiplied_alpha, 271 premultiplied_alpha,
334 uv_bottom.origin(), 272 uv_bottom.origin(),
335 uv_bottom.bottom_right(), 273 uv_bottom.bottom_right(),
336 SK_ColorTRANSPARENT, 274 SK_ColorTRANSPARENT,
337 vertex_opacity, 275 vertex_opacity,
338 flipped); 276 flipped);
339 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data); 277 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data);
278 }
340 279
341 if (fill_center_) { 280 void NinePatchLayerImpl::DidLoseOutputSurface() {
342 quad = TextureDrawQuad::Create(); 281 resource_id_ = 0;
343 quad->SetNew(shared_quad_state,
344 layer_center,
345 opaque_rect,
346 resource,
347 premultiplied_alpha,
348 uv_center.origin(),
349 uv_center.bottom_right(),
350 SK_ColorTRANSPARENT,
351 vertex_opacity,
352 flipped);
353 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data);
354 }
355 } 282 }
356 283
357 const char* NinePatchLayerImpl::LayerTypeAsString() const { 284 const char* NinePatchLayerImpl::LayerTypeAsString() const {
358 return "cc::NinePatchLayerImpl"; 285 return "cc::NinePatchLayerImpl";
359 } 286 }
360 287
361 base::DictionaryValue* NinePatchLayerImpl::LayerTreeAsJson() const { 288 base::DictionaryValue* NinePatchLayerImpl::LayerTreeAsJson() const {
362 base::DictionaryValue* result = LayerImpl::LayerTreeAsJson(); 289 base::DictionaryValue* result = LayerImpl::LayerTreeAsJson();
363 290
364 base::ListValue* list = new base::ListValue; 291 base::ListValue* list = new base::ListValue;
365 list->AppendInteger(image_aperture_.origin().x()); 292 list->AppendInteger(image_aperture_.origin().x());
366 list->AppendInteger(image_aperture_.origin().y()); 293 list->AppendInteger(image_aperture_.origin().y());
367 list->AppendInteger(image_aperture_.size().width()); 294 list->AppendInteger(image_aperture_.size().width());
368 list->AppendInteger(image_aperture_.size().height()); 295 list->AppendInteger(image_aperture_.size().height());
369 result->Set("ImageAperture", list); 296 result->Set("ImageAperture", list);
370 result->Set("ImageBounds", MathUtil::AsValue(image_bounds_).release());
371 result->Set("Border", MathUtil::AsValue(border_).release());
372 297
373 base::FundamentalValue* fill_center = 298 list = new base::ListValue;
374 base::Value::CreateBooleanValue(fill_center_); 299 list->AppendInteger(image_bounds_.width());
375 result->Set("FillCenter", fill_center); 300 list->AppendInteger(image_bounds_.height());
301 result->Set("ImageBounds", list);
376 302
377 return result; 303 return result;
378 } 304 }
379 305
380 } // namespace cc 306 } // namespace cc
OLDNEW
« no previous file with comments | « trunk/src/cc/layers/nine_patch_layer_impl.h ('k') | trunk/src/cc/layers/nine_patch_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698