1 // Copyright 2013 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 "webkit/renderer/compositor_bindings/web_transform_operations_impl.h"
9 #include "ui/gfx/transform.h"
13 WebTransformOperationsImpl::WebTransformOperationsImpl() {}
15 const cc::TransformOperations
&
16 WebTransformOperationsImpl::AsTransformOperations() const {
17 return transform_operations_
;
20 bool WebTransformOperationsImpl::canBlendWith(
21 const blink::WebTransformOperations
& other
) const {
22 const WebTransformOperationsImpl
& other_impl
=
23 static_cast<const WebTransformOperationsImpl
&>(other
);
24 return transform_operations_
.CanBlendWith(other_impl
.transform_operations_
);
27 void WebTransformOperationsImpl::appendTranslate(double x
, double y
, double z
) {
28 transform_operations_
.AppendTranslate(x
, y
, z
);
31 void WebTransformOperationsImpl::appendRotate(double x
,
35 transform_operations_
.AppendRotate(x
, y
, z
, degrees
);
38 void WebTransformOperationsImpl::appendScale(double x
, double y
, double z
) {
39 transform_operations_
.AppendScale(x
, y
, z
);
42 void WebTransformOperationsImpl::appendSkew(double x
, double y
) {
43 transform_operations_
.AppendSkew(x
, y
);
46 void WebTransformOperationsImpl::appendPerspective(double depth
) {
47 transform_operations_
.AppendPerspective(depth
);
50 void WebTransformOperationsImpl::appendMatrix(const SkMatrix44
& matrix
) {
51 gfx::Transform
transform(gfx::Transform::kSkipInitialization
);
52 transform
.matrix() = matrix
;
53 transform_operations_
.AppendMatrix(transform
);
56 void WebTransformOperationsImpl::appendIdentity() {
57 transform_operations_
.AppendIdentity();
60 bool WebTransformOperationsImpl::isIdentity() const {
61 return transform_operations_
.IsIdentity();
64 WebTransformOperationsImpl::~WebTransformOperationsImpl() {}