Add optional driver test.

Fix FillRoundRect.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2745 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
shadow303 2003-02-17 22:36:05 +00:00
parent b7772bd6d4
commit 9c2c646bdb
3 changed files with 44 additions and 6 deletions

View File

@ -1050,15 +1050,15 @@ void AccelerantDriver::FillRoundRect(BRect r, float xrad, float yrad, LayerData
PatternHandler pattern(pat);
pattern.SetColors(d->highcolor, d->lowcolor);
for (i=0; i<ROUND(yrad); i++)
for (i=0; i<=(int)yrad; i++)
{
arc_x = xrad*sqrt(1-i*i/yrad2);
if ( CHECK_Y(r.top+i) )
if ( CHECK_Y(r.top+yrad-i) )
HLine(CLIP_X(r.left+xrad-arc_x), CLIP_X(r.right-xrad+arc_x),
r.top+i, &pattern);
if ( CHECK_Y(r.bottom-i) )
r.top+yrad-i, &pattern);
if ( CHECK_Y(r.bottom-yrad+i) )
HLine(CLIP_X(r.left+xrad-arc_x), CLIP_X(r.right-xrad+arc_x),
r.bottom-i, &pattern);
r.bottom-yrad+i, &pattern);
}
FillRect(BRect(CLIP_X(r.left),CLIP_Y(r.top+yrad),
CLIP_X(r.right),CLIP_Y(r.bottom-yrad)), d, pat);

View File

@ -29,6 +29,7 @@
#include "RootLayer.h"
#include "Desktop.h"
#include "PatternHandler.h" // for pattern_union
#include "ServerConfig.h"
/*!
@ -92,6 +93,40 @@ void RootLayer::RequestDraw(void)
lay->RequestDraw(lay->Bounds());
}
#ifdef DISPLAYDRIVER_TEST_HACK
int8 pattern[8];
int8 pattern2[8];
memset(pattern,255,8);
memset(pattern2,128+32+8+2,8);
BRect r1(100,100,1500,1100);
BPoint pts[4];
pts[0].x = 200;
pts[0].y = 200;
pts[1].x = 400;
pts[1].y = 1000;
pts[2].x = 600;
pts[2].y = 400;
pts[3].x = 1200;
pts[3].y = 800;
_layerdata->highcolor.SetColor(255,0,0,255);
_layerdata->lowcolor.SetColor(255,255,255,255);
_driver->FillRect(r1,_layerdata,pattern);
_layerdata->highcolor.SetColor(255,255,0,255);
_driver->StrokeLine(BPoint(100,100),BPoint(1500,1100),_layerdata,pattern);
_layerdata->highcolor.SetColor(0,0,255,255);
_driver->StrokeBezier(pts,_layerdata,pattern);
_driver->StrokeArc(BRect(200,300,400,600),30,270,_layerdata,pattern);
_driver->StrokeEllipse(BRect(200,700,400,900),_layerdata,pattern);
_driver->StrokeRect(BRect(650,1000,750,1090),_layerdata,pattern);
_driver->StrokeRoundRect(BRect(200,1000,600,1090),30,40,_layerdata,pattern);
_driver->FillArc(BRect(1250,300,1450,600),30,270,_layerdata,pattern);
// _driver->FillBezier(pts,_layerdata,pattern);
_driver->FillEllipse(BRect(800,300,1200,600),_layerdata,pattern);
_driver->FillRoundRect(BRect(800,1000,1200,1090),30,40,_layerdata,pattern2);
#endif
}
/*!

View File

@ -23,9 +23,12 @@
// Display driver to be used by the server.
#define DISPLAYDRIVER VIEWDRIVER
// Define this for a quick hack to test some of the drawing functions
//#define DISPLAYDRIVER_TEST_HACK
// Define this if you want the display driver to emulate the input server.
// Comment this out if DISPLAYDRIVER is defined as HWDRIVER.
#define ENABLE_INPUT_SERVER_EMULATION
//#define ENABLE_INPUT_SERVER_EMULATION
// This is the application signature of our app_server when running as a
// regular application. When running as the app_server, this is not used.