Index: ui/compositor/compositing_recorder.cc |
diff --git a/ui/compositor/compositing_recorder.cc b/ui/compositor/compositing_recorder.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..18a8fa2efd6f11a59551cc093c0dd1f7c479e55e |
--- /dev/null |
+++ b/ui/compositor/compositing_recorder.cc |
@@ -0,0 +1,22 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "ui/compositor/compositing_recorder.h" |
+ |
+#include "ui/compositor/paint_context.h" |
+#include "ui/gfx/canvas.h" |
+ |
+namespace ui { |
+ |
+CompositingRecorder::CompositingRecorder(const PaintContext& context, |
+ float opacity) |
+ : canvas_(context.canvas()) { |
+ canvas_->SaveLayerAlpha(0xff * opacity); |
+} |
+ |
+CompositingRecorder::~CompositingRecorder() { |
+ canvas_->Restore(); |
+} |
+ |
+} // namespace ui |