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

Side by Side Diff: ash/touch_hud/touch_hud_renderer.cc

Issue 2893083002: cc: Move SkShader construction to a single spot in PaintShader (Closed)
Patch Set: update Created 3 years, 6 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 | « ash/touch_hud/BUILD.gn ('k') | cc/paint/BUILD.gn » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/touch_hud/touch_hud_renderer.h" 5 #include "ash/touch_hud/touch_hud_renderer.h"
6 6
7 #include "third_party/skia/include/effects/SkGradientShader.h" 7 #include "third_party/skia/include/effects/SkGradientShader.h"
8 #include "ui/compositor/layer.h" 8 #include "ui/compositor/layer.h"
9 #include "ui/compositor/layer_owner.h" 9 #include "ui/compositor/layer_owner.h"
10 #include "ui/events/event.h" 10 #include "ui/events/event.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 parent()->RemoveChildView(this); 77 parent()->RemoveChildView(this);
78 } 78 }
79 79
80 // Overridden from views::View. 80 // Overridden from views::View.
81 void OnPaint(gfx::Canvas* canvas) override { 81 void OnPaint(gfx::Canvas* canvas) override {
82 int alpha = kProjectionAlpha; 82 int alpha = kProjectionAlpha;
83 if (fadeout_) 83 if (fadeout_)
84 alpha = static_cast<int>(fadeout_->CurrentValueBetween(alpha, 0)); 84 alpha = static_cast<int>(fadeout_->CurrentValueBetween(alpha, 0));
85 fill_flags_.setAlpha(alpha); 85 fill_flags_.setAlpha(alpha);
86 stroke_flags_.setAlpha(alpha); 86 stroke_flags_.setAlpha(alpha);
87 fill_flags_.setShader(SkGradientShader::MakeRadial( 87 fill_flags_.setShader(cc::PaintShader::MakeRadialGradient(
88 gradient_center_, SkIntToScalar(kPointRadius), gradient_colors_, 88 gradient_center_, SkIntToScalar(kPointRadius), gradient_colors_,
89 gradient_pos_, arraysize(gradient_colors_), 89 gradient_pos_, arraysize(gradient_colors_),
90 SkShader::kMirror_TileMode)); 90 SkShader::kMirror_TileMode));
91 canvas->DrawCircle(circle_center_, SkIntToScalar(kPointRadius), 91 canvas->DrawCircle(circle_center_, SkIntToScalar(kPointRadius),
92 fill_flags_); 92 fill_flags_);
93 canvas->DrawCircle(circle_center_, SkIntToScalar(kPointRadius), 93 canvas->DrawCircle(circle_center_, SkIntToScalar(kPointRadius),
94 stroke_flags_); 94 stroke_flags_);
95 } 95 }
96 96
97 // Overridden from gfx::AnimationDelegate. 97 // Overridden from gfx::AnimationDelegate.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 if (event.type() == ui::ET_TOUCH_RELEASED || 171 if (event.type() == ui::ET_TOUCH_RELEASED ||
172 event.type() == ui::ET_TOUCH_CANCELLED || 172 event.type() == ui::ET_TOUCH_CANCELLED ||
173 event.type() == ui::ET_POINTER_UP || 173 event.type() == ui::ET_POINTER_UP ||
174 event.type() == ui::ET_POINTER_CANCELLED) 174 event.type() == ui::ET_POINTER_CANCELLED)
175 points_.erase(iter); 175 points_.erase(iter);
176 } 176 }
177 } 177 }
178 } 178 }
179 179
180 } // namespace ash 180 } // namespace ash
OLDNEW
« no previous file with comments | « ash/touch_hud/BUILD.gn ('k') | cc/paint/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698