diff options
author | a.berwal <a.berwal@samsung.com> | 2015-05-04 01:28:37 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-04 08:29:00 +0000 |
commit | b98996a2d5ad7a6f7164a1fb7121cb0b95840fe0 (patch) | |
tree | c215e133b4325677589a87277cba1c432933ff45 /ui/compositor | |
parent | 6194a2573aa42a478cd0b71fec0f9d16ab01e5c0 (diff) | |
download | chromium_src-b98996a2d5ad7a6f7164a1fb7121cb0b95840fe0.zip chromium_src-b98996a2d5ad7a6f7164a1fb7121cb0b95840fe0.tar.gz chromium_src-b98996a2d5ad7a6f7164a1fb7121cb0b95840fe0.tar.bz2 |
Pass gfx structs by const ref (gfx::Vector2d/F)
Pass gfx structs by const ref (gfx::Vector2d/F)
Avoid unneccessary copy of structures gfx::Vector2d/F by passing them
by const ref rather than value. Any struct of size > 4 bytes should be
passed by const ref. Passing by ref for these structs is faster than
passing by value, especially when invoking function has multiple
parameters.
BUG=159273
Review URL: https://codereview.chromium.org/1112813003
Cr-Commit-Position: refs/heads/master@{#328104}
Diffstat (limited to 'ui/compositor')
-rw-r--r-- | ui/compositor/layer.cc | 2 | ||||
-rw-r--r-- | ui/compositor/layer.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc index ebafff0..f88557c 100644 --- a/ui/compositor/layer.cc +++ b/ui/compositor/layer.cc @@ -248,7 +248,7 @@ void Layer::SetBounds(const gfx::Rect& bounds) { GetAnimator()->SetBounds(bounds); } -void Layer::SetSubpixelPositionOffset(const gfx::Vector2dF offset) { +void Layer::SetSubpixelPositionOffset(const gfx::Vector2dF& offset) { subpixel_position_offset_ = offset; RecomputePosition(); } diff --git a/ui/compositor/layer.h b/ui/compositor/layer.h index 4180034..571bdbf 100644 --- a/ui/compositor/layer.h +++ b/ui/compositor/layer.h @@ -151,7 +151,7 @@ class COMPOSITOR_EXPORT Layer // The offset from our parent (stored in bounds.origin()) is an integer but we // may need to be at a fractional pixel offset to align properly on screen. - void SetSubpixelPositionOffset(const gfx::Vector2dF offset); + void SetSubpixelPositionOffset(const gfx::Vector2dF& offset); const gfx::Vector2dF& subpixel_position_offset() const { return subpixel_position_offset_; } |