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

Unified Diff: ui/compositor/compositing_recorder.cc

Issue 1062293003: tabstrip: Use a PaintRecorder to access the Canvas for painting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tabstrip-recorder: . 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
Index: ui/compositor/compositing_recorder.cc
diff --git a/ui/compositor/compositing_recorder.cc b/ui/compositor/compositing_recorder.cc
index 18a8fa2efd6f11a59551cc093c0dd1f7c479e55e..6fdcf0e50329a84d839351e953932d1ceaa6f1fa 100644
--- a/ui/compositor/compositing_recorder.cc
+++ b/ui/compositor/compositing_recorder.cc
@@ -9,14 +9,17 @@
namespace ui {
-CompositingRecorder::CompositingRecorder(const PaintContext& context,
- float opacity)
- : canvas_(context.canvas()) {
- canvas_->SaveLayerAlpha(0xff * opacity);
+CompositingRecorder::CompositingRecorder(const PaintContext& context, int alpha)
+ : canvas_(context.canvas()), saved_(alpha < 255) {
+ DCHECK_GE(alpha, 0);
+ DCHECK_LE(alpha, 255);
+ if (saved_)
+ canvas_->SaveLayerAlpha(alpha);
Peter Kasting 2015/04/07 21:32:39 Because SaveLayerAlpha() takes a uint8, I think |a
danakj 2015/04/07 21:36:26 I did this at first (which is why the extra git cl
Peter Kasting 2015/04/07 21:45:59 I would prefer to be consistent with the existing
}
CompositingRecorder::~CompositingRecorder() {
- canvas_->Restore();
+ if (saved_)
+ canvas_->Restore();
}
} // namespace ui
« chrome/browser/ui/views/tabs/tab_strip.cc ('K') | « ui/compositor/compositing_recorder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698