This commit is contained in:
pavlov%netscape.com 2001-01-14 05:31:26 +00:00
Родитель 040144ae35
Коммит d9d4d09a09
3 изменённых файлов: 9 добавлений и 107 удалений

Просмотреть файл

@ -1,103 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-2000 Netscape Communications Corporation.
* All Rights Reserved.
*
* Contributor(s):
* Stuart Parmenter <pavlov@netscape.com>
*/
#ifndef NSPOINT2_H
#define NSPOINT2_H
#include "gfxtypes.h"
/**
* nsPoint2
*
* @version 1.1
**/
struct nsPoint2 {
gfx_coord x, y;
// Constructors
nsPoint2() {}
nsPoint2(const nsPoint2& aPoint) {x = aPoint.x; y = aPoint.y;}
nsPoint2(gfx_coord aX, gfx_coord aY) {x = aX; y = aY;}
void MoveTo(gfx_coord aX, gfx_coord aY) {x = aX; y = aY;}
void MoveBy(gfx_coord aDx, gfx_coord aDy) {x += aDx; y += aDy;}
// Overloaded operators. Note that '=' isn't defined so we'll get the
// compiler generated default assignment operator
PRBool operator==(const nsPoint2& aPoint) const {
return (PRBool) ((x == aPoint.x) && (y == aPoint.y));
}
PRBool operator!=(const nsPoint2& aPoint) const {
return (PRBool) ((x != aPoint.x) || (y != aPoint.y));
}
nsPoint2 operator+(const nsPoint2& aPoint) const {
return nsPoint2(x + aPoint.x, y + aPoint.y);
}
nsPoint2 operator-(const nsPoint2& aPoint) const {
return nsPoint2(x - aPoint.x, y - aPoint.y);
}
nsPoint2& operator+=(const nsPoint2& aPoint) {
x += aPoint.x;
y += aPoint.y;
return *this;
}
nsPoint2& operator-=(const nsPoint2& aPoint) {
x -= aPoint.x;
y -= aPoint.y;
return *this;
}
};
/**
* A special type of point which also add the capability to tell if a point is on
* the curve.. or off of the curve for a path
*
* @author Don Cone <dcone@netscape.com> (3/29/00)
* @version 0.0
*/
struct nsPathPoint: public nsPoint2{
PRBool mIsOnCurve;
// Constructors
nsPathPoint() {}
nsPathPoint(const nsPathPoint& aPoint) {
x = aPoint.x;
y = aPoint.y;
mIsOnCurve = aPoint.mIsOnCurve;
}
nsPathPoint(gfx_coord aX, gfx_coord aY) {
x = aX;
y = aY;
mIsOnCurve = PR_TRUE;
}
nsPathPoint(gfx_coord aX, gfx_coord aY, PRBool aIsOnCurve) {
x = aX;
y = aY;
mIsOnCurve = aIsOnCurve;
}
};
#endif /* NSPOINT2_H */

Просмотреть файл

@ -42,21 +42,26 @@
* @ingroup conversion_constants
* @note XXX this should be derived from platform FLOAT_MIN
*/
#define ROUND_EXCLUSIVE_CONST_FLOAT 0.4999999999999999
#ifndef ROUND_EXCLUSIVE_CONST_FLOAT
#define ROUND_EXCLUSIVE_CONST_FLOAT 0.499999999
#endif
/**
* ROUND_CONST_FLOAT
* @ingroup conversion_constants
*/
#ifndef ROUND_CONST_FLOAT
#define ROUND_CONST_FLOAT 0.5
#endif
/**
* CEIL_CONST_FLOAT
* @ingroup conversion_constants
* @note XXX this should be derived from platform FLOAT_MIN
*/
#ifndef CEIL_CONST_FLOAT
#define CEIL_CONST_FLOAT 0.99999999
#endif
/**
* gfx_coord rounding, floor, ceil functions
@ -72,7 +77,7 @@
*/
inline gfx_coord GFXCoordAbs(gfx_coord aValue)
{
return fabs(aValue);
return gfx_coord(fabs(aValue));
}

Просмотреть файл

@ -214,7 +214,7 @@ NS_IMETHODIMP nsImage::GetFormat(gfx_format *aFormat)
mBHead->biWidth = GFXCoordToIntCeil(mSize.width);
mBHead->biHeight = -GFXCoordToIntCeil(mSize.height);
mBHead->biPlanes = 1;
mBHead->biBitCount = 24;
mBHead->biBitCount = mDepth;
mBHead->biCompression = BI_RGB;
mBHead->biSizeImage = mBitsLength; // not compressed, so we dont need this to be set
mBHead->biXPelsPerMeter = 0;