⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 145442 in webkit


Ignore:
Timestamp:
Mar 11, 2013, 5:45:33 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

[chromium] Use SkMatrix44 instead of WebTransformationMatrix in animation APIs
​https://bugs.webkit.org/show_bug.cgi?id=111791

Patch by James Robinson <​jamesr@chromium.org> on 2013-03-11
Reviewed by Adrienne Walker.

Source/Platform:

This adds SkMatrix44 overrides for animation APIs that deal with matrices and slims the interface
down for WebTransformationMatrix to the minimum needed to compile. With this patch, there are no
live codepaths that use WebTransformationMatrix but some downstream code still needs a type and a
few functions to compile. After the downstream code is patched this type can go away completely.

  • chromium/public/WebLayer.h:

(WebKit):
(WebLayer):

  • chromium/public/WebTransformAnimationCurve.h:

(WebTransformAnimationCurve):

  • chromium/public/WebTransformOperations.h:

(WebTransformOperations):

  • chromium/public/WebTransformationMatrix.h:

(WebTransformationMatrix):

Source/WebCore:

Adds a new utility function to convert a TransformationMatrix to an SkMatrix44 and
uses it in AnimationTranslationUtil and GraphicsLayerChromium.

  • WebCore.gypi:
  • platform/chromium/support/WebTransformationMatrix.cpp:

(WebKit::WebTransformationMatrix::WebTransformationMatrix):

  • platform/graphics/chromium/AnimationTranslationUtil.cpp:

(WebCore::toWebTransformOperations):

  • platform/graphics/chromium/GraphicsLayerChromium.cpp:

(WebCore::GraphicsLayerChromium::updateTransform):
(WebCore::GraphicsLayerChromium::updateChildrenTransform):

  • platform/graphics/chromium/TransformSkMatrix44Conversions.cpp:

(WebCore::TransformSkMatrix44Conversions::convert):

  • platform/graphics/chromium/TransformSkMatrix44Conversions.h:

(TransformSkMatrix44Conversions):

