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.
5 #include "cc/blink/web_transform_operations_impl.h"
9 #include "ui/gfx/transform.h"
13 WebTransformOperationsImpl::WebTransformOperationsImpl() {
16 const cc::TransformOperations
&
17 WebTransformOperationsImpl::AsTransformOperations() const {
18 return transform_operations_
;
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_
);
28 void WebTransformOperationsImpl::appendTranslate(double x
, double y
, double z
) {
29 transform_operations_
.AppendTranslate(x
, y
, z
);
32 void WebTransformOperationsImpl::appendRotate(double x
,
36 transform_operations_
.AppendRotate(x
, y
, z
, degrees
);
39 void WebTransformOperationsImpl::appendScale(double x
, double y
, double z
) {
40 transform_operations_
.AppendScale(x
, y
, z
);
43 void WebTransformOperationsImpl::appendSkew(double x
, double y
) {
44 transform_operations_
.AppendSkew(x
, y
);
47 void WebTransformOperationsImpl::appendPerspective(double depth
) {
48 transform_operations_
.AppendPerspective(depth
);
51 void WebTransformOperationsImpl::appendMatrix(const SkMatrix44
& matrix
) {
52 gfx::Transform
transform(gfx::Transform::kSkipInitialization
);
53 transform
.matrix() = matrix
;
54 transform_operations_
.AppendMatrix(transform
);
57 void WebTransformOperationsImpl::appendIdentity() {
58 transform_operations_
.AppendIdentity();
61 bool WebTransformOperationsImpl::isIdentity() const {
62 return transform_operations_
.IsIdentity();
65 WebTransformOperationsImpl::~WebTransformOperationsImpl() {
68 } // namespace cc_blink