Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "chrome/browser/ui/views/autofill/card_unmask_prompt_views.h" | 5 #include "chrome/browser/ui/views/autofill/card_unmask_prompt_views.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | 9 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
| 10 #include "chrome/browser/ui/autofill/card_unmask_prompt_controller.h" | 10 #include "chrome/browser/ui/autofill/card_unmask_prompt_controller.h" |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 456 } | 456 } |
| 457 | 457 |
| 458 CardUnmaskPromptViews::FadeOutView::FadeOutView() | 458 CardUnmaskPromptViews::FadeOutView::FadeOutView() |
| 459 : fade_everything_(false), opacity_(1.0) { | 459 : fade_everything_(false), opacity_(1.0) { |
| 460 } | 460 } |
| 461 CardUnmaskPromptViews::FadeOutView::~FadeOutView() { | 461 CardUnmaskPromptViews::FadeOutView::~FadeOutView() { |
| 462 } | 462 } |
| 463 | 463 |
| 464 void CardUnmaskPromptViews::FadeOutView::PaintChildren( | 464 void CardUnmaskPromptViews::FadeOutView::PaintChildren( |
| 465 const ui::PaintContext& context) { | 465 const ui::PaintContext& context) { |
| 466 if (opacity_ > 0.99) | 466 int alpha = static_cast<int>(255 * opacity_); |
|
Peter Kasting
2015/04/07 21:32:39
Probably not very important, but it seems like thi
danakj
2015/04/07 21:36:25
Sure, I was just maintaining what this did before,
danakj
2015/04/07 21:43:38
Here's a followup: https://codereview.chromium.org
Peter Kasting
2015/04/07 21:45:59
You're welcome to do it either way, though I think
| |
| 467 return views::View::PaintChildren(context); | 467 ui::CompositingRecorder recorder(context, alpha); |
| 468 | |
| 469 ui::CompositingRecorder recorder(context, opacity_); | |
| 470 views::View::PaintChildren(context); | 468 views::View::PaintChildren(context); |
| 471 } | 469 } |
| 472 | 470 |
| 473 void CardUnmaskPromptViews::FadeOutView::OnPaint(gfx::Canvas* canvas) { | 471 void CardUnmaskPromptViews::FadeOutView::OnPaint(gfx::Canvas* canvas) { |
| 474 if (!fade_everything_ || opacity_ > 0.99) | 472 if (!fade_everything_ || opacity_ > 0.99) |
| 475 return views::View::OnPaint(canvas); | 473 return views::View::OnPaint(canvas); |
| 476 | 474 |
| 477 canvas->SaveLayerAlpha(0xff * opacity_); | 475 canvas->SaveLayerAlpha(0xff * opacity_); |
| 478 views::View::OnPaint(canvas); | 476 views::View::OnPaint(canvas); |
| 479 canvas->Restore(); | 477 canvas->Restore(); |
| 480 } | 478 } |
| 481 | 479 |
| 482 void CardUnmaskPromptViews::FadeOutView::SetOpacity(double opacity) { | 480 void CardUnmaskPromptViews::FadeOutView::SetOpacity(double opacity) { |
| 483 opacity_ = opacity; | 481 opacity_ = opacity; |
| 484 SchedulePaint(); | 482 SchedulePaint(); |
| 485 } | 483 } |
| 486 | 484 |
| 487 } // namespace autofill | 485 } // namespace autofill |
| OLD | NEW |