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

Side by Side Diff: content/browser/web_contents/aura/gesture_nav_simple.cc

Issue 2697663002: Clean up naming of paint-related identifiers (Closed)
Patch Set: Rebase 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/web_contents/aura/gesture_nav_simple.h" 5 #include "content/browser/web_contents/aura/gesture_nav_simple.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "cc/paint/paint_flags.h" 10 #include "cc/paint/paint_flags.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 DCHECK(abort_progress_ == 0.f || state_ == State::ABORTING); 247 DCHECK(abort_progress_ == 0.f || state_ == State::ABORTING);
248 DCHECK(complete_progress_ == 0.f || state_ == State::COMPLETING); 248 DCHECK(complete_progress_ == 0.f || state_ == State::COMPLETING);
249 249
250 ui::PaintRecorder recorder(context, painted_layer_->size()); 250 ui::PaintRecorder recorder(context, painted_layer_->size());
251 gfx::Canvas* canvas = recorder.canvas(); 251 gfx::Canvas* canvas = recorder.canvas();
252 252
253 gfx::PointF center_point(kMaxRippleBurstRadius, kMaxRippleBurstRadius); 253 gfx::PointF center_point(kMaxRippleBurstRadius, kMaxRippleBurstRadius);
254 float progress = (1 - abort_progress_) * drag_progress_; 254 float progress = (1 - abort_progress_) * drag_progress_;
255 255
256 // Draw the ripple. 256 // Draw the ripple.
257 cc::PaintFlags ripple_paint; 257 cc::PaintFlags ripple_flags;
258 ripple_paint.setAntiAlias(true); 258 ripple_flags.setAntiAlias(true);
259 ripple_paint.setStyle(cc::PaintFlags::kFill_Style); 259 ripple_flags.setStyle(cc::PaintFlags::kFill_Style);
260 ripple_paint.setColor(kRippleColor); 260 ripple_flags.setColor(kRippleColor);
261 float ripple_radius; 261 float ripple_radius;
262 if (state_ == State::COMPLETING) { 262 if (state_ == State::COMPLETING) {
263 ripple_radius = 263 ripple_radius =
264 kMaxRippleRadius + 264 kMaxRippleRadius +
265 complete_progress_ * (kMaxRippleBurstRadius - kMaxRippleRadius); 265 complete_progress_ * (kMaxRippleBurstRadius - kMaxRippleRadius);
266 } else { 266 } else {
267 ripple_radius = 267 ripple_radius =
268 kBackgroundRadius + progress * (kMaxRippleRadius - kBackgroundRadius); 268 kBackgroundRadius + progress * (kMaxRippleRadius - kBackgroundRadius);
269 } 269 }
270 canvas->DrawCircle(center_point, ripple_radius, ripple_paint); 270 canvas->DrawCircle(center_point, ripple_radius, ripple_flags);
271 271
272 // Draw the arrow background circle with the shadow. 272 // Draw the arrow background circle with the shadow.
273 cc::PaintFlags bg_paint; 273 cc::PaintFlags bg_flags;
274 bg_paint.setAntiAlias(true); 274 bg_flags.setAntiAlias(true);
275 bg_paint.setStyle(cc::PaintFlags::kFill_Style); 275 bg_flags.setStyle(cc::PaintFlags::kFill_Style);
276 bg_paint.setColor(kBackgroundColor); 276 bg_flags.setColor(kBackgroundColor);
277 gfx::ShadowValues shadow; 277 gfx::ShadowValues shadow;
278 shadow.emplace_back(gfx::Vector2d(0, kBgShadowOffsetY), kBgShadowBlurRadius, 278 shadow.emplace_back(gfx::Vector2d(0, kBgShadowOffsetY), kBgShadowBlurRadius,
279 kBgShadowColor); 279 kBgShadowColor);
280 bg_paint.setLooper(gfx::CreateShadowDrawLooperCorrectBlur(shadow)); 280 bg_flags.setLooper(gfx::CreateShadowDrawLooperCorrectBlur(shadow));
281 canvas->DrawCircle(center_point, kBackgroundRadius, bg_paint); 281 canvas->DrawCircle(center_point, kBackgroundRadius, bg_flags);
282 282
283 // Draw the arrow. 283 // Draw the arrow.
284 float arrow_x = center_point.x() - kArrowSize / 2.f; 284 float arrow_x = center_point.x() - kArrowSize / 2.f;
285 float arrow_y = center_point.y() - kArrowSize / 2.f; 285 float arrow_y = center_point.y() - kArrowSize / 2.f;
286 // Calculate the offset for the arrow relative to its circular background. 286 // Calculate the offset for the arrow relative to its circular background.
287 float arrow_x_offset = 287 float arrow_x_offset =
288 (1 - progress) * (-kBackgroundRadius + kArrowSize / 2.f); 288 (1 - progress) * (-kBackgroundRadius + kArrowSize / 2.f);
289 arrow_x += mode_ == OVERSCROLL_EAST ? arrow_x_offset : -arrow_x_offset; 289 arrow_x += mode_ == OVERSCROLL_EAST ? arrow_x_offset : -arrow_x_offset;
290 uint8_t arrow_alpha = 290 uint8_t arrow_alpha =
291 static_cast<uint8_t>(std::min(0xFF, static_cast<int>(progress * 0xFF))); 291 static_cast<uint8_t>(std::min(0xFF, static_cast<int>(progress * 0xFF)));
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 // affordance layer (e.g. when the navigated-to page is displayed while the 396 // affordance layer (e.g. when the navigated-to page is displayed while the
397 // completion animation is in progress). So instead, it is installed on top of 397 // completion animation is in progress). So instead, it is installed on top of
398 // the content window as its sibling. Note that the affordance itself makes 398 // the content window as its sibling. Note that the affordance itself makes
399 // sure that its contents are clipped to the bounds given to it. 399 // sure that its contents are clipped to the bounds given to it.
400 ui::Layer* parent = window->layer()->parent(); 400 ui::Layer* parent = window->layer()->parent();
401 parent->Add(affordance_->root_layer()); 401 parent->Add(affordance_->root_layer());
402 parent->StackAtTop(affordance_->root_layer()); 402 parent->StackAtTop(affordance_->root_layer());
403 } 403 }
404 404
405 } // namespace content 405 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.cc ('k') | content/browser/web_contents/aura/shadow_layer_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698