Upstream version 10.38.222.0
[platform/framework/web/crosswalk.git] / src / content / renderer / compositor_bindings / web_transform_operations_impl.cc
1 // Copyright 2014 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.
4
5 #include "content/renderer/compositor_bindings/web_transform_operations_impl.h"
6
7 #include <algorithm>
8
9 #include "ui/gfx/transform.h"
10
11 namespace content {
12
13 WebTransformOperationsImpl::WebTransformOperationsImpl() {
14 }
15
16 const cc::TransformOperations&
17 WebTransformOperationsImpl::AsTransformOperations() const {
18   return transform_operations_;
19 }
20
21 bool WebTransformOperationsImpl::canBlendWith(
22     const blink::WebTransformOperations& other) const {
23   const WebTransformOperationsImpl& other_impl =
24       static_cast<const WebTransformOperationsImpl&>(other);
25   return transform_operations_.CanBlendWith(other_impl.transform_operations_);
26 }
27
28 void WebTransformOperationsImpl::appendTranslate(double x, double y, double z) {
29   transform_operations_.AppendTranslate(x, y, z);
30 }
31
32 void WebTransformOperationsImpl::appendRotate(double x,
33                                               double y,
34                                               double z,
35                                               double degrees) {
36   transform_operations_.AppendRotate(x, y, z, degrees);
37 }
38
39 void WebTransformOperationsImpl::appendScale(double x, double y, double z) {
40   transform_operations_.AppendScale(x, y, z);
41 }
42
43 void WebTransformOperationsImpl::appendSkew(double x, double y) {
44   transform_operations_.AppendSkew(x, y);
45 }
46
47 void WebTransformOperationsImpl::appendPerspective(double depth) {
48   transform_operations_.AppendPerspective(depth);
49 }
50
51 void WebTransformOperationsImpl::appendMatrix(const SkMatrix44& matrix) {
52   gfx::Transform transform(gfx::Transform::kSkipInitialization);
53   transform.matrix() = matrix;
54   transform_operations_.AppendMatrix(transform);
55 }
56
57 void WebTransformOperationsImpl::appendIdentity() {
58   transform_operations_.AppendIdentity();
59 }
60
61 bool WebTransformOperationsImpl::isIdentity() const {
62   return transform_operations_.IsIdentity();
63 }
64
65 WebTransformOperationsImpl::~WebTransformOperationsImpl() {
66 }
67
68 }  // namespace content
69