Chromium Code Reviews| 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 |