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

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

Issue 2680943002: ui: Clean up naming of paint-related identifiers (Closed)
Patch Set: 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 "cc/paint/paint_flags.h"
9 #include "third_party/skia/include/core/SkPath.h" 9 #include "third_party/skia/include/core/SkPath.h"
10 #include "ui/gfx/animation/tween.h" 10 #include "ui/gfx/animation/tween.h"
(...skipping 29 matching lines...) Expand all
40 : SkIntToScalar(bounds.width() + 8) / 12.0; 40 : SkIntToScalar(bounds.width() + 8) / 12.0;
41 Rect oval = bounds; 41 Rect oval = bounds;
42 // 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
43 // the visible rect. 43 // the visible rect.
44 int inset = SkScalarCeilToInt(stroke_width / 2.0); 44 int inset = SkScalarCeilToInt(stroke_width / 2.0);
45 oval.Inset(inset, inset); 45 oval.Inset(inset, inset);
46 46
47 SkPath path; 47 SkPath path;
48 path.arcTo(RectToSkRect(oval), start_angle, sweep, true); 48 path.arcTo(RectToSkRect(oval), start_angle, sweep, true);
49 49
50 cc::PaintFlags paint; 50 cc::PaintFlags flags;
51 paint.setColor(color); 51 flags.setColor(color);
52 paint.setStrokeCap(cc::PaintFlags::kRound_Cap); 52 flags.setStrokeCap(cc::PaintFlags::kRound_Cap);
53 paint.setStrokeWidth(stroke_width); 53 flags.setStrokeWidth(stroke_width);
54 paint.setStyle(cc::PaintFlags::kStroke_Style); 54 flags.setStyle(cc::PaintFlags::kStroke_Style);
55 paint.setAntiAlias(true); 55 flags.setAntiAlias(true);
56 canvas->DrawPath(path, paint); 56 canvas->DrawPath(path, flags);
57 } 57 }
58 58
59 void CalculateWaitingAngles(const base::TimeDelta& elapsed_time, 59 void CalculateWaitingAngles(const base::TimeDelta& elapsed_time,
60 int64_t* start_angle, 60 int64_t* start_angle,
61 int64_t* sweep) { 61 int64_t* sweep) {
62 // Calculate start and end points. The angles are counter-clockwise because 62 // Calculate start and end points. The angles are counter-clockwise because
63 // 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
64 // (90 degrees) and rotates steadily. The start angle trails 180 degrees 64 // (90 degrees) and rotates steadily. The start angle trails 180 degrees
65 // behind, except for the first half revolution, when it stays at 12 o'clock. 65 // behind, except for the first half revolution, when it stays at 12 o'clock.
66 base::TimeDelta revolution_time = base::TimeDelta::FromMilliseconds(1320); 66 base::TimeDelta revolution_time = base::TimeDelta::FromMilliseconds(1320);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 waiting_start_angle + 176 waiting_start_angle +
177 360 * elapsed_time / base::TimeDelta::FromMilliseconds(kRotationTimeMs); 177 360 * elapsed_time / base::TimeDelta::FromMilliseconds(kRotationTimeMs);
178 base::TimeDelta effective_elapsed_time = 178 base::TimeDelta effective_elapsed_time =
179 elapsed_time + waiting_state->arc_time_offset; 179 elapsed_time + waiting_state->arc_time_offset;
180 180
181 PaintThrobberSpinningWithStartAngle(canvas, bounds, blend_color, 181 PaintThrobberSpinningWithStartAngle(canvas, bounds, blend_color,
182 effective_elapsed_time, start_angle); 182 effective_elapsed_time, start_angle);
183 } 183 }
184 184
185 } // 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