Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Unified Diff: ui/gfx/transform.h

Issue 23043011: cc: Use SkMScalar instead of doubles everywhere in cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Finalize test changes Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/gfx/transform.h
diff --git a/ui/gfx/transform.h b/ui/gfx/transform.h
index 7a7543a3a51eada5e9b4030a3467026f2bd9cfeb..15d9e496d8695015494481f8523104dcc8d6fb87 100644
--- a/ui/gfx/transform.h
+++ b/ui/gfx/transform.h
@@ -40,16 +40,31 @@ class UI_EXPORT Transform {
: matrix_(lhs.matrix_, rhs.matrix_) {}
// Constructs a transform from explicit 16 matrix elements. Elements
// should be given in row-major order.
- Transform(double col1row1, double col2row1, double col3row1, double col4row1,
- double col1row2, double col2row2, double col3row2, double col4row2,
- double col1row3, double col2row3, double col3row3, double col4row3,
- double col1row4, double col2row4, double col3row4, double col4row4);
+ Transform(SkMScalar col1row1,
+ SkMScalar col2row1,
+ SkMScalar col3row1,
+ SkMScalar col4row1,
+ SkMScalar col1row2,
+ SkMScalar col2row2,
+ SkMScalar col3row2,
+ SkMScalar col4row2,
+ SkMScalar col1row3,
+ SkMScalar col2row3,
+ SkMScalar col3row3,
+ SkMScalar col4row3,
+ SkMScalar col1row4,
+ SkMScalar col2row4,
+ SkMScalar col3row4,
+ SkMScalar col4row4);
// Constructs a transform from explicit 2d elements. All other matrix
// elements remain the same as the corresponding elements of an identity
// matrix.
- Transform(double col1row1, double col2row1,
- double col1row2, double col2row2,
- double x_translation, double y_translation);
+ Transform(SkMScalar col1row1,
+ SkMScalar col2row1,
+ SkMScalar col1row2,
+ SkMScalar col2row2,
+ SkMScalar x_translation,
+ SkMScalar y_translation);
~Transform() {}
bool operator==(const Transform& rhs) const { return matrix_ == rhs.matrix_; }
@@ -71,22 +86,22 @@ class UI_EXPORT Transform {
// Applies the current transformation on a scaling and assigns the result
// to |this|.
- void Scale(double x, double y);
- void Scale3d(double x, double y, double z);
+ void Scale(SkMScalar x, SkMScalar y);
+ void Scale3d(SkMScalar x, SkMScalar y, SkMScalar z);
// Applies the current transformation on a translation and assigns the result
// to |this|.
- void Translate(double x, double y);
- void Translate3d(double x, double y, double z);
+ void Translate(SkMScalar x, SkMScalar y);
+ void Translate3d(SkMScalar x, SkMScalar y, SkMScalar z);
// Applies the current transformation on a skew and assigns the result
// to |this|.
- void SkewX(double angle_x);
- void SkewY(double angle_y);
+ void SkewX(SkMScalar angle_x);
+ void SkewY(SkMScalar angle_y);
// Applies the current transformation on a perspective transform and assigns
// the result to |this|.
- void ApplyPerspectiveDepth(double depth);
+ void ApplyPerspectiveDepth(SkMScalar depth);
// Applies a transformation on the current transformation
// (i.e. 'this = this * transform;').
@@ -108,9 +123,8 @@ class UI_EXPORT Transform {
bool IsPositiveScaleOrTranslation() const {
if (!IsScaleOrTranslation())
return false;
- return matrix_.getDouble(0, 0) > 0.0 &&
- matrix_.getDouble(1, 1) > 0.0 &&
- matrix_.getDouble(2, 2) > 0.0;
+ return matrix_.get(0, 0) > 0.0 && matrix_.get(1, 1) > 0.0 &&
+ matrix_.get(2, 2) > 0.0;
}
// Returns true if the matrix is either identity or pure, non-fractional
@@ -202,7 +216,7 @@ class UI_EXPORT Transform {
// you're going to be calling this rapidly (e.g., in an animation) you should
// decompose once using gfx::DecomposeTransforms and reuse your
// DecomposedTransform.
- bool Blend(const Transform& from, double progress);
+ bool Blend(const Transform& from, SkMScalar progress);
danakj 2013/09/09 17:57:45 progress isn't a transform element, should stay as
// Returns |this| * |other|.
Transform operator*(const Transform& other) const {

Powered by Google App Engine
This is Rietveld 408576698