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

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

Issue 93663004: [#2] Pass gfx structs by const ref (gfx::Rect, gfx::RectF) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT, fix builds on non-linux platforms! Created 6 years, 11 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
« no previous file with comments | « cc/layers/nine_patch_layer_impl.h ('k') | cc/layers/nine_patch_layer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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" 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
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
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
OLDNEW
« no previous file with comments | « cc/layers/nine_patch_layer_impl.h ('k') | cc/layers/nine_patch_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698