Bug 1065718 - Make gfxMatrix's Translate(), Scale() and Rotate() methods return a non-const reference. r=Bas

This commit is contained in:
Jonathan Watt 2014-09-11 01:45:04 +01:00
Родитель 358c1f203e
Коммит d1a93f6238
2 изменённых файлов: 12 добавлений и 8 удалений

Просмотреть файл

@ -23,21 +23,21 @@ gfxMatrix::Invert()
return cairo_matrix_invert(CAIRO_MATRIX(this)) == CAIRO_STATUS_SUCCESS; return cairo_matrix_invert(CAIRO_MATRIX(this)) == CAIRO_STATUS_SUCCESS;
} }
const gfxMatrix& gfxMatrix&
gfxMatrix::Scale(gfxFloat x, gfxFloat y) gfxMatrix::Scale(gfxFloat x, gfxFloat y)
{ {
cairo_matrix_scale(CAIRO_MATRIX(this), x, y); cairo_matrix_scale(CAIRO_MATRIX(this), x, y);
return *this; return *this;
} }
const gfxMatrix& gfxMatrix&
gfxMatrix::Translate(const gfxPoint& pt) gfxMatrix::Translate(const gfxPoint& pt)
{ {
cairo_matrix_translate(CAIRO_MATRIX(this), pt.x, pt.y); cairo_matrix_translate(CAIRO_MATRIX(this), pt.x, pt.y);
return *this; return *this;
} }
const gfxMatrix& gfxMatrix&
gfxMatrix::Rotate(gfxFloat radians) gfxMatrix::Rotate(gfxFloat radians)
{ {
cairo_matrix_rotate(CAIRO_MATRIX(this), radians); cairo_matrix_rotate(CAIRO_MATRIX(this), radians);
@ -51,7 +51,7 @@ gfxMatrix::operator *= (const gfxMatrix& m)
return *this; return *this;
} }
const gfxMatrix& gfxMatrix&
gfxMatrix::PreMultiply(const gfxMatrix& m) gfxMatrix::PreMultiply(const gfxMatrix& m)
{ {
cairo_matrix_multiply(CAIRO_MATRIX(this), CONST_CAIRO_MATRIX(&m), CAIRO_MATRIX(this)); cairo_matrix_multiply(CAIRO_MATRIX(this), CONST_CAIRO_MATRIX(&m), CAIRO_MATRIX(this));

Просмотреть файл

@ -127,13 +127,17 @@ public:
* Scales this matrix. The scale is pre-multiplied onto this matrix, * Scales this matrix. The scale is pre-multiplied onto this matrix,
* i.e. the scaling takes place before the other transformations. * i.e. the scaling takes place before the other transformations.
*/ */
const gfxMatrix& Scale(gfxFloat x, gfxFloat y); gfxMatrix& Scale(gfxFloat x, gfxFloat y);
/** /**
* Translates this matrix. The translation is pre-multiplied onto this matrix, * Translates this matrix. The translation is pre-multiplied onto this matrix,
* i.e. the translation takes place before the other transformations. * i.e. the translation takes place before the other transformations.
*/ */
const gfxMatrix& Translate(const gfxPoint& pt); gfxMatrix& Translate(const gfxPoint& pt);
gfxMatrix& Translate(gfxFloat x, gfxFloat y) {
return Translate(gfxPoint(x, y));
}
/** /**
* Rotates this matrix. The rotation is pre-multiplied onto this matrix, * Rotates this matrix. The rotation is pre-multiplied onto this matrix,
@ -141,14 +145,14 @@ public:
* *
* @param radians Angle in radians. * @param radians Angle in radians.
*/ */
const gfxMatrix& Rotate(gfxFloat radians); gfxMatrix& Rotate(gfxFloat radians);
/** /**
* Multiplies the current matrix with m. * Multiplies the current matrix with m.
* This is a pre-multiplication, i.e. the transformations of m are * This is a pre-multiplication, i.e. the transformations of m are
* applied _before_ the existing transformations. * applied _before_ the existing transformations.
*/ */
const gfxMatrix& PreMultiply(const gfxMatrix& m); gfxMatrix& PreMultiply(const gfxMatrix& m);
static gfxMatrix Translation(gfxFloat aX, gfxFloat aY) static gfxMatrix Translation(gfxFloat aX, gfxFloat aY)
{ {