Rename clippReg to clipReg
Implement drawing and clipping for display driver - drawing and clipping should work including pensizes. Drawmodes, line caps, and line joins aren't supported yet. Some implementations will need to be revamped. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7622 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
225784b713
commit
43404a847e
@ -758,7 +758,7 @@ void BitmapDriver::FillPatternRect(const BRect &rect, const DrawData *d)
|
||||
{
|
||||
}
|
||||
|
||||
void BitmapDriver::StrokeSolidLine(const BPoint &start, const BPoint &end, const RGBColor &color)
|
||||
void BitmapDriver::StrokeSolidLine(int32 x1, int32 y1, int32 x2, int32 y2, const RGBColor &color)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ protected:
|
||||
virtual void Blit(const BRect &src, const BRect &dest, const DrawData *d);
|
||||
virtual void FillSolidRect(const BRect &rect, const RGBColor &color);
|
||||
virtual void FillPatternRect(const BRect &rect, const DrawData *d);
|
||||
virtual void StrokeSolidLine(const BPoint &start, const BPoint &end, const RGBColor &color);
|
||||
virtual void StrokeSolidLine(int32 x1, int32 y1, int32 x2, int32 y2, const RGBColor &color);
|
||||
virtual void StrokePatternLine(int32 x1, int32 y1, int32 x2, int32 y2, const DrawData *d);
|
||||
virtual void StrokeSolidRect(const BRect &rect, const RGBColor &color);
|
||||
virtual void CopyBitmap(ServerBitmap *bitmap, const BRect &source, const BRect &dest, const DrawData *d);
|
||||
|
@ -475,14 +475,14 @@ void DirectDriver::StrokeSolidRect(const BRect &rect, const RGBColor &color)
|
||||
Unlock();
|
||||
}
|
||||
|
||||
void DirectDriver::StrokeSolidLine(const BPoint &start, const BPoint &end,const RGBColor &color)
|
||||
void DirectDriver::StrokeSolidLine(int32 x1, int32 y1, int32 x2, int32 y2, const RGBColor &color)
|
||||
{
|
||||
Lock();
|
||||
framebuffer->Lock();
|
||||
drawview->SetHighColor(color.GetColor32());
|
||||
drawview->StrokeLine(start,end);
|
||||
drawview->StrokeLine(BPoint(x1,y1),BPoint(x2,y2));
|
||||
drawview->Sync();
|
||||
screenwin->rectpipe.PutRect(BRect(start,end));
|
||||
screenwin->rectpipe.PutRect(BRect(x1,y1,x2,y2));
|
||||
framebuffer->Unlock();
|
||||
Unlock();
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ protected:
|
||||
virtual void FillSolidRect(const BRect &rect, const RGBColor &color);
|
||||
virtual void FillPatternRect(const BRect &rect, const DrawData *d);
|
||||
virtual void StrokeSolidRect(const BRect &rect, const RGBColor &color);
|
||||
virtual void StrokeSolidLine(const BPoint &start, const BPoint &end,const RGBColor &color);
|
||||
virtual void StrokeSolidLine(int32 x1, int32 y1, int32 x2, int32 y2, const RGBColor &color);
|
||||
virtual void StrokePatternLine(int32 x1, int32 y1, int32 x2, int32 y2, const DrawData *d);
|
||||
virtual void CopyBitmap(ServerBitmap *bitmap, const BRect &source,
|
||||
const BRect &dest, const DrawData *d);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -600,8 +600,8 @@ void Layer::RebuildFullRegion( ){
|
||||
ld = _layerdata;
|
||||
do{
|
||||
// clip to user region
|
||||
if(ld->clippReg)
|
||||
_full.IntersectWith( ld->clippReg );
|
||||
if(ld->clipReg)
|
||||
_full.IntersectWith( ld->clipReg );
|
||||
} while( (ld = ld->prevState) );
|
||||
|
||||
// clip to user picture region
|
||||
|
@ -52,7 +52,7 @@ DrawData::DrawData(void)
|
||||
if(fontserver)
|
||||
font=*(fontserver->GetSystemPlain());
|
||||
|
||||
clippReg=NULL;
|
||||
clipReg=NULL;
|
||||
|
||||
edelta.space=0;
|
||||
edelta.nonspace=0;
|
||||
@ -60,8 +60,8 @@ DrawData::DrawData(void)
|
||||
|
||||
DrawData::~DrawData(void)
|
||||
{
|
||||
if (clippReg)
|
||||
delete clippReg;
|
||||
if (clipReg)
|
||||
delete clipReg;
|
||||
}
|
||||
|
||||
DrawData::DrawData(const DrawData &data)
|
||||
@ -90,12 +90,12 @@ DrawData &DrawData::operator=(const DrawData &from)
|
||||
fontAliasing=from.fontAliasing;
|
||||
font=from.font;
|
||||
|
||||
if(from.clippReg)
|
||||
if(from.clipReg)
|
||||
{
|
||||
if(clippReg)
|
||||
*clippReg=*(from.clippReg);
|
||||
if(clipReg)
|
||||
*clipReg=*(from.clipReg);
|
||||
else
|
||||
clippReg=new BRegion(*(from.clippReg));
|
||||
clipReg=new BRegion(*(from.clipReg));
|
||||
}
|
||||
|
||||
edelta=from.edelta;
|
||||
@ -150,12 +150,12 @@ LayerData &LayerData::operator=(const LayerData &from)
|
||||
fontAliasing=from.fontAliasing;
|
||||
font=from.font;
|
||||
|
||||
if(from.clippReg)
|
||||
if(from.clipReg)
|
||||
{
|
||||
if(clippReg)
|
||||
*clippReg=*(from.clippReg);
|
||||
if(clipReg)
|
||||
*clipReg=*(from.clipReg);
|
||||
else
|
||||
clippReg=new BRegion(*(from.clippReg));
|
||||
clipReg=new BRegion(*(from.clipReg));
|
||||
}
|
||||
|
||||
edelta=from.edelta;
|
||||
@ -182,8 +182,8 @@ void LayerData::PrintToStream() const{
|
||||
printf("\t LineCap: %d\t LineJoin: %d\t MiterLimit: %f\n", (int16)lineCap, (int16)lineJoin, miterLimit);
|
||||
printf("\t AlphaSrcMode: %ld\t AlphaFncMode: %ld\n", (int32)alphaSrcMode, (int32)alphaFncMode);
|
||||
printf("\t Scale: %f\n", scale);
|
||||
if (clippReg)
|
||||
clippReg->PrintToStream();
|
||||
if (clipReg)
|
||||
clipReg->PrintToStream();
|
||||
|
||||
printf("\t ===== Font Data =====\n");
|
||||
printf("\t FontStyle: CURRENTLY NOT SET\n");
|
||||
|
@ -595,7 +595,7 @@ void ServerWindow::SetLayerState(Layer *layer){
|
||||
lowColor,
|
||||
viewColor;
|
||||
pattern patt;
|
||||
int32 clippRegRects;
|
||||
int32 clipRegRects;
|
||||
|
||||
fSession->ReadPoint( &(layer->_layerdata->penlocation));
|
||||
fSession->ReadFloat( &(layer->_layerdata->pensize));
|
||||
@ -612,30 +612,30 @@ void ServerWindow::SetLayerState(Layer *layer){
|
||||
fSession->ReadInt8((int8*) &(layer->_layerdata->alphaFncMode));
|
||||
fSession->ReadFloat( &(layer->_layerdata->scale));
|
||||
fSession->ReadBool( &(layer->_layerdata->fontAliasing));
|
||||
fSession->ReadInt32( &clippRegRects);
|
||||
fSession->ReadInt32( &clipRegRects);
|
||||
|
||||
layer->_layerdata->patt.Set(*((uint64*)&patt));
|
||||
layer->_layerdata->highcolor.SetColor(highColor);
|
||||
layer->_layerdata->lowcolor.SetColor(lowColor);
|
||||
layer->_layerdata->viewcolor.SetColor(viewColor);
|
||||
|
||||
if(clippRegRects != 0){
|
||||
if(layer->_layerdata->clippReg == NULL)
|
||||
layer->_layerdata->clippReg = new BRegion();
|
||||
if(clipRegRects != 0){
|
||||
if(layer->_layerdata->clipReg == NULL)
|
||||
layer->_layerdata->clipReg = new BRegion();
|
||||
else
|
||||
layer->_layerdata->clippReg->MakeEmpty();
|
||||
layer->_layerdata->clipReg->MakeEmpty();
|
||||
|
||||
BRect rect;
|
||||
|
||||
for(int32 i = 0; i < clippRegRects; i++){
|
||||
for(int32 i = 0; i < clipRegRects; i++){
|
||||
fSession->ReadRect(&rect);
|
||||
layer->_layerdata->clippReg->Include(rect);
|
||||
layer->_layerdata->clipReg->Include(rect);
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (layer->_layerdata->clippReg){
|
||||
delete layer->_layerdata->clippReg;
|
||||
layer->_layerdata->clippReg = NULL;
|
||||
if (layer->_layerdata->clipReg){
|
||||
delete layer->_layerdata->clipReg;
|
||||
layer->_layerdata->clipReg = NULL;
|
||||
}
|
||||
}
|
||||
STRACE(("DONE: ServerWindow %s: Message AS_LAYER_SET_STATE: Layer: %s\n",fTitle.String(), layer->_name->String()));
|
||||
@ -890,13 +890,13 @@ void ServerWindow::DispatchMessage(int32 code)
|
||||
fSession->WriteFloat(ld->fontAliasing);
|
||||
|
||||
int32 noOfRects = 0;
|
||||
if (ld->clippReg)
|
||||
noOfRects = ld->clippReg->CountRects();
|
||||
if (ld->clipReg)
|
||||
noOfRects = ld->clipReg->CountRects();
|
||||
|
||||
fSession->WriteInt32(noOfRects);
|
||||
|
||||
for(int i = 0; i < noOfRects; i++){
|
||||
fSession->WriteRect(ld->clippReg->RectAt(i));
|
||||
fSession->WriteRect(ld->clipReg->RectAt(i));
|
||||
}
|
||||
|
||||
fSession->WriteFloat(cl->_frame.left);
|
||||
@ -1331,12 +1331,12 @@ void ServerWindow::DispatchMessage(int32 code)
|
||||
ld = cl->_layerdata;
|
||||
reg = cl->ConvertFromParent(&(cl->_visible));
|
||||
|
||||
if(ld->clippReg)
|
||||
reg.IntersectWith(ld->clippReg);
|
||||
if(ld->clipReg)
|
||||
reg.IntersectWith(ld->clipReg);
|
||||
|
||||
while((ld = ld->prevState))
|
||||
if(ld->clippReg)
|
||||
reg.IntersectWith(ld->clippReg);
|
||||
if(ld->clipReg)
|
||||
reg.IntersectWith(ld->clipReg);
|
||||
|
||||
noOfRects = reg.CountRects();
|
||||
fSession->WriteInt32(noOfRects);
|
||||
@ -1356,16 +1356,16 @@ void ServerWindow::DispatchMessage(int32 code)
|
||||
int32 noOfRects;
|
||||
BRect r;
|
||||
|
||||
if(cl->_layerdata->clippReg)
|
||||
cl->_layerdata->clippReg->MakeEmpty();
|
||||
if(cl->_layerdata->clipReg)
|
||||
cl->_layerdata->clipReg->MakeEmpty();
|
||||
else
|
||||
cl->_layerdata->clippReg = new BRegion();
|
||||
cl->_layerdata->clipReg = new BRegion();
|
||||
|
||||
fSession->ReadInt32(&noOfRects);
|
||||
|
||||
for(int i = 0; i < noOfRects; i++){
|
||||
fSession->ReadRect(&r);
|
||||
cl->_layerdata->clippReg->Include(r);
|
||||
cl->_layerdata->clipReg->Include(r);
|
||||
}
|
||||
|
||||
cl->RebuildFullRegion();
|
||||
|
@ -706,7 +706,7 @@ void ViewDriver::StrokePatternLine(int32 x1, int32 y1, int32 x2, int32 y2, const
|
||||
screenwin->Unlock();
|
||||
}
|
||||
|
||||
void ViewDriver::StrokeSolidLine(const BPoint &start, const BPoint &end, const RGBColor &color)
|
||||
void ViewDriver::StrokeSolidLine(int32 x1, int32 y1, int32 x2, int32 y2, const RGBColor &color)
|
||||
{
|
||||
if(!is_initialized)
|
||||
return;
|
||||
@ -714,9 +714,9 @@ void ViewDriver::StrokeSolidLine(const BPoint &start, const BPoint &end, const R
|
||||
screenwin->Lock();
|
||||
framebuffer->Lock();
|
||||
drawview->SetHighColor(color.GetColor32());
|
||||
drawview->StrokeLine(start,end);
|
||||
drawview->StrokeLine(BPoint(x1,y1),BPoint(x2,y2));
|
||||
drawview->Sync();
|
||||
screenwin->view->Invalidate(BRect(start,end));
|
||||
screenwin->view->Invalidate(BRect(x1,y1,x2,y2));
|
||||
framebuffer->Unlock();
|
||||
screenwin->Unlock();
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ protected:
|
||||
virtual void FillSolidRect(const BRect &rect, const RGBColor &color);
|
||||
virtual void FillPatternRect(const BRect &rect, const DrawData *d);
|
||||
virtual void StrokeSolidRect(const BRect &rect, const RGBColor &color);
|
||||
virtual void StrokeSolidLine(const BPoint &start, const BPoint &end,
|
||||
virtual void StrokeSolidLine(int32 x1, int32 y1, int32 x2, int32 y2,
|
||||
const RGBColor &color);
|
||||
virtual void SetDrawData(const DrawData *d, bool set_font_data=false);
|
||||
virtual void StrokePatternLine(int32 x1, int32 y1, int32 x2, int32 y2,
|
||||
|
@ -140,8 +140,8 @@ void WinBorder::RebuildFullRegion(void){
|
||||
ld = topLayer->_layerdata;
|
||||
do{
|
||||
// clip to user region
|
||||
if(ld->clippReg)
|
||||
topLayerFull.IntersectWith( ld->clippReg );
|
||||
if(ld->clipReg)
|
||||
topLayerFull.IntersectWith( ld->clipReg );
|
||||
} while( (ld = ld->prevState) );
|
||||
|
||||
// clip to user picture region
|
||||
|
Loading…
Reference in New Issue
Block a user