1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/animator/SkDrawMatrix.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,74 @@ 1.4 + 1.5 +/* 1.6 + * Copyright 2006 The Android Open Source Project 1.7 + * 1.8 + * Use of this source code is governed by a BSD-style license that can be 1.9 + * found in the LICENSE file. 1.10 + */ 1.11 + 1.12 + 1.13 +#ifndef SkDrawMatrix_DEFINED 1.14 +#define SkDrawMatrix_DEFINED 1.15 + 1.16 +#include "SkDrawable.h" 1.17 +#include "SkMatrix.h" 1.18 +#include "SkMemberInfo.h" 1.19 +#include "SkIntArray.h" 1.20 + 1.21 +class SkMatrixPart; 1.22 + 1.23 +class SkDrawMatrix : public SkDrawable { 1.24 + DECLARE_DRAW_MEMBER_INFO(Matrix); 1.25 + SkDrawMatrix(); 1.26 + virtual ~SkDrawMatrix(); 1.27 + virtual bool addChild(SkAnimateMaker& , SkDisplayable* child) SK_OVERRIDE; 1.28 + virtual bool childrenNeedDisposing() const; 1.29 + virtual void dirty(); 1.30 + virtual bool draw(SkAnimateMaker& ); 1.31 +#ifdef SK_DUMP_ENABLED 1.32 + virtual void dump(SkAnimateMaker* ); 1.33 +#endif 1.34 + SkMatrix& getMatrix(); 1.35 + virtual bool getProperty(int index, SkScriptValue* value) const; 1.36 + virtual void initialize(); 1.37 + virtual void onEndElement(SkAnimateMaker& ); 1.38 + virtual void setChildHasID(); 1.39 + virtual bool setProperty(int index, SkScriptValue& ); 1.40 + 1.41 + void concat(SkMatrix& inMatrix) { 1.42 + fConcat.preConcat(inMatrix); 1.43 + } 1.44 + 1.45 + virtual SkDisplayable* deepCopy(SkAnimateMaker* ); 1.46 + 1.47 + 1.48 + void rotate(SkScalar degrees, SkPoint& center) { 1.49 + fMatrix.preRotate(degrees, center.fX, center.fY); 1.50 + } 1.51 + 1.52 + void set(SkMatrix& src) { 1.53 + fMatrix.preConcat(src); 1.54 + } 1.55 + 1.56 + void scale(SkScalar scaleX, SkScalar scaleY, SkPoint& center) { 1.57 + fMatrix.preScale(scaleX, scaleY, center.fX, center.fY); 1.58 + } 1.59 + 1.60 + void skew(SkScalar skewX, SkScalar skewY, SkPoint& center) { 1.61 + fMatrix.preSkew(skewX, skewY, center.fX, center.fY); 1.62 + } 1.63 + 1.64 + void translate(SkScalar x, SkScalar y) { 1.65 + fMatrix.preTranslate(x, y); 1.66 + } 1.67 +private: 1.68 + SkTDScalarArray matrix; 1.69 + SkMatrix fConcat; 1.70 + SkMatrix fMatrix; 1.71 + SkTDMatrixPartArray fParts; 1.72 + SkBool8 fChildHasID; 1.73 + SkBool8 fDirty; 1.74 + typedef SkDrawable INHERITED; 1.75 +}; 1.76 + 1.77 +#endif // SkDrawMatrix_DEFINED