gecko-dev/gfx/2d/MatrixFwd.h
Kartikaya Gupta 8609d33dec Bug 1377090 - Further generify the Matrix class and define MatrixDouble. r=bas
To allow MatrixDouble to be a drop-in replacement for gfxMatrix, it
needs to accept the "double" versions of Point, Rect, and Size. This
patch does that by adding some extra typedefs inside BaseMatrix to
abstract over that.

It also moves some function implementations into the .h file as they
don't need specialization. I left some function implementations in
the Matrix.cpp file:
- Rotation, because it is specialized for Float and Double, since it uses
  sinf/cosf vs sin/cos in the two implementations.
- The Matrix4x4 multiplication operator overload, because if I put it
  inside the BaseMatrix class declaration Matrix4x4 isn't defined yet
  and the compiler doesn't like it.

MozReview-Commit-ID: K56dZjJhXWS

--HG--
extra : rebase_source : d009151942811a725ee6bf854238073e59665d5c
2017-07-05 11:18:49 -04:00

36 lines
838 B
C++

/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MOZILLA_GFX_MATRIX_FWD_H_
#define MOZILLA_GFX_MATRIX_FWD_H_
// Forward declare enough things to define the typedefs |Matrix| and |Matrix4x4|.
namespace mozilla {
namespace gfx {
template<class T>
class BaseMatrix;
typedef float Float;
typedef BaseMatrix<Float> Matrix;
typedef double Double;
typedef BaseMatrix<Double> MatrixDouble;
struct UnknownUnits;
template<class SourceUnits, class TargetUnits>
class Matrix4x4Typed;
typedef Matrix4x4Typed<UnknownUnits, UnknownUnits> Matrix4x4;
} // namespace gfx
} // namespace mozilla
#endif