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

Unified Diff: ui/compositor/clip_transform_recorder.cc

Issue 1053143002: Make View::Paint use ui::PaintRecorder to access PaintContext's canvas (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: paintrecorder: rebase 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 | « ui/compositor/clip_transform_recorder.h ('k') | ui/compositor/compositor.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/clip_transform_recorder.cc
diff --git a/ui/compositor/clip_transform_recorder.cc b/ui/compositor/clip_transform_recorder.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5a773f27f6388f9bff0895d94e8ad3afd72b9bc0
--- /dev/null
+++ b/ui/compositor/clip_transform_recorder.cc
@@ -0,0 +1,41 @@
+// 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/clip_transform_recorder.h"
+
+#include "ui/compositor/paint_context.h"
+#include "ui/gfx/canvas.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/transform.h"
+
+namespace ui {
+
+ClipTransformRecorder::ClipTransformRecorder(const PaintContext& context,
+ const gfx::Rect& clip_rect)
+ : canvas_(context.canvas()) {
+ canvas_->Save();
+ canvas_->ClipRect(clip_rect);
+}
+
+ClipTransformRecorder::ClipTransformRecorder(const PaintContext& context,
+ const gfx::Transform& transform)
+ : canvas_(context.canvas()) {
+ canvas_->Save();
+ canvas_->Transform(transform);
+}
+
+ClipTransformRecorder::ClipTransformRecorder(const PaintContext& context,
+ const gfx::Rect& clip_rect,
+ const gfx::Transform& transform)
+ : canvas_(context.canvas()) {
+ canvas_->Save();
+ canvas_->ClipRect(clip_rect);
+ canvas_->Transform(transform);
+}
+
+ClipTransformRecorder::~ClipTransformRecorder() {
+ canvas_->Restore();
+}
+
+} // namespace ui
« no previous file with comments | « ui/compositor/clip_transform_recorder.h ('k') | ui/compositor/compositor.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698