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

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

Issue 10699065: chromeos: Fix pixelated icons in app list and launcher (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
« ui/gfx/shadow_value.h ('K') | « ui/gfx/shadow_value.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 11
12 namespace gfx { 12 namespace gfx {
13 13
14 ShadowValue::ShadowValue() 14 ShadowValue::ShadowValue()
15 : blur_(0), 15 : blur_(0),
16 color_(0) { 16 color_(0) {
17 } 17 }
18 18
19 ShadowValue::ShadowValue(const gfx::Point& offset, 19 ShadowValue::ShadowValue(const gfx::Point& offset,
20 double blur, 20 double blur,
21 SkColor color) 21 SkColor color)
22 : offset_(offset), 22 : offset_(offset),
23 blur_(blur), 23 blur_(blur),
24 color_(color) { 24 color_(color) {
25 } 25 }
26 26
27 ShadowValue::~ShadowValue() { 27 ShadowValue::~ShadowValue() {
28 } 28 }
29 29
30 ShadowValue ShadowValue::GetScaled(float scale) const {
31 return ShadowValue(gfx::Point(offset_.x() * scale, offset_.y() * scale),
pkotwicz 2012/07/02 23:34:01 Use the gfx::Point Scale method
xiyuan 2012/07/03 22:16:00 Done.
32 blur_ * scale,
33 color_);
34 }
35
30 std::string ShadowValue::ToString() const { 36 std::string ShadowValue::ToString() const {
31 return base::StringPrintf( 37 return base::StringPrintf(
32 "(%d,%d),%.2f,rgba(%d,%d,%d,%d)", 38 "(%d,%d),%.2f,rgba(%d,%d,%d,%d)",
33 offset_.x(), offset_.y(), 39 offset_.x(), offset_.y(),
34 blur_, 40 blur_,
35 SkColorGetR(color_), 41 SkColorGetR(color_),
36 SkColorGetG(color_), 42 SkColorGetG(color_),
37 SkColorGetB(color_), 43 SkColorGetB(color_),
38 SkColorGetA(color_)); 44 SkColorGetA(color_));
39 } 45 }
(...skipping 14 matching lines...) Expand all
54 left = std::max(left, blur - shadow.x()); 60 left = std::max(left, blur - shadow.x());
55 top = std::max(top, blur - shadow.y()); 61 top = std::max(top, blur - shadow.y());
56 right = std::max(right, blur + shadow.x()); 62 right = std::max(right, blur + shadow.x());
57 bottom = std::max(bottom, blur + shadow.y()); 63 bottom = std::max(bottom, blur + shadow.y());
58 } 64 }
59 65
60 return Insets(-top, -left, -bottom, -right); 66 return Insets(-top, -left, -bottom, -right);
61 } 67 }
62 68
63 } // namespace gfx 69 } // namespace gfx
OLDNEW
« ui/gfx/shadow_value.h ('K') | « ui/gfx/shadow_value.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698