2011-06-24 10:41:16 -07:00
|
|
|
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2012-05-21 04:12:37 -07:00
|
|
|
* 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/. */
|
2011-05-26 12:41:33 -07:00
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
#ifndef MOZILLA_GFX_RECT_H_
|
|
|
|
#define MOZILLA_GFX_RECT_H_
|
|
|
|
|
|
|
|
#include "BaseRect.h"
|
|
|
|
#include "BaseMargin.h"
|
|
|
|
#include "Point.h"
|
2011-05-26 12:41:33 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
2011-06-24 10:41:16 -07:00
|
|
|
namespace gfx {
|
2011-05-26 12:41:33 -07:00
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
struct Margin :
|
|
|
|
public BaseMargin<Float, Margin> {
|
|
|
|
typedef BaseMargin<Float, Margin> Super;
|
2011-05-26 12:41:33 -07:00
|
|
|
|
|
|
|
// Constructors
|
2013-03-07 02:17:33 -08:00
|
|
|
Margin() : Super(0, 0, 0, 0) {}
|
2011-06-24 10:41:16 -07:00
|
|
|
Margin(const Margin& aMargin) : Super(aMargin) {}
|
2013-03-06 00:05:55 -08:00
|
|
|
Margin(Float aTop, Float aRight, Float aBottom, Float aLeft)
|
|
|
|
: Super(aTop, aRight, aBottom, aLeft) {}
|
2011-06-24 10:41:16 -07:00
|
|
|
};
|
2011-05-26 12:41:33 -07:00
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
struct IntRect :
|
|
|
|
public BaseRect<int32_t, IntRect, IntPoint, IntSize, Margin> {
|
2013-03-04 06:38:11 -08:00
|
|
|
typedef BaseRect<int32_t, IntRect, IntPoint, mozilla::gfx::IntSize, Margin> Super;
|
2011-05-26 12:41:33 -07:00
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
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) {}
|
2011-11-13 20:29:14 -08:00
|
|
|
|
|
|
|
// Rounding isn't meaningful on an integer rectangle.
|
|
|
|
void Round() {}
|
|
|
|
void RoundIn() {}
|
|
|
|
void RoundOut() {}
|
2011-05-26 12:41:33 -07:00
|
|
|
};
|
|
|
|
|
2011-11-13 20:29:01 -08:00
|
|
|
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) :
|
2013-03-04 06:38:11 -08:00
|
|
|
Super(float(rect.x), float(rect.y),
|
|
|
|
float(rect.width), float(rect.height)) {}
|
2012-05-03 14:41:37 -07:00
|
|
|
|
2012-09-11 22:24:09 -07:00
|
|
|
GFX2D_API void NudgeToIntegers();
|
|
|
|
|
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 02:20:52 -07:00
|
|
|
bool ToIntRect(IntRect *aOut) const
|
2012-05-03 14:41:37 -07:00
|
|
|
{
|
|
|
|
*aOut = IntRect(int32_t(X()), int32_t(Y()),
|
2013-03-04 06:38:11 -08:00
|
|
|
int32_t(Width()), int32_t(Height()));
|
2012-05-14 16:01:05 -07:00
|
|
|
return Rect(Float(aOut->x), Float(aOut->y),
|
|
|
|
Float(aOut->width), Float(aOut->height)).IsEqualEdges(*this);
|
2012-05-03 14:41:37 -07:00
|
|
|
}
|
2011-11-13 20:29:01 -08:00
|
|
|
};
|
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
}
|
2011-05-26 12:41:33 -07:00
|
|
|
}
|
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
#endif /* MOZILLA_GFX_RECT_H_ */
|