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

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

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: DrawingDisplayItem Created 3 years, 10 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
« no previous file with comments | « ui/gfx/nine_image_painter.cc ('k') | ui/gfx/paint_vector_icon.cc » ('j') | 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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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/paint_throbber.h" 5 #include "ui/gfx/paint_throbber.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "cc/paint/paint_flags.h"
8 #include "third_party/skia/include/core/SkPath.h" 9 #include "third_party/skia/include/core/SkPath.h"
9 #include "ui/gfx/animation/tween.h" 10 #include "ui/gfx/animation/tween.h"
10 #include "ui/gfx/canvas.h" 11 #include "ui/gfx/canvas.h"
11 #include "ui/gfx/color_utils.h" 12 #include "ui/gfx/color_utils.h"
12 #include "ui/gfx/geometry/rect.h" 13 #include "ui/gfx/geometry/rect.h"
13 #include "ui/gfx/skia_util.h" 14 #include "ui/gfx/skia_util.h"
14 15
15 namespace gfx { 16 namespace gfx {
16 17
17 namespace { 18 namespace {
(...skipping 21 matching lines...) Expand all
39 : SkIntToScalar(bounds.width() + 8) / 12.0; 40 : SkIntToScalar(bounds.width() + 8) / 12.0;
40 Rect oval = bounds; 41 Rect oval = bounds;
41 // Inset by half the stroke width to make sure the whole arc is inside 42 // Inset by half the stroke width to make sure the whole arc is inside
42 // the visible rect. 43 // the visible rect.
43 int inset = SkScalarCeilToInt(stroke_width / 2.0); 44 int inset = SkScalarCeilToInt(stroke_width / 2.0);
44 oval.Inset(inset, inset); 45 oval.Inset(inset, inset);
45 46
46 SkPath path; 47 SkPath path;
47 path.arcTo(RectToSkRect(oval), start_angle, sweep, true); 48 path.arcTo(RectToSkRect(oval), start_angle, sweep, true);
48 49
49 SkPaint paint; 50 cc::PaintFlags paint;
50 paint.setColor(color); 51 paint.setColor(color);
51 paint.setStrokeCap(SkPaint::kRound_Cap); 52 paint.setStrokeCap(cc::PaintFlags::kRound_Cap);
52 paint.setStrokeWidth(stroke_width); 53 paint.setStrokeWidth(stroke_width);
53 paint.setStyle(SkPaint::kStroke_Style); 54 paint.setStyle(cc::PaintFlags::kStroke_Style);
54 paint.setAntiAlias(true); 55 paint.setAntiAlias(true);
55 canvas->DrawPath(path, paint); 56 canvas->DrawPath(path, paint);
56 } 57 }
57 58
58 void CalculateWaitingAngles(const base::TimeDelta& elapsed_time, 59 void CalculateWaitingAngles(const base::TimeDelta& elapsed_time,
59 int64_t* start_angle, 60 int64_t* start_angle,
60 int64_t* sweep) { 61 int64_t* sweep) {
61 // Calculate start and end points. The angles are counter-clockwise because 62 // Calculate start and end points. The angles are counter-clockwise because
62 // the throbber spins counter-clockwise. The finish angle starts at 12 o'clock 63 // the throbber spins counter-clockwise. The finish angle starts at 12 o'clock
63 // (90 degrees) and rotates steadily. The start angle trails 180 degrees 64 // (90 degrees) and rotates steadily. The start angle trails 180 degrees
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 waiting_start_angle + 176 waiting_start_angle +
176 360 * elapsed_time / base::TimeDelta::FromMilliseconds(kRotationTimeMs); 177 360 * elapsed_time / base::TimeDelta::FromMilliseconds(kRotationTimeMs);
177 base::TimeDelta effective_elapsed_time = 178 base::TimeDelta effective_elapsed_time =
178 elapsed_time + waiting_state->arc_time_offset; 179 elapsed_time + waiting_state->arc_time_offset;
179 180
180 PaintThrobberSpinningWithStartAngle(canvas, bounds, blend_color, 181 PaintThrobberSpinningWithStartAngle(canvas, bounds, blend_color,
181 effective_elapsed_time, start_angle); 182 effective_elapsed_time, start_angle);
182 } 183 }
183 184
184 } // namespace gfx 185 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/nine_image_painter.cc ('k') | ui/gfx/paint_vector_icon.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698