gecko/gfx/2d/Rect.h
Bas Schouten 341383c413 Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.

Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 09:20:52 +00:00

71 lines
2.1 KiB
C++

/* -*- Mode: c++; tab-width: 2; 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_RECT_H_
#define MOZILLA_GFX_RECT_H_
#include "BaseRect.h"
#include "BaseMargin.h"
#include "Point.h"
namespace mozilla {
namespace gfx {
struct Margin :
public BaseMargin<Float, Margin> {
typedef BaseMargin<Float, Margin> Super;
// Constructors
Margin() : Super(0, 0, 0, 0) {}
Margin(const Margin& aMargin) : Super(aMargin) {}
Margin(Float aTop, Float aRight, Float aBottom, Float aLeft)
: Super(aTop, aRight, aBottom, aLeft) {}
};
struct IntRect :
public BaseRect<int32_t, IntRect, IntPoint, IntSize, Margin> {
typedef BaseRect<int32_t, IntRect, IntPoint, mozilla::gfx::IntSize, Margin> Super;
IntRect() : Super() {}
IntRect(IntPoint aPos, mozilla::gfx::IntSize aSize) :
Super(aPos, aSize) {}
IntRect(int32_t _x, int32_t _y, int32_t _width, int32_t _height) :
Super(_x, _y, _width, _height) {}
// Rounding isn't meaningful on an integer rectangle.
void Round() {}
void RoundIn() {}
void RoundOut() {}
};
struct Rect :
public BaseRect<Float, Rect, Point, Size, Margin> {
typedef BaseRect<Float, Rect, Point, mozilla::gfx::Size, Margin> Super;
Rect() : Super() {}
Rect(Point aPos, mozilla::gfx::Size aSize) :
Super(aPos, aSize) {}
Rect(Float _x, Float _y, Float _width, Float _height) :
Super(_x, _y, _width, _height) {}
explicit Rect(const IntRect& rect) :
Super(float(rect.x), float(rect.y),
float(rect.width), float(rect.height)) {}
GFX2D_API void NudgeToIntegers();
bool ToIntRect(IntRect *aOut) const
{
*aOut = IntRect(int32_t(X()), int32_t(Y()),
int32_t(Width()), int32_t(Height()));
return Rect(Float(aOut->x), Float(aOut->y),
Float(aOut->width), Float(aOut->height)).IsEqualEdges(*this);
}
};
}
}
#endif /* MOZILLA_GFX_RECT_H_ */