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

Unified Diff: chrome/browser/ui/views/autofill/card_unmask_prompt_views.cc

Issue 1064213002: views: Change CardUnmaskPromptViews::FadeOutView opacity to alpha. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/autofill/card_unmask_prompt_views.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/autofill/card_unmask_prompt_views.cc
diff --git a/chrome/browser/ui/views/autofill/card_unmask_prompt_views.cc b/chrome/browser/ui/views/autofill/card_unmask_prompt_views.cc
index 5d7a6c0980a4ed647dd463a3de4e474efde2f593..fce3f57021aebfad7364c7924d562200d5a24774 100644
--- a/chrome/browser/ui/views/autofill/card_unmask_prompt_views.cc
+++ b/chrome/browser/ui/views/autofill/card_unmask_prompt_views.cc
@@ -22,6 +22,7 @@
#include "ui/compositor/compositing_recorder.h"
#include "ui/compositor/paint_context.h"
#include "ui/gfx/canvas.h"
+#include "ui/gfx/geometry/safe_integer_conversions.h"
#include "ui/views/background.h"
#include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/combobox/combobox.h"
@@ -456,29 +457,30 @@ void CardUnmaskPromptViews::ClosePrompt() {
}
CardUnmaskPromptViews::FadeOutView::FadeOutView()
- : fade_everything_(false), opacity_(1.0) {
+ : fade_everything_(false), alpha_(255) {
}
CardUnmaskPromptViews::FadeOutView::~FadeOutView() {
}
void CardUnmaskPromptViews::FadeOutView::PaintChildren(
const ui::PaintContext& context) {
- int alpha = static_cast<int>(255 * opacity_);
- ui::CompositingRecorder recorder(context, alpha);
+ ui::CompositingRecorder recorder(context, alpha_);
views::View::PaintChildren(context);
}
void CardUnmaskPromptViews::FadeOutView::OnPaint(gfx::Canvas* canvas) {
- if (!fade_everything_ || opacity_ > 0.99)
+ if (!fade_everything_ || alpha_ == 255)
return views::View::OnPaint(canvas);
- canvas->SaveLayerAlpha(0xff * opacity_);
+ canvas->SaveLayerAlpha(alpha_);
views::View::OnPaint(canvas);
canvas->Restore();
}
void CardUnmaskPromptViews::FadeOutView::SetOpacity(double opacity) {
- opacity_ = opacity;
+ DCHECK_GE(opacity, 0.0);
+ DCHECK_LE(opacity, 1.0);
+ alpha_ = gfx::ToRoundedInt(opacity * 255);
Peter Kasting 2015/04/07 21:45:30 My intent was to make this function also take an i
SchedulePaint();
}
« no previous file with comments | « chrome/browser/ui/views/autofill/card_unmask_prompt_views.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698