rounding support

git-svn-id: svn://10.0.0.236/trunk@6999 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
peterl%netscape.com
1998-07-31 23:34:45 +00:00
parent 2f0ac5c990
commit ac2ec1a340
82 changed files with 442 additions and 423 deletions

View File

@@ -25,9 +25,6 @@
#include "nsXIFConverter.h"
#include "nsISizeOfHandler.h"
#undef SCALE
#define SCALE(a,b) nscoord((a) * (b))
class Area {
public:
Area(const nsString& aBaseURL, const nsString& aHREF,
@@ -455,10 +452,10 @@ void RectArea::Draw(nsIPresContext& aCX, nsIRenderingContext& aRC)
{
if (mNumCoords >= 4) {
float p2t = aCX.GetPixelsToTwips();
nscoord x1 = SCALE(p2t, mCoords[0]);
nscoord y1 = SCALE(p2t, mCoords[1]);
nscoord x2 = SCALE(p2t, mCoords[2]);
nscoord y2 = SCALE(p2t, mCoords[3]);
nscoord x1 = NSIntPixelsToTwips(mCoords[0], p2t);
nscoord y1 = NSIntPixelsToTwips(mCoords[1], p2t);
nscoord x2 = NSIntPixelsToTwips(mCoords[2], p2t);
nscoord y2 = NSIntPixelsToTwips(mCoords[3], p2t);
if ((x1 > x2)|| (y1 > y2)) {
return;
}
@@ -563,11 +560,11 @@ void PolyArea::Draw(nsIPresContext& aCX, nsIRenderingContext& aRC)
{
if (mNumCoords >= 6) {
float p2t = aCX.GetPixelsToTwips();
nscoord x0 = SCALE(p2t, mCoords[0]);
nscoord y0 = SCALE(p2t, mCoords[1]);
nscoord x0 = NSIntPixelsToTwips(mCoords[0], p2t);
nscoord y0 = NSIntPixelsToTwips(mCoords[1], p2t);
for (PRInt32 i = 2; i < mNumCoords; i += 2) {
nscoord x1 = SCALE(p2t, mCoords[i]);
nscoord y1 = SCALE(p2t, mCoords[i+1]);
nscoord x1 = NSIntPixelsToTwips(mCoords[i], p2t);
nscoord y1 = NSIntPixelsToTwips(mCoords[i+1], p2t);
aRC.DrawLine(x0, y0, x1, y1);
x0 = x1;
y0 = y1;
@@ -631,9 +628,9 @@ void CircleArea::Draw(nsIPresContext& aCX, nsIRenderingContext& aRC)
{
if (mNumCoords >= 3) {
float p2t = aCX.GetPixelsToTwips();
nscoord x1 = SCALE(p2t, mCoords[0]);
nscoord y1 = SCALE(p2t, mCoords[1]);
nscoord radius = SCALE(p2t, mCoords[2]);
nscoord x1 = NSIntPixelsToTwips(mCoords[0], p2t);
nscoord y1 = NSIntPixelsToTwips(mCoords[1], p2t);
nscoord radius = NSIntPixelsToTwips(mCoords[2], p2t);
if (radius < 0) {
return;
}