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

Side by Side Diff: ui/views/controls/progress_bar.cc

Issue 9544001: ui: Let skia do the conversion work for us by using the integer version of set() function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: simplify FocusableBorder::Paint Created 8 years, 9 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
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/views/controls/progress_bar.h" 5 #include "ui/views/controls/progress_bar.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 const SkScalar points[], 69 const SkScalar points[],
70 int count, 70 int count,
71 bool gradient_horizontal) { 71 bool gradient_horizontal) {
72 SkPath path; 72 SkPath path;
73 AddRoundRectPath(x, y, w, h, corner_radius, &path); 73 AddRoundRectPath(x, y, w, h, corner_radius, &path);
74 SkPaint paint; 74 SkPaint paint;
75 paint.setStyle(SkPaint::kFill_Style); 75 paint.setStyle(SkPaint::kFill_Style);
76 paint.setFlags(SkPaint::kAntiAlias_Flag); 76 paint.setFlags(SkPaint::kAntiAlias_Flag);
77 77
78 SkPoint p[2]; 78 SkPoint p[2];
79 p[0].set(SkIntToScalar(x), SkIntToScalar(y)); 79 p[0].iset(x, y);
80 if (gradient_horizontal) { 80 if (gradient_horizontal) {
81 p[1].set(SkIntToScalar(x + w), SkIntToScalar(y)); 81 p[1].iset(x + w, y);
82 } else { 82 } else {
83 p[1].set(SkIntToScalar(x), SkIntToScalar(y + h)); 83 p[1].iset(x, y + h);
84 } 84 }
85 SkShader* s = SkGradientShader::CreateLinear( 85 SkShader* s = SkGradientShader::CreateLinear(
86 p, colors, points, count, SkShader::kClamp_TileMode, NULL); 86 p, colors, points, count, SkShader::kClamp_TileMode, NULL);
87 paint.setShader(s); 87 paint.setShader(s);
88 // Need to unref shader, otherwise never deleted. 88 // Need to unref shader, otherwise never deleted.
89 s->unref(); 89 s->unref();
90 90
91 canvas->GetSkCanvas()->drawPath(path, paint); 91 canvas->GetSkCanvas()->drawPath(path, paint);
92 } 92 }
93 93
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 if (progress_width > 1) { 296 if (progress_width > 1) {
297 FillRoundRect(canvas, 0, 0, progress_width, height(), kCornerRadius, 297 FillRoundRect(canvas, 0, 0, progress_width, height(), kCornerRadius,
298 kBarColorStart, kBarColorEnd, false); 298 kBarColorStart, kBarColorEnd, false);
299 } 299 }
300 StrokeRoundRect(canvas, 0, 0, width(), height(), kCornerRadius, 300 StrokeRoundRect(canvas, 0, 0, width(), height(), kCornerRadius,
301 kBorderColor, kBorderWidth); 301 kBorderColor, kBorderWidth);
302 #endif 302 #endif
303 } 303 }
304 304
305 } // namespace views 305 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698