• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
WebTransformOperationsImpl()13 WebTransformOperationsImpl::WebTransformOperationsImpl() {
14 }
15 
16 const cc::TransformOperations&
AsTransformOperations() const17 WebTransformOperationsImpl::AsTransformOperations() const {
18   return transform_operations_;
19 }
20 
canBlendWith(const blink::WebTransformOperations & other) const21 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 
appendTranslate(double x,double y,double z)28 void WebTransformOperationsImpl::appendTranslate(double x, double y, double z) {
29   transform_operations_.AppendTranslate(x, y, z);
30 }
31 
appendRotate(double x,double y,double z,double degrees)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 
appendScale(double x,double y,double z)39 void WebTransformOperationsImpl::appendScale(double x, double y, double z) {
40   transform_operations_.AppendScale(x, y, z);
41 }
42 
appendSkew(double x,double y)43 void WebTransformOperationsImpl::appendSkew(double x, double y) {
44   transform_operations_.AppendSkew(x, y);
45 }
46 
appendPerspective(double depth)47 void WebTransformOperationsImpl::appendPerspective(double depth) {
48   transform_operations_.AppendPerspective(depth);
49 }
50 
appendMatrix(const SkMatrix44 & matrix)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 
appendIdentity()57 void WebTransformOperationsImpl::appendIdentity() {
58   transform_operations_.AppendIdentity();
59 }
60 
isIdentity() const61 bool WebTransformOperationsImpl::isIdentity() const {
62   return transform_operations_.IsIdentity();
63 }
64 
~WebTransformOperationsImpl()65 WebTransformOperationsImpl::~WebTransformOperationsImpl() {
66 }
67 
68 }  // namespace content
69 
70