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

Side by Side Diff: ui/gfx/shadow_value.cc

Issue 11369144: ui: Make gfx::Point::Scale() mutate the class, similar to gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes for aura Created 8 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/gfx/shadow_value.h" 5 #include "ui/gfx/shadow_value.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "ui/gfx/insets.h" 10 #include "ui/gfx/insets.h"
(...skipping 11 matching lines...) Expand all
22 SkColor color) 22 SkColor color)
23 : offset_(offset), 23 : offset_(offset),
24 blur_(blur), 24 blur_(blur),
25 color_(color) { 25 color_(color) {
26 } 26 }
27 27
28 ShadowValue::~ShadowValue() { 28 ShadowValue::~ShadowValue() {
29 } 29 }
30 30
31 ShadowValue ShadowValue::Scale(float scale) const { 31 ShadowValue ShadowValue::Scale(float scale) const {
32 gfx::Point scaled_offset = gfx::ToFlooredPoint(offset_.Scale(scale)); 32 gfx::Point scaled_offset =
33 gfx::ToFlooredPoint(gfx::ScalePoint(offset_, scale));
33 return ShadowValue(scaled_offset, blur_ * scale, color_); 34 return ShadowValue(scaled_offset, blur_ * scale, color_);
34 } 35 }
35 36
36 std::string ShadowValue::ToString() const { 37 std::string ShadowValue::ToString() const {
37 return base::StringPrintf( 38 return base::StringPrintf(
38 "(%d,%d),%.2f,rgba(%d,%d,%d,%d)", 39 "(%d,%d),%.2f,rgba(%d,%d,%d,%d)",
39 offset_.x(), offset_.y(), 40 offset_.x(), offset_.y(),
40 blur_, 41 blur_,
41 SkColorGetR(color_), 42 SkColorGetR(color_),
42 SkColorGetG(color_), 43 SkColorGetG(color_),
(...skipping 17 matching lines...) Expand all
60 left = std::max(left, blur - shadow.x()); 61 left = std::max(left, blur - shadow.x());
61 top = std::max(top, blur - shadow.y()); 62 top = std::max(top, blur - shadow.y());
62 right = std::max(right, blur + shadow.x()); 63 right = std::max(right, blur + shadow.x());
63 bottom = std::max(bottom, blur + shadow.y()); 64 bottom = std::max(bottom, blur + shadow.y());
64 } 65 }
65 66
66 return Insets(-top, -left, -bottom, -right); 67 return Insets(-top, -left, -bottom, -right);
67 } 68 }
68 69
69 } // namespace gfx 70 } // namespace gfx
OLDNEW
« cc/layer_impl.cc ('K') | « ui/gfx/rect_f.h ('k') | webkit/glue/webcursor_aurax11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698