Drive: Add BatchableRequest subclass.
[chromium-blink-merge.git] / ui / compositor / clip_transform_recorder.cc
blob653c818a162aca83c78c7f85bc46c7b9a24dde02
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/compositor/clip_transform_recorder.h"
7 #include "ui/compositor/paint_context.h"
8 #include "ui/gfx/canvas.h"
9 #include "ui/gfx/geometry/rect.h"
10 #include "ui/gfx/path.h"
11 #include "ui/gfx/transform.h"
13 namespace ui {
15 ClipTransformRecorder::ClipTransformRecorder(const PaintContext& context)
16 : canvas_(context.canvas()) {
17 canvas_->Save();
20 ClipTransformRecorder::~ClipTransformRecorder() {
21 canvas_->Restore();
24 void ClipTransformRecorder::ClipRect(const gfx::Rect& clip_rect) {
25 canvas_->ClipRect(clip_rect);
28 void ClipTransformRecorder::ClipPath(const gfx::Path& clip_path) {
29 bool anti_alias = false;
30 canvas_->ClipPath(clip_path, anti_alias);
33 void ClipTransformRecorder::ClipPathWithAntiAliasing(
34 const gfx::Path& clip_path) {
35 bool anti_alias = true;
36 canvas_->ClipPath(clip_path, anti_alias);
39 void ClipTransformRecorder::Transform(const gfx::Transform& transform) {
40 canvas_->Transform(transform);
43 } // namespace ui