• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #include "webkit/renderer/compositor_bindings/web_transform_operations_impl.h"
6 
7 #include <algorithm>
8 
9 #include "ui/gfx/transform.h"
10 
11 namespace webkit {
12 
WebTransformOperationsImpl()13 WebTransformOperationsImpl::WebTransformOperationsImpl() {}
14 
15 const cc::TransformOperations&
AsTransformOperations() const16 WebTransformOperationsImpl::AsTransformOperations() const {
17   return transform_operations_;
18 }
19 
canBlendWith(const blink::WebTransformOperations & other) const20 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_);
25 }
26 
appendTranslate(double x,double y,double z)27 void WebTransformOperationsImpl::appendTranslate(double x, double y, double z) {
28   transform_operations_.AppendTranslate(x, y, z);
29 }
30 
appendRotate(double x,double y,double z,double degrees)31 void WebTransformOperationsImpl::appendRotate(double x,
32                                               double y,
33                                               double z,
34                                               double degrees) {
35   transform_operations_.AppendRotate(x, y, z, degrees);
36 }
37 
appendScale(double x,double y,double z)38 void WebTransformOperationsImpl::appendScale(double x, double y, double z) {
39   transform_operations_.AppendScale(x, y, z);
40 }
41 
appendSkew(double x,double y)42 void WebTransformOperationsImpl::appendSkew(double x, double y) {
43   transform_operations_.AppendSkew(x, y);
44 }
45 
appendPerspective(double depth)46 void WebTransformOperationsImpl::appendPerspective(double depth) {
47   transform_operations_.AppendPerspective(depth);
48 }
49 
appendMatrix(const SkMatrix44 & matrix)50 void WebTransformOperationsImpl::appendMatrix(const SkMatrix44& matrix) {
51   gfx::Transform transform(gfx::Transform::kSkipInitialization);
52   transform.matrix() = matrix;
53   transform_operations_.AppendMatrix(transform);
54 }
55 
appendIdentity()56 void WebTransformOperationsImpl::appendIdentity() {
57   transform_operations_.AppendIdentity();
58 }
59 
isIdentity() const60 bool WebTransformOperationsImpl::isIdentity() const {
61   return transform_operations_.IsIdentity();
62 }
63 
~WebTransformOperationsImpl()64 WebTransformOperationsImpl::~WebTransformOperationsImpl() {}
65 
66 }  // namespace webkit
67