Location:
trunk/Source
Files:
10 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/Platform/ChangeLog

    r145279 r145442  
     12013-03-11  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] Use SkMatrix44 instead of WebTransformationMatrix in animation APIs
     4        https://bugs.webkit.org/show_bug.cgi?id=111791
     5
     6        Reviewed by Adrienne Walker.
     7
     8        This adds SkMatrix44 overrides for animation APIs that deal with matrices and slims the interface
     9        down for WebTransformationMatrix to the minimum needed to compile. With this patch, there are no
     10        live codepaths that use WebTransformationMatrix but some downstream code still needs a type and a
     11        few functions to compile. After the downstream code is patched this type can go away completely.
     12
     13        * chromium/public/WebLayer.h:
     14        (WebKit):
     15        (WebLayer):
     16        * chromium/public/WebTransformAnimationCurve.h:
     17        (WebTransformAnimationCurve):
     18        * chromium/public/WebTransformOperations.h:
     19        (WebTransformOperations):
     20        * chromium/public/WebTransformationMatrix.h:
     21        (WebTransformationMatrix):
     22
    1232013-03-08  Harald Alvestrand  <hta@chromium.org>
    224
  • trunk/Source/Platform/chromium/public/WebLayer.h

    r138831 r145442  
    4343class WebFilterOperations;
    4444class WebLayerScrollClient;
    45 class WebTransformationMatrix;
    4645struct WebFloatPoint;
    4746struct WebFloatRect;
    … …  
    9594
    9695    virtual void setSublayerTransform(const SkMatrix44&) = 0;
    97     virtual void setSublayerTransform(const WebTransformationMatrix&) = 0;
    9896    virtual SkMatrix44 sublayerTransform() const = 0;
    9997
    10098    virtual void setTransform(const SkMatrix44&) = 0;
    101     virtual void setTransform(const WebTransformationMatrix&) = 0;
    10299    virtual SkMatrix44 transform() const = 0;
    103100
  • trunk/Source/Platform/chromium/public/WebTransformAnimationCurve.h

    r138831 r145442  
    3030#include "WebCommon.h"
    3131#include "WebTransformKeyframe.h"
    32 #include "WebTransformationMatrix.h"
    3332
    3433namespace WebKit {
    … …  
    4544    // assumed that x0 = y0 = 0, and x3 = y3 = 1.
    4645    virtual void add(const WebTransformKeyframe&, double x1, double y1, double x2, double y2) = 0;
    47 
    48     virtual WebTransformationMatrix getValue(double time) const = 0;
    49 
    5046};
    5147
  • trunk/Source/Platform/chromium/public/WebTransformOperations.h

    r140184 r145442  
    2626#define WebTransformOperations_h
    2727
    28 #include "WebTransformationMatrix.h"
     28class SkMatrix44;
    2929
    3030#define WEB_TRANSFORM_OPERATIONS_IS_VIRTUAL 1
    … …  
    4646    virtual void appendSkew(double x, double y) = 0;
    4747    virtual void appendPerspective(double depth) = 0;
    48     virtual void appendMatrix(const WebTransformationMatrix&) = 0;
     48    virtual void appendMatrix(const SkMatrix44&) = 0;
    4949    virtual void appendIdentity() = 0;
    5050
  • trunk/Source/Platform/chromium/public/WebTransformationMatrix.h

    r138825 r145442  
    4848public:
    4949    WEBKIT_EXPORT WebTransformationMatrix();
    50     WEBKIT_EXPORT WebTransformationMatrix(double a, double b, double c, double d, double e, double f);
    51     WEBKIT_EXPORT WebTransformationMatrix(double m11, double m12, double m13, double m14,
    52                                           double m21, double m22, double m23, double m24,
    53                                           double m31, double m32, double m33, double m34,
    54                                           double m41, double m42, double m43, double m44);
    5550    WEBKIT_EXPORT WebTransformationMatrix(const WebTransformationMatrix&);
    5651    ~WebTransformationMatrix() { reset(); }
    5752
    5853    WEBKIT_EXPORT void reset();
    59 
    60     // Operations that return a separate matrix and do not modify this one.
    61     WEBKIT_EXPORT WebTransformationMatrix inverse() const;
    62     WEBKIT_EXPORT WebTransformationMatrix to2dTransform() const;
    63 
    64     WEBKIT_EXPORT WebTransformationMatrix& operator=(const WebTransformationMatrix&);
    65     WEBKIT_EXPORT bool operator==(const WebTransformationMatrix&) const;
    66     WEBKIT_EXPORT WebTransformationMatrix operator*(const WebTransformationMatrix&) const;
    67 
    68     // Operations that modify this matrix
    69     WEBKIT_EXPORT void multiply(const WebTransformationMatrix&);
    70     WEBKIT_EXPORT void makeIdentity();
    71     WEBKIT_EXPORT void translate(double tx, double ty);
    72     WEBKIT_EXPORT void translate3d(double tx, double ty, double tz);
    73     WEBKIT_EXPORT void translateRight3d(double tx, double ty, double tz);
    74     WEBKIT_EXPORT void scale(double s);
    75     WEBKIT_EXPORT void scaleNonUniform(double sx, double sy);
    76     WEBKIT_EXPORT void scale3d(double sx, double sy, double sz);
    77     WEBKIT_EXPORT void rotate(double angle);
    78     WEBKIT_EXPORT void rotate3d(double rx, double ry, double rz);
    79     WEBKIT_EXPORT void rotate3d(double x, double y, double z, double angle);
    80     WEBKIT_EXPORT void skewX(double angle);
    81     WEBKIT_EXPORT void skewY(double angle);
    82     WEBKIT_EXPORT void applyPerspective(double p);
    83     WEBKIT_EXPORT bool blend(const WebTransformationMatrix& from, double progress);
    84 
    85     WEBKIT_EXPORT bool hasPerspective() const;
    86     WEBKIT_EXPORT bool isInvertible() const;
    87     WEBKIT_EXPORT bool isBackFaceVisible() const;
    88     WEBKIT_EXPORT bool isIdentity() const;
    89     WEBKIT_EXPORT bool isIdentityOrTranslation() const;
    90     WEBKIT_EXPORT bool isIntegerTranslation() const;
    9154
    9255    // Accessors
  • trunk/Source/WebCore/ChangeLog

    r145441 r145442  
     12013-03-11  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] Use SkMatrix44 instead of WebTransformationMatrix in animation APIs
     4        https://bugs.webkit.org/show_bug.cgi?id=111791
     5
     6        Reviewed by Adrienne Walker.
     7
     8        Adds a new utility function to convert a TransformationMatrix to an SkMatrix44 and
     9        uses it in AnimationTranslationUtil and GraphicsLayerChromium.
     10
     11        * WebCore.gypi:
     12        * platform/chromium/support/WebTransformationMatrix.cpp:
     13        (WebKit::WebTransformationMatrix::WebTransformationMatrix):
     14        * platform/graphics/chromium/AnimationTranslationUtil.cpp:
     15        (WebCore::toWebTransformOperations):
     16        * platform/graphics/chromium/GraphicsLayerChromium.cpp:
     17        (WebCore::GraphicsLayerChromium::updateTransform):
     18        (WebCore::GraphicsLayerChromium::updateChildrenTransform):
     19        * platform/graphics/chromium/TransformSkMatrix44Conversions.cpp:
     20        (WebCore::TransformSkMatrix44Conversions::convert):
     21        * platform/graphics/chromium/TransformSkMatrix44Conversions.h:
     22        (TransformSkMatrix44Conversions):
     23
    1242013-03-11  Sheriff Bot  <webkit.review.bot@gmail.com>
    225
  • trunk/Source/WebCore/WebCore.gypi

    r145411 r145442  
    40554055            'platform/graphics/chromium/ThreadSafeDataTransport.cpp',
    40564056            'platform/graphics/chromium/ThreadSafeDataTransport.h',
     4057            'platform/graphics/chromium/TransformSkMatrix44Conversions.cpp',
     4058            'platform/graphics/chromium/TransformSkMatrix44Conversions.h',
    40574059            'platform/graphics/chromium/TransparencyWin.cpp',
    40584060            'platform/graphics/chromium/TransparencyWin.h',
  • trunk/Source/WebCore/platform/chromium/support/WebTransformationMatrix.cpp

    r138825 r145442  
    3838}
    3939
    40 WebTransformationMatrix::WebTransformationMatrix(double a, double b, double c, double d, double e, double f)
    41     : m_private(new TransformationMatrix(a, b, c, d, e, f))
    42 {
    43 }
    44 
    45 WebTransformationMatrix::WebTransformationMatrix(double m11, double m12, double m13, double m14,
    46                                                  double m21, double m22, double m23, double m24,
    47                                                  double m31, double m32, double m33, double m34,
    48                                                  double m41, double m42, double m43, double m44)
    49     : m_private(new TransformationMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44))
    50 {
    51 }
    52 
    53 WebTransformationMatrix::WebTransformationMatrix(const WebTransformationMatrix& t)
    54     : m_private(new TransformationMatrix(*t.m_private.get()))
     40WebTransformationMatrix::WebTransformationMatrix(const WebTransformationMatrix& matrix)
     41    : m_private(new TransformationMatrix(*matrix.m_private.get()))
    5542{
    5643}
    … …  
    6653}
    6754
    68 WebTransformationMatrix& WebTransformationMatrix::operator=(const WebTransformationMatrix& t)
    69 {
    70     m_private.reset(new TransformationMatrix(*t.m_private.get()));
    71     return *this;
    72 }
    73 
    74 bool WebTransformationMatrix::operator==(const WebTransformationMatrix& t) const
    75 {
    76     return *m_private.get() == *t.m_private.get();
    77 }
    78 
    79 WebTransformationMatrix WebTransformationMatrix::operator*(const WebTransformationMatrix& t) const
    80 {
    81     WebTransformationMatrix result = *this;
    82     result.multiply(t);
    83     return result;
    84 }
    85 
    86 WebTransformationMatrix WebTransformationMatrix::inverse() const
    87 {
    88     return WebTransformationMatrix(m_private->inverse());
    89 }
    90 
    91 WebTransformationMatrix WebTransformationMatrix::to2dTransform() const
    92 {
    93     WebTransformationMatrix result;
    94     result.m_private.reset(new TransformationMatrix(m_private->to2dTransform()));
    95     return result;
    96 }
    97 
    98 void WebTransformationMatrix::multiply(const WebTransformationMatrix& t)
    99 {
    100     m_private->multiply(*t.m_private.get());
    101 }
    102 
    103 void WebTransformationMatrix::makeIdentity()
    104 {
    105     m_private->makeIdentity();
    106 }
    107 
    108 void WebTransformationMatrix::translate(double tx, double ty)
    109 {
    110     m_private->translate(tx, ty);
    111 }
    112 
    113 void WebTransformationMatrix::translate3d(double tx, double ty, double tz)
    114 {
    115     m_private->translate3d(tx, ty, tz);
    116 }
    117 
    118 void WebTransformationMatrix::translateRight3d(double tx, double ty, double tz)
    119 {
    120     m_private->translateRight3d(tx, ty, tz);
    121 }
    122 
    123 void WebTransformationMatrix::scale(double s)
    124 {
    125     m_private->scale(s);
    126 }
    127 
    128 void WebTransformationMatrix::scaleNonUniform(double sx, double sy)
    129 {
    130     m_private->scaleNonUniform(sx, sy);
    131 }
    132 
    133 void WebTransformationMatrix::scale3d(double sx, double sy, double sz)
    134 {
    135     m_private->scale3d(sx, sy, sz);
    136 }
    137 
    138 void WebTransformationMatrix::rotate(double angle)
    139 {
    140     m_private->rotate(angle);
    141 }
    142 
    143 void WebTransformationMatrix::rotate3d(double rx, double ry, double rz)
    144 {
    145     m_private->rotate3d(rx, ry, rz);
    146 }
    147 
    148 void WebTransformationMatrix::rotate3d(double x, double y, double z, double angle)
    149 {
    150     m_private->rotate3d(x, y, z, angle);
    151 }
    152 
    153 void WebTransformationMatrix::skewX(double angle)
    154 {
    155     m_private->skewX(angle);
    156 }
    157 
    158 void WebTransformationMatrix::skewY(double angle)
    159 {
    160     m_private->skewY(angle);
    161 }
    162 
    163 void WebTransformationMatrix::applyPerspective(double p)
    164 {
    165     m_private->applyPerspective(p);
    166 }
    167 
    168 bool WebTransformationMatrix::blend(const WebTransformationMatrix& from, double progress)
    169 {
    170     WebCore::TransformationMatrix::DecomposedType dummy;
    171     if (!m_private->decompose(dummy) || !from.m_private->decompose(dummy))
    172         return false;
    173     m_private->blend(*from.m_private.get(), progress);
    174     return true;
    175 }
    176 
    177 bool WebTransformationMatrix::hasPerspective() const
    178 {
    179     return m_private->hasPerspective();
    180 }
    181 
    182 bool WebTransformationMatrix::isInvertible() const
    183 {
    184     return m_private->isInvertible();
    185 }
    186 
    187 bool WebTransformationMatrix::isBackFaceVisible() const
    188 {
    189     return m_private->isBackFaceVisible();
    190 }
    191 
    192 bool WebTransformationMatrix::isIdentity() const
    193 {
    194     return m_private->isIdentity();
    195 }
    196 
    197 bool WebTransformationMatrix::isIdentityOrTranslation() const
    198 {
    199     return m_private->isIdentityOrTranslation();
    200 }
    201 
    202 bool WebTransformationMatrix::isIntegerTranslation() const
    203 {
    204     return m_private->isIntegerTranslation();
    205 }
    206 
    20755double WebTransformationMatrix::m11() const
    20856{
    20957    return m_private->m11();
    210 }
    211 
    212 void WebTransformationMatrix::setM11(double f)
    213 {
    214     m_private->setM11(f);
    21558}
    21659
    … …  
    22063}
    22164
    222 void WebTransformationMatrix::setM12(double f)
    223 {
    224     m_private->setM12(f);
    225 }
    226 
    22765double WebTransformationMatrix::m13() const
    22866{
    22967    return m_private->m13();
    230 }
    231 
    232 void WebTransformationMatrix::setM13(double f)
    233 {
    234     m_private->setM13(f);
    23568}
    23669
    … …  
    24073}
    24174
    242 void WebTransformationMatrix::setM14(double f)
    243 {
    244     m_private->setM14(f);
    245 }
    246 
    24775double WebTransformationMatrix::m21() const
    24876{
    24977    return m_private->m21();
    250 }
    251 
    252 void WebTransformationMatrix::setM21(double f)
    253 {
    254     m_private->setM21(f);
    25578}
    25679
    … …  
    26083}
    26184
    262 void WebTransformationMatrix::setM22(double f)
    263 {
    264     m_private->setM22(f);
    265 }
    266 
    26785double WebTransformationMatrix::m23() const
    26886{
    26987    return m_private->m23();
    270 }
    271 
    272 void WebTransformationMatrix::setM23(double f)
    273 {
    274     m_private->setM23(f);
    27588}
    27689
    … …  
    28093}
    28194
    282 void WebTransformationMatrix::setM24(double f)
    283 {
    284     m_private->setM24(f);
    285 }
    286 
    28795double WebTransformationMatrix::m31() const
    28896{
    28997    return m_private->m31();
    290 }
    291 
    292 void WebTransformationMatrix::setM31(double f)
    293 {
    294     m_private->setM31(f);
    29598}
    29699
    … …  
    300103}
    301104
    302 void WebTransformationMatrix::setM32(double f)
    303 {
    304     m_private->setM32(f);
    305 }
    306 
    307105double WebTransformationMatrix::m33() const
    308106{
    309107    return m_private->m33();
    310 }
    311 
    312 void WebTransformationMatrix::setM33(double f)
    313 {
    314     m_private->setM33(f);
    315108}
    316109
    … …  
    320113}
    321114
    322 void WebTransformationMatrix::setM34(double f)
    323 {
    324     m_private->setM34(f);
    325 }
    326 
    327115double WebTransformationMatrix::m41() const
    328116{
    329117    return m_private->m41();
    330 }
    331 
    332 void WebTransformationMatrix::setM41(double f)
    333 {
    334     m_private->setM41(f);
    335118}
    336119
    … …  
    340123}
    341124
    342 void WebTransformationMatrix::setM42(double f)
    343 {
    344     m_private->setM42(f);
    345 }
    346 
    347125double WebTransformationMatrix::m43() const
    348126{
    349127    return m_private->m43();
    350 }
    351 
    352 void WebTransformationMatrix::setM43(double f)
    353 {
    354     m_private->setM43(f);
    355128}
    356129
    … …  
    360133}
    361134
    362 void WebTransformationMatrix::setM44(double f)
    363 {
    364     m_private->setM44(f);
    365 }
    366 
    367 double WebTransformationMatrix::a() const
    368 {
    369     return m_private->a();
    370 }
    371 
    372 void WebTransformationMatrix::setA(double a)
    373 {
    374     m_private->setA(a);
    375 }
    376 
    377 double WebTransformationMatrix::b() const
    378 {
    379     return m_private->b();
    380 }
    381 
    382 void WebTransformationMatrix::setB(double b)
    383 {
    384     m_private->setB(b);
    385 }
    386 
    387 double WebTransformationMatrix::c() const
    388 {
    389     return m_private->c();
    390 }
    391 
    392 void WebTransformationMatrix::setC(double c)
    393 {
    394     m_private->setC(c);
    395 }
    396 
    397 double WebTransformationMatrix::d() const
    398 {
    399     return m_private->d();
    400 }
    401 
    402 void WebTransformationMatrix::setD(double d)
    403 {
    404     m_private->setD(d);
    405 }
    406 
    407 double WebTransformationMatrix::e() const
    408 {
    409     return m_private->e();
    410 }
    411 
    412 void WebTransformationMatrix::setE(double e)
    413 {
    414     m_private->setE(e);
    415 }
    416 
    417 double WebTransformationMatrix::f() const
    418 {
    419     return m_private->f();
    420 }
    421 
    422 void WebTransformationMatrix::setF(double f)
    423 {
    424     m_private->setF(f);
    425 }
    426 
    427 TransformationMatrix WebTransformationMatrix::toWebCoreTransform() const
    428 {
    429     return *m_private.get();
    430 }
    431 
    432135} // namespace WebKit
  • trunk/Source/WebCore/platform/graphics/chromium/AnimationTranslationUtil.cpp

    r140184 r145442  
    3737#include "RotateTransformOperation.h"
    3838#include "ScaleTransformOperation.h"
     39#include "SkMatrix44.h"
    3940#include "SkewTransformOperation.h"
    4041#include "TransformOperations.h"
     42#include "TransformSkMatrix44Conversions.h"
    4143#include "TranslateTransformOperation.h"
    4244
    … …  
    4850#include <public/WebTransformAnimationCurve.h>
    4951#include <public/WebTransformOperations.h>
    50 #include <public/WebTransformationMatrix.h>
    5152
    5253#include <wtf/OwnPtr.h>
    … …  
    103104            MatrixTransformOperation* transform = static_cast<MatrixTransformOperation*>(transformOperations.operations()[j].get());
    104105            TransformationMatrix m = transform->matrix();
    105             webTransformOperations->appendMatrix(WebTransformationMatrix(m));
     106            webTransformOperations->appendMatrix(TransformSkMatrix44Conversions::convert(m));
    106107            break;
    107108        }
    … …  
    109110            Matrix3DTransformOperation* transform = static_cast<Matrix3DTransformOperation*>(transformOperations.operations()[j].get());
    110111            TransformationMatrix m = transform->matrix();
    111             webTransformOperations->appendMatrix(WebTransformationMatrix(m));
     112            webTransformOperations->appendMatrix(TransformSkMatrix44Conversions::convert(m));
    112113            break;
    113114        }
  • trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp

    r145131 r145442  
    6060#include "SkiaImageFilterBuilder.h"
    6161#include "SystemTime.h"
     62#include "TransformSkMatrix44Conversions.h"
    6263#include <public/Platform.h>
    6364#include <public/WebAnimation.h>
    … …  
    702703}
    703704
    704 static SkMatrix44 transformToSkMatrix44(const TransformationMatrix& matrix)
    705 {
    706     SkMatrix44 ret(SkMatrix44::kUninitialized_Constructor);
    707     ret.setDouble(0, 0, matrix.m11());
    708     ret.setDouble(0, 1, matrix.m21());
    709     ret.setDouble(0, 2, matrix.m31());
    710     ret.setDouble(0, 3, matrix.m41());
    711     ret.setDouble(1, 0, matrix.m12());
    712     ret.setDouble(1, 1, matrix.m22());
    713     ret.setDouble(1, 2, matrix.m32());
    714     ret.setDouble(1, 3, matrix.m42());
    715     ret.setDouble(2, 0, matrix.m13());
    716     ret.setDouble(2, 1, matrix.m23());
    717     ret.setDouble(2, 2, matrix.m33());
    718     ret.setDouble(2, 3, matrix.m43());
    719     ret.setDouble(3, 0, matrix.m14());
    720     ret.setDouble(3, 1, matrix.m24());
    721     ret.setDouble(3, 2, matrix.m34());
    722     ret.setDouble(3, 3, matrix.m44());
    723     return ret;
    724 }
    725 
    726705void GraphicsLayerChromium::updateTransform()
    727706{
    728     platformLayer()->setTransform(transformToSkMatrix44(m_transform));
     707    platformLayer()->setTransform(TransformSkMatrix44Conversions::convert(m_transform));
    729708}
    730709
    731710void GraphicsLayerChromium::updateChildrenTransform()
    732711{
    733     platformLayer()->setSublayerTransform(transformToSkMatrix44(m_childrenTransform));
     712    platformLayer()->setSublayerTransform(TransformSkMatrix44Conversions::convert(m_childrenTransform));
    734713}
    735714
  • trunk/Source/WebCore/platform/graphics/chromium/TransformSkMatrix44Conversions.cpp

    r145441 r145442  
    11/*
    2  * Copyright (C) 2012 Google Inc. All rights reserved.
     2 * Copyright (C) 2013 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
    … …  
    2323 */
    2424
    25 #ifndef WebTransformAnimationCurve_h
    26 #define WebTransformAnimationCurve_h
     25#include "config.h"
    2726
    28 #include "WebAnimationCurve.h"
     27#include "TransformSkMatrix44Conversions.h"
    2928
    30 #include "WebCommon.h"
    31 #include "WebTransformKeyframe.h"
    32 #include "WebTransformationMatrix.h"
     29#include "TransformationMatrix.h"
    3330
    34 namespace WebKit {
     31namespace WebCore {
    3532
    36 // A keyframed transform animation curve.
    37 class WebTransformAnimationCurve : public WebAnimationCurve {
    38 public:
    39     virtual ~WebTransformAnimationCurve() { }
     33SkMatrix44 TransformSkMatrix44Conversions::convert(const TransformationMatrix& matrix)
     34{
     35    SkMatrix44 ret(SkMatrix44::kUninitialized_Constructor);
     36    ret.setDouble(0, 0, matrix.m11());
     37    ret.setDouble(0, 1, matrix.m21());
     38    ret.setDouble(0, 2, matrix.m31());
     39    ret.setDouble(0, 3, matrix.m41());
     40    ret.setDouble(1, 0, matrix.m12());
     41    ret.setDouble(1, 1, matrix.m22());
     42    ret.setDouble(1, 2, matrix.m32());
     43    ret.setDouble(1, 3, matrix.m42());
     44    ret.setDouble(2, 0, matrix.m13());
     45    ret.setDouble(2, 1, matrix.m23());
     46    ret.setDouble(2, 2, matrix.m33());
     47    ret.setDouble(2, 3, matrix.m43());
     48    ret.setDouble(3, 0, matrix.m14());
     49    ret.setDouble(3, 1, matrix.m24());
     50    ret.setDouble(3, 2, matrix.m34());
     51    ret.setDouble(3, 3, matrix.m44());
     52    return ret;
     53}
    4054
    41     // Adds the keyframe with the default timing function (ease).
    42     virtual void add(const WebTransformKeyframe&) = 0;
    43     virtual void add(const WebTransformKeyframe&, TimingFunctionType) = 0;
    44     // Adds the keyframe with a custom, bezier timing function. Note, it is
    45     // assumed that x0 = y0 = 0, and x3 = y3 = 1.
    46     virtual void add(const WebTransformKeyframe&, double x1, double y1, double x2, double y2) = 0;
    47 
    48     virtual WebTransformationMatrix getValue(double time) const = 0;
    49 
    50 };
    51 
    52 } // namespace WebKit
    53 
    54 #endif // WebTransformAnimationCurve_h
     55} // namespace WebCore
  • trunk/Source/WebCore/platform/graphics/chromium/TransformSkMatrix44Conversions.h

    r145441 r145442  
    11/*
    2  * Copyright (C) 2012 Google Inc. All rights reserved.
     2 * Copyright (C) 2013 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
    … …  
    2323 */
    2424
    25 #ifndef WebTransformAnimationCurve_h
    26 #define WebTransformAnimationCurve_h
     25#include "SkMatrix44.h"
    2726
    28 #include "WebAnimationCurve.h"
     27namespace WebCore {
    2928
    30 #include "WebCommon.h"
    31 #include "WebTransformKeyframe.h"
    32 #include "WebTransformationMatrix.h"
     29class TransformationMatrix;
    3330
    34 namespace WebKit {
    35 
    36 // A keyframed transform animation curve.
    37 class WebTransformAnimationCurve : public WebAnimationCurve {
     31class TransformSkMatrix44Conversions {
    3832public:
    39     virtual ~WebTransformAnimationCurve() { }
    40 
    41     // Adds the keyframe with the default timing function (ease).
    42     virtual void add(const WebTransformKeyframe&) = 0;
    43     virtual void add(const WebTransformKeyframe&, TimingFunctionType) = 0;
    44     // Adds the keyframe with a custom, bezier timing function. Note, it is
    45     // assumed that x0 = y0 = 0, and x3 = y3 = 1.
    46     virtual void add(const WebTransformKeyframe&, double x1, double y1, double x2, double y2) = 0;
    47 
    48     virtual WebTransformationMatrix getValue(double time) const = 0;
    49 
     33    static SkMatrix44 convert(const TransformationMatrix&);
    5034};
    5135
    52 } // namespace WebKit
    53 
    54 #endif // WebTransformAnimationCurve_h
     36} // namespace WebCore
Note: See TracChangeset for help on using the changeset viewer.