mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-31 19:10:36 +00:00
Bug 913640 - sprinkle MOZ_CONSTEXPR on gfx's typed units to reduce static constructors; r=kats
This commit is contained in:
parent
2319781bd9
commit
192bc00d31
@ -6,6 +6,8 @@
|
||||
#ifndef MOZILLA_GFX_BASESIZE_H_
|
||||
#define MOZILLA_GFX_BASESIZE_H_
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
||||
@ -19,8 +21,8 @@ struct BaseSize {
|
||||
T width, height;
|
||||
|
||||
// Constructors
|
||||
BaseSize() : width(0), height(0) {}
|
||||
BaseSize(T aWidth, T aHeight) : width(aWidth), height(aHeight) {}
|
||||
MOZ_CONSTEXPR BaseSize() : width(0), height(0) {}
|
||||
MOZ_CONSTEXPR BaseSize(T aWidth, T aHeight) : width(aWidth), height(aHeight) {}
|
||||
|
||||
void SizeTo(T aWidth, T aHeight) { width = aWidth; height = aHeight; }
|
||||
|
||||
|
@ -75,8 +75,8 @@ struct IntSizeTyped :
|
||||
public units {
|
||||
typedef BaseSize< int32_t, IntSizeTyped<units> > Super;
|
||||
|
||||
IntSizeTyped() : Super() {}
|
||||
IntSizeTyped(int32_t aWidth, int32_t aHeight) : Super(aWidth, aHeight) {}
|
||||
MOZ_CONSTEXPR IntSizeTyped() : Super() {}
|
||||
MOZ_CONSTEXPR IntSizeTyped(int32_t aWidth, int32_t aHeight) : Super(aWidth, aHeight) {}
|
||||
|
||||
// XXX When all of the code is ported, the following functions to convert to and from
|
||||
// unknown types should be removed.
|
||||
|
@ -6,6 +6,8 @@
|
||||
#ifndef MOZILLA_GFX_SCALEFACTOR_H_
|
||||
#define MOZILLA_GFX_SCALEFACTOR_H_
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
#include "gfxPoint.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -26,9 +28,9 @@ template<class src, class dst>
|
||||
struct ScaleFactor {
|
||||
float scale;
|
||||
|
||||
ScaleFactor() : scale(1.0) {}
|
||||
ScaleFactor(const ScaleFactor<src, dst>& aCopy) : scale(aCopy.scale) {}
|
||||
explicit ScaleFactor(float aScale) : scale(aScale) {}
|
||||
MOZ_CONSTEXPR ScaleFactor() : scale(1.0) {}
|
||||
MOZ_CONSTEXPR ScaleFactor(const ScaleFactor<src, dst>& aCopy) : scale(aCopy.scale) {}
|
||||
explicit MOZ_CONSTEXPR ScaleFactor(float aScale) : scale(aScale) {}
|
||||
|
||||
explicit ScaleFactor(float aX, float aY) : scale(aX) {
|
||||
MOZ_ASSERT(fabs(aX - aY) < 1e-6);
|
||||
|
Loading…
x
Reference in New Issue
Block a user