Home | History | Annotate | Download | only in compositor_bindings
      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 
     13 WebTransformOperationsImpl::WebTransformOperationsImpl() {}
     14 
     15 const cc::TransformOperations&
     16 WebTransformOperationsImpl::AsTransformOperations() const {
     17   return transform_operations_;
     18 }
     19 
     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_);
     25 }
     26 
     27 void WebTransformOperationsImpl::appendTranslate(double x, double y, double z) {
     28   transform_operations_.AppendTranslate(x, y, z);
     29 }
     30 
     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 
     38 void WebTransformOperationsImpl::appendScale(double x, double y, double z) {
     39   transform_operations_.AppendScale(x, y, z);
     40 }
     41 
     42 void WebTransformOperationsImpl::appendSkew(double x, double y) {
     43   transform_operations_.AppendSkew(x, y);
     44 }
     45 
     46 void WebTransformOperationsImpl::appendPerspective(double depth) {
     47   transform_operations_.AppendPerspective(depth);
     48 }
     49 
     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 
     56 void WebTransformOperationsImpl::appendIdentity() {
     57   transform_operations_.AppendIdentity();
     58 }
     59 
     60 bool WebTransformOperationsImpl::isIdentity() const {
     61   return transform_operations_.IsIdentity();
     62 }
     63 
     64 WebTransformOperationsImpl::~WebTransformOperationsImpl() {}
     65 
     66 }  // namespace webkit
     67