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/layers/quad_sink.h" | 10 #include "cc/layers/quad_sink.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 float width, | 37 float width, |
38 float height, | 38 float height, |
39 float total_width, | 39 float total_width, |
40 float total_height) { | 40 float total_height) { |
41 return gfx::RectF(x / total_width, | 41 return gfx::RectF(x / total_width, |
42 y / total_height, | 42 y / total_height, |
43 width / total_width, | 43 width / total_width, |
44 height / total_height); | 44 height / total_height); |
45 } | 45 } |
46 | 46 |
47 void NinePatchLayerImpl::SetLayout(gfx::Rect aperture, | 47 void NinePatchLayerImpl::SetLayout(const gfx::Rect& aperture, |
48 gfx::Rect border, | 48 const gfx::Rect& border, |
49 bool fill_center) { | 49 bool fill_center) { |
50 // This check imposes an ordering on the call sequence. An UIResource must | 50 // This check imposes an ordering on the call sequence. An UIResource must |
51 // exist before SetLayout can be called. | 51 // exist before SetLayout can be called. |
52 DCHECK(ui_resource_id_); | 52 DCHECK(ui_resource_id_); |
53 | 53 |
54 if (image_aperture_ == aperture && | 54 if (image_aperture_ == aperture && |
55 border_ == border && fill_center_ == fill_center) | 55 border_ == border && fill_center_ == fill_center) |
56 return; | 56 return; |
57 | 57 |
58 image_aperture_ = aperture; | 58 image_aperture_ = aperture; |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 result->Set("Border", MathUtil::AsValue(border_).release()); | 362 result->Set("Border", MathUtil::AsValue(border_).release()); |
363 | 363 |
364 base::FundamentalValue* fill_center = | 364 base::FundamentalValue* fill_center = |
365 base::Value::CreateBooleanValue(fill_center_); | 365 base::Value::CreateBooleanValue(fill_center_); |
366 result->Set("FillCenter", fill_center); | 366 result->Set("FillCenter", fill_center); |
367 | 367 |
368 return result; | 368 return result; |
369 } | 369 } |
370 | 370 |
371 } // namespace cc | 371 } // namespace cc |
OLD | NEW |