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

Side by Side Diff: ash/wm/gestures/long_press_affordance_handler.cc

Issue 11414251: ash: Use skia::RefPtr to replace manual ref-counting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | « no previous file | 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 "ash/wm/gestures/long_press_affordance_handler.h" 5 #include "ash/wm/gestures/long_press_affordance_handler.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 gfx::Point& center, 98 gfx::Point& center,
99 int start_radius, 99 int start_radius,
100 int end_radius, 100 int end_radius,
101 SkColor* colors, 101 SkColor* colors,
102 SkScalar* pos, 102 SkScalar* pos,
103 int num_colors) { 103 int num_colors) {
104 SkPoint sk_center; 104 SkPoint sk_center;
105 int radius = (end_radius + start_radius) / 2; 105 int radius = (end_radius + start_radius) / 2;
106 int glow_width = end_radius - start_radius; 106 int glow_width = end_radius - start_radius;
107 sk_center.iset(center.x(), center.y()); 107 sk_center.iset(center.x(), center.y());
108 SkShader* shader = SkGradientShader::CreateTwoPointRadial( 108 skia::RefPtr<SkShader> shader = skia::AdoptRef(
109 sk_center, 109 SkGradientShader::CreateTwoPointRadial(
110 SkIntToScalar(start_radius), 110 sk_center,
111 sk_center, 111 SkIntToScalar(start_radius),
112 SkIntToScalar(end_radius), 112 sk_center,
113 colors, 113 SkIntToScalar(end_radius),
114 pos, 114 colors,
115 num_colors, 115 pos,
116 SkShader::kClamp_TileMode); 116 num_colors,
117 SkShader::kClamp_TileMode));
117 DCHECK(shader); 118 DCHECK(shader);
118 SkPaint paint; 119 SkPaint paint;
119 paint.setStyle(SkPaint::kStroke_Style); 120 paint.setStyle(SkPaint::kStroke_Style);
120 paint.setStrokeWidth(glow_width); 121 paint.setStrokeWidth(glow_width);
121 paint.setShader(shader); 122 paint.setShader(shader.get());
122 paint.setAntiAlias(true); 123 paint.setAntiAlias(true);
123 shader->unref();
124 SkPath arc_path; 124 SkPath arc_path;
125 arc_path.addArc(SkRect::MakeXYWH(center.x() - radius, 125 arc_path.addArc(SkRect::MakeXYWH(center.x() - radius,
126 center.y() - radius, 126 center.y() - radius,
127 2 * radius, 127 2 * radius,
128 2 * radius), 128 2 * radius),
129 0, 360); 129 0, 360);
130 canvas->DrawPath(arc_path, paint); 130 canvas->DrawPath(arc_path, paint);
131 } 131 }
132 132
133 } // namespace 133 } // namespace
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 default: 369 default:
370 view_.reset(); 370 view_.reset();
371 tap_down_touch_id_ = -1; 371 tap_down_touch_id_ = -1;
372 tap_down_display_id_ = 0; 372 tap_down_display_id_ = 0;
373 break; 373 break;
374 } 374 }
375 } 375 }
376 376
377 } // namespace internal 377 } // namespace internal
378 } // namespace ash 378 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698