зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1320014 Part 7 - Convert half corner indices #define to an enum. r=mats
MozReview-Commit-ID: 8lNtjV14WTN --HG-- extra : rebase_source : dbfa992a2ee3cab2f639fb5a68463a673410ade6
This commit is contained in:
Родитель
2dada2d6e0
Коммит
797609894a
|
@ -440,6 +440,19 @@ static inline Corner operator++(Corner& aCorner) {
|
|||
return aCorner;
|
||||
}
|
||||
|
||||
// Indices into "half corner" arrays (nsStyleCorners e.g.)
|
||||
enum HalfCorner {
|
||||
// This order is important!
|
||||
eCornerTopLeftX = 0,
|
||||
eCornerTopLeftY = 1,
|
||||
eCornerTopRightX = 2,
|
||||
eCornerTopRightY = 3,
|
||||
eCornerBottomRightX = 4,
|
||||
eCornerBottomRightY = 5,
|
||||
eCornerBottomLeftX = 6,
|
||||
eCornerBottomLeftY = 7
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* MOZILLA_GFX_TYPES_H_ */
|
||||
|
|
|
@ -2483,18 +2483,18 @@ nsLayoutUtils::RoundedRectIntersectRect(const nsRect& aRoundedRect,
|
|||
// rectFullHeight and rectFullWidth together will approximately contain
|
||||
// the total area of the frame minus the rounded corners.
|
||||
nsRect rectFullHeight = aRoundedRect;
|
||||
nscoord xDiff = std::max(aRadii[NS_CORNER_TOP_LEFT_X], aRadii[NS_CORNER_BOTTOM_LEFT_X]);
|
||||
nscoord xDiff = std::max(aRadii[eCornerTopLeftX], aRadii[eCornerBottomLeftX]);
|
||||
rectFullHeight.x += xDiff;
|
||||
rectFullHeight.width -= std::max(aRadii[NS_CORNER_TOP_RIGHT_X],
|
||||
aRadii[NS_CORNER_BOTTOM_RIGHT_X]) + xDiff;
|
||||
rectFullHeight.width -= std::max(aRadii[eCornerTopRightX],
|
||||
aRadii[eCornerBottomRightX]) + xDiff;
|
||||
nsRect r1;
|
||||
r1.IntersectRect(rectFullHeight, aContainedRect);
|
||||
|
||||
nsRect rectFullWidth = aRoundedRect;
|
||||
nscoord yDiff = std::max(aRadii[NS_CORNER_TOP_LEFT_Y], aRadii[NS_CORNER_TOP_RIGHT_Y]);
|
||||
nscoord yDiff = std::max(aRadii[eCornerTopLeftY], aRadii[eCornerTopRightY]);
|
||||
rectFullWidth.y += yDiff;
|
||||
rectFullWidth.height -= std::max(aRadii[NS_CORNER_BOTTOM_LEFT_Y],
|
||||
aRadii[NS_CORNER_BOTTOM_RIGHT_Y]) + yDiff;
|
||||
rectFullWidth.height -= std::max(aRadii[eCornerBottomLeftY],
|
||||
aRadii[eCornerBottomRightY]) + yDiff;
|
||||
nsRect r2;
|
||||
r2.IntersectRect(rectFullWidth, aContainedRect);
|
||||
|
||||
|
@ -2576,17 +2576,17 @@ nsLayoutUtils::RoundedRectIntersectsRect(const nsRect& aRoundedRect,
|
|||
// top left corner of aBounds when rounded by aRadii, etc. If any
|
||||
// corner is not, then fail; otherwise succeed.
|
||||
return CheckCorner(insets.left, insets.top,
|
||||
aRadii[NS_CORNER_TOP_LEFT_X],
|
||||
aRadii[NS_CORNER_TOP_LEFT_Y]) &&
|
||||
aRadii[eCornerTopLeftX],
|
||||
aRadii[eCornerTopLeftY]) &&
|
||||
CheckCorner(insets.right, insets.top,
|
||||
aRadii[NS_CORNER_TOP_RIGHT_X],
|
||||
aRadii[NS_CORNER_TOP_RIGHT_Y]) &&
|
||||
aRadii[eCornerTopRightX],
|
||||
aRadii[eCornerTopRightY]) &&
|
||||
CheckCorner(insets.right, insets.bottom,
|
||||
aRadii[NS_CORNER_BOTTOM_RIGHT_X],
|
||||
aRadii[NS_CORNER_BOTTOM_RIGHT_Y]) &&
|
||||
aRadii[eCornerBottomRightX],
|
||||
aRadii[eCornerBottomRightY]) &&
|
||||
CheckCorner(insets.left, insets.bottom,
|
||||
aRadii[NS_CORNER_BOTTOM_LEFT_X],
|
||||
aRadii[NS_CORNER_BOTTOM_LEFT_Y]);
|
||||
aRadii[eCornerBottomLeftX],
|
||||
aRadii[eCornerBottomLeftY]);
|
||||
}
|
||||
|
||||
nsRect
|
||||
|
@ -6803,14 +6803,14 @@ static bool IsCornerAdjacentToSide(uint8_t aCorner, Side aSide)
|
|||
nsLayoutUtils::HasNonZeroCornerOnSide(const nsStyleCorners& aCorners,
|
||||
Side aSide)
|
||||
{
|
||||
static_assert(NS_CORNER_TOP_LEFT_X/2 == eCornerTopLeft, "Check for Non Zero on side");
|
||||
static_assert(NS_CORNER_TOP_LEFT_Y/2 == eCornerTopLeft, "Check for Non Zero on side");
|
||||
static_assert(NS_CORNER_TOP_RIGHT_X/2 == eCornerTopRight, "Check for Non Zero on side");
|
||||
static_assert(NS_CORNER_TOP_RIGHT_Y/2 == eCornerTopRight, "Check for Non Zero on side");
|
||||
static_assert(NS_CORNER_BOTTOM_RIGHT_X/2 == eCornerBottomRight, "Check for Non Zero on side");
|
||||
static_assert(NS_CORNER_BOTTOM_RIGHT_Y/2 == eCornerBottomRight, "Check for Non Zero on side");
|
||||
static_assert(NS_CORNER_BOTTOM_LEFT_X/2 == eCornerBottomLeft, "Check for Non Zero on side");
|
||||
static_assert(NS_CORNER_BOTTOM_LEFT_Y/2 == eCornerBottomLeft, "Check for Non Zero on side");
|
||||
static_assert(eCornerTopLeftX/2 == eCornerTopLeft, "Check for Non Zero on side");
|
||||
static_assert(eCornerTopLeftY/2 == eCornerTopLeft, "Check for Non Zero on side");
|
||||
static_assert(eCornerTopRightX/2 == eCornerTopRight, "Check for Non Zero on side");
|
||||
static_assert(eCornerTopRightY/2 == eCornerTopRight, "Check for Non Zero on side");
|
||||
static_assert(eCornerBottomRightX/2 == eCornerBottomRight, "Check for Non Zero on side");
|
||||
static_assert(eCornerBottomRightY/2 == eCornerBottomRight, "Check for Non Zero on side");
|
||||
static_assert(eCornerBottomLeftX/2 == eCornerBottomLeft, "Check for Non Zero on side");
|
||||
static_assert(eCornerBottomLeftY/2 == eCornerBottomLeft, "Check for Non Zero on side");
|
||||
|
||||
NS_FOR_CSS_HALF_CORNERS(corner) {
|
||||
// corner is a "half corner" value, so dividing by two gives us a
|
||||
|
|
|
@ -1271,31 +1271,31 @@ nsIFrame::ComputeBorderRadii(const nsStyleCorners& aBorderRadius,
|
|||
}
|
||||
|
||||
if (aSkipSides.Top()) {
|
||||
aRadii[NS_CORNER_TOP_LEFT_X] = 0;
|
||||
aRadii[NS_CORNER_TOP_LEFT_Y] = 0;
|
||||
aRadii[NS_CORNER_TOP_RIGHT_X] = 0;
|
||||
aRadii[NS_CORNER_TOP_RIGHT_Y] = 0;
|
||||
aRadii[eCornerTopLeftX] = 0;
|
||||
aRadii[eCornerTopLeftY] = 0;
|
||||
aRadii[eCornerTopRightX] = 0;
|
||||
aRadii[eCornerTopRightY] = 0;
|
||||
}
|
||||
|
||||
if (aSkipSides.Right()) {
|
||||
aRadii[NS_CORNER_TOP_RIGHT_X] = 0;
|
||||
aRadii[NS_CORNER_TOP_RIGHT_Y] = 0;
|
||||
aRadii[NS_CORNER_BOTTOM_RIGHT_X] = 0;
|
||||
aRadii[NS_CORNER_BOTTOM_RIGHT_Y] = 0;
|
||||
aRadii[eCornerTopRightX] = 0;
|
||||
aRadii[eCornerTopRightY] = 0;
|
||||
aRadii[eCornerBottomRightX] = 0;
|
||||
aRadii[eCornerBottomRightY] = 0;
|
||||
}
|
||||
|
||||
if (aSkipSides.Bottom()) {
|
||||
aRadii[NS_CORNER_BOTTOM_RIGHT_X] = 0;
|
||||
aRadii[NS_CORNER_BOTTOM_RIGHT_Y] = 0;
|
||||
aRadii[NS_CORNER_BOTTOM_LEFT_X] = 0;
|
||||
aRadii[NS_CORNER_BOTTOM_LEFT_Y] = 0;
|
||||
aRadii[eCornerBottomRightX] = 0;
|
||||
aRadii[eCornerBottomRightY] = 0;
|
||||
aRadii[eCornerBottomLeftX] = 0;
|
||||
aRadii[eCornerBottomLeftY] = 0;
|
||||
}
|
||||
|
||||
if (aSkipSides.Left()) {
|
||||
aRadii[NS_CORNER_BOTTOM_LEFT_X] = 0;
|
||||
aRadii[NS_CORNER_BOTTOM_LEFT_Y] = 0;
|
||||
aRadii[NS_CORNER_TOP_LEFT_X] = 0;
|
||||
aRadii[NS_CORNER_TOP_LEFT_Y] = 0;
|
||||
aRadii[eCornerBottomLeftX] = 0;
|
||||
aRadii[eCornerBottomLeftY] = 0;
|
||||
aRadii[eCornerTopLeftX] = 0;
|
||||
aRadii[eCornerTopLeftY] = 0;
|
||||
}
|
||||
|
||||
// css3-background specifies this algorithm for reducing
|
||||
|
|
|
@ -5724,26 +5724,26 @@ ScrollFrameHelper::GetBorderRadii(const nsSize& aFrameSize,
|
|||
|
||||
if (sb.left > 0 || sb.top > 0) {
|
||||
ReduceRadii(border.left, border.top,
|
||||
aRadii[NS_CORNER_TOP_LEFT_X],
|
||||
aRadii[NS_CORNER_TOP_LEFT_Y]);
|
||||
aRadii[eCornerTopLeftX],
|
||||
aRadii[eCornerTopLeftY]);
|
||||
}
|
||||
|
||||
if (sb.top > 0 || sb.right > 0) {
|
||||
ReduceRadii(border.right, border.top,
|
||||
aRadii[NS_CORNER_TOP_RIGHT_X],
|
||||
aRadii[NS_CORNER_TOP_RIGHT_Y]);
|
||||
aRadii[eCornerTopRightX],
|
||||
aRadii[eCornerTopRightY]);
|
||||
}
|
||||
|
||||
if (sb.right > 0 || sb.bottom > 0) {
|
||||
ReduceRadii(border.right, border.bottom,
|
||||
aRadii[NS_CORNER_BOTTOM_RIGHT_X],
|
||||
aRadii[NS_CORNER_BOTTOM_RIGHT_Y]);
|
||||
aRadii[eCornerBottomRightX],
|
||||
aRadii[eCornerBottomRightY]);
|
||||
}
|
||||
|
||||
if (sb.bottom > 0 || sb.left > 0) {
|
||||
ReduceRadii(border.left, border.bottom,
|
||||
aRadii[NS_CORNER_BOTTOM_LEFT_X],
|
||||
aRadii[NS_CORNER_BOTTOM_LEFT_Y]);
|
||||
aRadii[eCornerBottomLeftX],
|
||||
aRadii[eCornerBottomLeftY]);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -203,49 +203,49 @@ DisplayItemClip::IsRectClippedByRoundedCorner(const nsRect& aRect) const
|
|||
i < iEnd; ++i) {
|
||||
const RoundedRect &rr = mRoundedClipRects[i];
|
||||
// top left
|
||||
if (rect.x < rr.mRect.x + rr.mRadii[NS_CORNER_TOP_LEFT_X] &&
|
||||
rect.y < rr.mRect.y + rr.mRadii[NS_CORNER_TOP_LEFT_Y]) {
|
||||
if (!IsInsideEllipse(rr.mRadii[NS_CORNER_TOP_LEFT_X],
|
||||
rr.mRect.x + rr.mRadii[NS_CORNER_TOP_LEFT_X],
|
||||
if (rect.x < rr.mRect.x + rr.mRadii[eCornerTopLeftX] &&
|
||||
rect.y < rr.mRect.y + rr.mRadii[eCornerTopLeftY]) {
|
||||
if (!IsInsideEllipse(rr.mRadii[eCornerTopLeftX],
|
||||
rr.mRect.x + rr.mRadii[eCornerTopLeftX],
|
||||
rect.x,
|
||||
rr.mRadii[NS_CORNER_TOP_LEFT_Y],
|
||||
rr.mRect.y + rr.mRadii[NS_CORNER_TOP_LEFT_Y],
|
||||
rr.mRadii[eCornerTopLeftY],
|
||||
rr.mRect.y + rr.mRadii[eCornerTopLeftY],
|
||||
rect.y)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// top right
|
||||
if (rect.XMost() > rr.mRect.XMost() - rr.mRadii[NS_CORNER_TOP_RIGHT_X] &&
|
||||
rect.y < rr.mRect.y + rr.mRadii[NS_CORNER_TOP_RIGHT_Y]) {
|
||||
if (!IsInsideEllipse(rr.mRadii[NS_CORNER_TOP_RIGHT_X],
|
||||
rr.mRect.XMost() - rr.mRadii[NS_CORNER_TOP_RIGHT_X],
|
||||
if (rect.XMost() > rr.mRect.XMost() - rr.mRadii[eCornerTopRightX] &&
|
||||
rect.y < rr.mRect.y + rr.mRadii[eCornerTopRightY]) {
|
||||
if (!IsInsideEllipse(rr.mRadii[eCornerTopRightX],
|
||||
rr.mRect.XMost() - rr.mRadii[eCornerTopRightX],
|
||||
rect.XMost(),
|
||||
rr.mRadii[NS_CORNER_TOP_RIGHT_Y],
|
||||
rr.mRect.y + rr.mRadii[NS_CORNER_TOP_RIGHT_Y],
|
||||
rr.mRadii[eCornerTopRightY],
|
||||
rr.mRect.y + rr.mRadii[eCornerTopRightY],
|
||||
rect.y)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// bottom left
|
||||
if (rect.x < rr.mRect.x + rr.mRadii[NS_CORNER_BOTTOM_LEFT_X] &&
|
||||
rect.YMost() > rr.mRect.YMost() - rr.mRadii[NS_CORNER_BOTTOM_LEFT_Y]) {
|
||||
if (!IsInsideEllipse(rr.mRadii[NS_CORNER_BOTTOM_LEFT_X],
|
||||
rr.mRect.x + rr.mRadii[NS_CORNER_BOTTOM_LEFT_X],
|
||||
if (rect.x < rr.mRect.x + rr.mRadii[eCornerBottomLeftX] &&
|
||||
rect.YMost() > rr.mRect.YMost() - rr.mRadii[eCornerBottomLeftY]) {
|
||||
if (!IsInsideEllipse(rr.mRadii[eCornerBottomLeftX],
|
||||
rr.mRect.x + rr.mRadii[eCornerBottomLeftX],
|
||||
rect.x,
|
||||
rr.mRadii[NS_CORNER_BOTTOM_LEFT_Y],
|
||||
rr.mRect.YMost() - rr.mRadii[NS_CORNER_BOTTOM_LEFT_Y],
|
||||
rr.mRadii[eCornerBottomLeftY],
|
||||
rr.mRect.YMost() - rr.mRadii[eCornerBottomLeftY],
|
||||
rect.YMost())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// bottom right
|
||||
if (rect.XMost() > rr.mRect.XMost() - rr.mRadii[NS_CORNER_BOTTOM_RIGHT_X] &&
|
||||
rect.YMost() > rr.mRect.YMost() - rr.mRadii[NS_CORNER_BOTTOM_RIGHT_Y]) {
|
||||
if (!IsInsideEllipse(rr.mRadii[NS_CORNER_BOTTOM_RIGHT_X],
|
||||
rr.mRect.XMost() - rr.mRadii[NS_CORNER_BOTTOM_RIGHT_X],
|
||||
if (rect.XMost() > rr.mRect.XMost() - rr.mRadii[eCornerBottomRightX] &&
|
||||
rect.YMost() > rr.mRect.YMost() - rr.mRadii[eCornerBottomRightY]) {
|
||||
if (!IsInsideEllipse(rr.mRadii[eCornerBottomRightX],
|
||||
rr.mRect.XMost() - rr.mRadii[eCornerBottomRightX],
|
||||
rect.XMost(),
|
||||
rr.mRadii[NS_CORNER_BOTTOM_RIGHT_Y],
|
||||
rr.mRect.YMost() - rr.mRadii[NS_CORNER_BOTTOM_RIGHT_Y],
|
||||
rr.mRadii[eCornerBottomRightY],
|
||||
rr.mRect.YMost() - rr.mRadii[eCornerBottomRightY],
|
||||
rect.YMost())) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -635,14 +635,14 @@ nsCSSRendering::ComputePixelRadii(const nscoord *aAppUnitsRadii,
|
|||
NS_FOR_CSS_HALF_CORNERS(corner)
|
||||
radii[corner] = Float(aAppUnitsRadii[corner]) / aAppUnitsPerPixel;
|
||||
|
||||
(*oBorderRadii)[C_TL] = Size(radii[NS_CORNER_TOP_LEFT_X],
|
||||
radii[NS_CORNER_TOP_LEFT_Y]);
|
||||
(*oBorderRadii)[C_TR] = Size(radii[NS_CORNER_TOP_RIGHT_X],
|
||||
radii[NS_CORNER_TOP_RIGHT_Y]);
|
||||
(*oBorderRadii)[C_BR] = Size(radii[NS_CORNER_BOTTOM_RIGHT_X],
|
||||
radii[NS_CORNER_BOTTOM_RIGHT_Y]);
|
||||
(*oBorderRadii)[C_BL] = Size(radii[NS_CORNER_BOTTOM_LEFT_X],
|
||||
radii[NS_CORNER_BOTTOM_LEFT_Y]);
|
||||
(*oBorderRadii)[C_TL] = Size(radii[eCornerTopLeftX],
|
||||
radii[eCornerTopLeftY]);
|
||||
(*oBorderRadii)[C_TR] = Size(radii[eCornerTopRightX],
|
||||
radii[eCornerTopRightY]);
|
||||
(*oBorderRadii)[C_BR] = Size(radii[eCornerBottomRightX],
|
||||
radii[eCornerBottomRightY]);
|
||||
(*oBorderRadii)[C_BL] = Size(radii[eCornerBottomLeftX],
|
||||
radii[eCornerBottomLeftY]);
|
||||
}
|
||||
|
||||
DrawResult
|
||||
|
|
|
@ -4256,19 +4256,19 @@ nsDisplayBorder::CalculateBounds(const nsStyleBorder& aStyleBorder)
|
|||
nscoord radii[8];
|
||||
if (mFrame->GetBorderRadii(radii)) {
|
||||
if (border.left > 0 || border.top > 0) {
|
||||
nsSize cornerSize(radii[NS_CORNER_TOP_LEFT_X], radii[NS_CORNER_TOP_LEFT_Y]);
|
||||
nsSize cornerSize(radii[eCornerTopLeftX], radii[eCornerTopLeftY]);
|
||||
result.OrWith(nsRect(borderBounds.TopLeft(), cornerSize));
|
||||
}
|
||||
if (border.top > 0 || border.right > 0) {
|
||||
nsSize cornerSize(radii[NS_CORNER_TOP_RIGHT_X], radii[NS_CORNER_TOP_RIGHT_Y]);
|
||||
nsSize cornerSize(radii[eCornerTopRightX], radii[eCornerTopRightY]);
|
||||
result.OrWith(nsRect(borderBounds.TopRight() - nsPoint(cornerSize.width, 0), cornerSize));
|
||||
}
|
||||
if (border.right > 0 || border.bottom > 0) {
|
||||
nsSize cornerSize(radii[NS_CORNER_BOTTOM_RIGHT_X], radii[NS_CORNER_BOTTOM_RIGHT_Y]);
|
||||
nsSize cornerSize(radii[eCornerBottomRightX], radii[eCornerBottomRightY]);
|
||||
result.OrWith(nsRect(borderBounds.BottomRight() - nsPoint(cornerSize.width, cornerSize.height), cornerSize));
|
||||
}
|
||||
if (border.bottom > 0 || border.left > 0) {
|
||||
nsSize cornerSize(radii[NS_CORNER_BOTTOM_LEFT_X], radii[NS_CORNER_BOTTOM_LEFT_Y]);
|
||||
nsSize cornerSize(radii[eCornerBottomLeftX], radii[eCornerBottomLeftY]);
|
||||
result.OrWith(nsRect(borderBounds.BottomLeft() - nsPoint(0, cornerSize.height), cornerSize));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,16 +16,6 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
// Indices into "half corner" arrays (nsStyleCorners e.g.)
|
||||
#define NS_CORNER_TOP_LEFT_X 0
|
||||
#define NS_CORNER_TOP_LEFT_Y 1
|
||||
#define NS_CORNER_TOP_RIGHT_X 2
|
||||
#define NS_CORNER_TOP_RIGHT_Y 3
|
||||
#define NS_CORNER_BOTTOM_RIGHT_X 4
|
||||
#define NS_CORNER_BOTTOM_RIGHT_Y 5
|
||||
#define NS_CORNER_BOTTOM_LEFT_X 6
|
||||
#define NS_CORNER_BOTTOM_LEFT_Y 7
|
||||
|
||||
#define NS_FOR_CSS_HALF_CORNERS(var_) for (int32_t var_ = 0; var_ < 8; ++var_)
|
||||
|
||||
// The results of these conversion macros are exhaustively checked in
|
||||
|
|
|
@ -343,42 +343,42 @@ CASE(eSideLeft, true);
|
|||
#define CASE(corner, result) \
|
||||
static_assert(NS_HALF_CORNER_IS_X(corner) == result, \
|
||||
"NS_HALF_CORNER_IS_X is wrong")
|
||||
CASE(NS_CORNER_TOP_LEFT_X, true);
|
||||
CASE(NS_CORNER_TOP_LEFT_Y, false);
|
||||
CASE(NS_CORNER_TOP_RIGHT_X, true);
|
||||
CASE(NS_CORNER_TOP_RIGHT_Y, false);
|
||||
CASE(NS_CORNER_BOTTOM_RIGHT_X, true);
|
||||
CASE(NS_CORNER_BOTTOM_RIGHT_Y, false);
|
||||
CASE(NS_CORNER_BOTTOM_LEFT_X, true);
|
||||
CASE(NS_CORNER_BOTTOM_LEFT_Y, false);
|
||||
CASE(eCornerTopLeftX, true);
|
||||
CASE(eCornerTopLeftY, false);
|
||||
CASE(eCornerTopRightX, true);
|
||||
CASE(eCornerTopRightY, false);
|
||||
CASE(eCornerBottomRightX, true);
|
||||
CASE(eCornerBottomRightY, false);
|
||||
CASE(eCornerBottomLeftX, true);
|
||||
CASE(eCornerBottomLeftY, false);
|
||||
#undef CASE
|
||||
|
||||
// Validation of NS_HALF_TO_FULL_CORNER.
|
||||
#define CASE(corner, result) \
|
||||
static_assert(NS_HALF_TO_FULL_CORNER(corner) == result, \
|
||||
"NS_HALF_TO_FULL_CORNER is wrong")
|
||||
CASE(NS_CORNER_TOP_LEFT_X, eCornerTopLeft);
|
||||
CASE(NS_CORNER_TOP_LEFT_Y, eCornerTopLeft);
|
||||
CASE(NS_CORNER_TOP_RIGHT_X, eCornerTopRight);
|
||||
CASE(NS_CORNER_TOP_RIGHT_Y, eCornerTopRight);
|
||||
CASE(NS_CORNER_BOTTOM_RIGHT_X, eCornerBottomRight);
|
||||
CASE(NS_CORNER_BOTTOM_RIGHT_Y, eCornerBottomRight);
|
||||
CASE(NS_CORNER_BOTTOM_LEFT_X, eCornerBottomLeft);
|
||||
CASE(NS_CORNER_BOTTOM_LEFT_Y, eCornerBottomLeft);
|
||||
CASE(eCornerTopLeftX, eCornerTopLeft);
|
||||
CASE(eCornerTopLeftY, eCornerTopLeft);
|
||||
CASE(eCornerTopRightX, eCornerTopRight);
|
||||
CASE(eCornerTopRightY, eCornerTopRight);
|
||||
CASE(eCornerBottomRightX, eCornerBottomRight);
|
||||
CASE(eCornerBottomRightY, eCornerBottomRight);
|
||||
CASE(eCornerBottomLeftX, eCornerBottomLeft);
|
||||
CASE(eCornerBottomLeftY, eCornerBottomLeft);
|
||||
#undef CASE
|
||||
|
||||
// Validation of NS_FULL_TO_HALF_CORNER.
|
||||
#define CASE(corner, vert, result) \
|
||||
static_assert(NS_FULL_TO_HALF_CORNER(corner, vert) == result, \
|
||||
"NS_FULL_TO_HALF_CORNER is wrong")
|
||||
CASE(eCornerTopLeft, false, NS_CORNER_TOP_LEFT_X);
|
||||
CASE(eCornerTopLeft, true, NS_CORNER_TOP_LEFT_Y);
|
||||
CASE(eCornerTopRight, false, NS_CORNER_TOP_RIGHT_X);
|
||||
CASE(eCornerTopRight, true, NS_CORNER_TOP_RIGHT_Y);
|
||||
CASE(eCornerBottomRight, false, NS_CORNER_BOTTOM_RIGHT_X);
|
||||
CASE(eCornerBottomRight, true, NS_CORNER_BOTTOM_RIGHT_Y);
|
||||
CASE(eCornerBottomLeft, false, NS_CORNER_BOTTOM_LEFT_X);
|
||||
CASE(eCornerBottomLeft, true, NS_CORNER_BOTTOM_LEFT_Y);
|
||||
CASE(eCornerTopLeft, false, eCornerTopLeftX);
|
||||
CASE(eCornerTopLeft, true, eCornerTopLeftY);
|
||||
CASE(eCornerTopRight, false, eCornerTopRightX);
|
||||
CASE(eCornerTopRight, true, eCornerTopRightY);
|
||||
CASE(eCornerBottomRight, false, eCornerBottomRightX);
|
||||
CASE(eCornerBottomRight, true, eCornerBottomRightY);
|
||||
CASE(eCornerBottomLeft, false, eCornerBottomLeftX);
|
||||
CASE(eCornerBottomLeft, true, eCornerBottomLeftY);
|
||||
#undef CASE
|
||||
|
||||
// Validation of NS_SIDE_TO_{FULL,HALF}_CORNER.
|
||||
|
@ -401,23 +401,23 @@ CASE(eSideLeft, true, eCornerTopLeft);
|
|||
#define CASE(side, second, parallel, result) \
|
||||
static_assert(NS_SIDE_TO_HALF_CORNER(side, second, parallel) == result, \
|
||||
"NS_SIDE_TO_HALF_CORNER is wrong")
|
||||
CASE(eSideTop, false, true, NS_CORNER_TOP_LEFT_X);
|
||||
CASE(eSideTop, false, false, NS_CORNER_TOP_LEFT_Y);
|
||||
CASE(eSideTop, true, true, NS_CORNER_TOP_RIGHT_X);
|
||||
CASE(eSideTop, true, false, NS_CORNER_TOP_RIGHT_Y);
|
||||
CASE(eSideTop, false, true, eCornerTopLeftX);
|
||||
CASE(eSideTop, false, false, eCornerTopLeftY);
|
||||
CASE(eSideTop, true, true, eCornerTopRightX);
|
||||
CASE(eSideTop, true, false, eCornerTopRightY);
|
||||
|
||||
CASE(eSideRight, false, false, NS_CORNER_TOP_RIGHT_X);
|
||||
CASE(eSideRight, false, true, NS_CORNER_TOP_RIGHT_Y);
|
||||
CASE(eSideRight, true, false, NS_CORNER_BOTTOM_RIGHT_X);
|
||||
CASE(eSideRight, true, true, NS_CORNER_BOTTOM_RIGHT_Y);
|
||||
CASE(eSideRight, false, false, eCornerTopRightX);
|
||||
CASE(eSideRight, false, true, eCornerTopRightY);
|
||||
CASE(eSideRight, true, false, eCornerBottomRightX);
|
||||
CASE(eSideRight, true, true, eCornerBottomRightY);
|
||||
|
||||
CASE(eSideBottom, false, true, NS_CORNER_BOTTOM_RIGHT_X);
|
||||
CASE(eSideBottom, false, false, NS_CORNER_BOTTOM_RIGHT_Y);
|
||||
CASE(eSideBottom, true, true, NS_CORNER_BOTTOM_LEFT_X);
|
||||
CASE(eSideBottom, true, false, NS_CORNER_BOTTOM_LEFT_Y);
|
||||
CASE(eSideBottom, false, true, eCornerBottomRightX);
|
||||
CASE(eSideBottom, false, false, eCornerBottomRightY);
|
||||
CASE(eSideBottom, true, true, eCornerBottomLeftX);
|
||||
CASE(eSideBottom, true, false, eCornerBottomLeftY);
|
||||
|
||||
CASE(eSideLeft, false, false, NS_CORNER_BOTTOM_LEFT_X);
|
||||
CASE(eSideLeft, false, true, NS_CORNER_BOTTOM_LEFT_Y);
|
||||
CASE(eSideLeft, true, false, NS_CORNER_TOP_LEFT_X);
|
||||
CASE(eSideLeft, true, true, NS_CORNER_TOP_LEFT_Y);
|
||||
CASE(eSideLeft, false, false, eCornerBottomLeftX);
|
||||
CASE(eSideLeft, false, true, eCornerBottomLeftY);
|
||||
CASE(eSideLeft, true, false, eCornerTopLeftX);
|
||||
CASE(eSideLeft, true, true, eCornerTopLeftY);
|
||||
#undef CASE
|
||||
|
|
Загрузка…
Ссылка в новой задаче