| 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
|
|
|