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

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: rebase 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
« no previous file with comments | « 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::Scale(float scale) const {
31 return ShadowValue(offset_.Scale(scale), blur_ * scale, color_);
32 }
33
30 std::string ShadowValue::ToString() const { 34 std::string ShadowValue::ToString() const {
31 return base::StringPrintf( 35 return base::StringPrintf(
32 "(%d,%d),%.2f,rgba(%d,%d,%d,%d)", 36 "(%d,%d),%.2f,rgba(%d,%d,%d,%d)",
33 offset_.x(), offset_.y(), 37 offset_.x(), offset_.y(),
34 blur_, 38 blur_,
35 SkColorGetR(color_), 39 SkColorGetR(color_),
36 SkColorGetG(color_), 40 SkColorGetG(color_),
37 SkColorGetB(color_), 41 SkColorGetB(color_),
38 SkColorGetA(color_)); 42 SkColorGetA(color_));
39 } 43 }
(...skipping 14 matching lines...) Expand all
54 left = std::max(left, blur - shadow.x()); 58 left = std::max(left, blur - shadow.x());
55 top = std::max(top, blur - shadow.y()); 59 top = std::max(top, blur - shadow.y());
56 right = std::max(right, blur + shadow.x()); 60 right = std::max(right, blur + shadow.x());
57 bottom = std::max(bottom, blur + shadow.y()); 61 bottom = std::max(bottom, blur + shadow.y());
58 } 62 }
59 63
60 return Insets(-top, -left, -bottom, -right); 64 return Insets(-top, -left, -bottom, -right);
61 } 65 }
62 66
63 } // namespace gfx 67 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/shadow_value.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698