turned off debug output in AppServer.cpp and ServerApp.cpp
system palette is now hardcoded using Ingo's BBitmap code for a speedup and the ability to reference the server's system palette without the server actually running Added some utility classes to make finishing DisplayDriver easier and cleaner Removed a stray debugger call in DisplayDriver Added a display mode conversion function to Utils.cpp Began conversion of BitmapDriver to utilize PixelRenderer class where appropriate git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8855 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
e09bff9bf3
commit
8a715d82f6
@ -49,7 +49,7 @@
|
||||
#include "Desktop.h"
|
||||
|
||||
//#define DEBUG_KEYHANDLING
|
||||
#define DEBUG_SERVER
|
||||
//#define DEBUG_SERVER
|
||||
|
||||
#ifdef DEBUG_KEYHANDLING
|
||||
# include <stdio.h>
|
||||
|
@ -54,7 +54,9 @@ extern RGBColor workspace_default_color; // defined in AppServer.cpp
|
||||
*/
|
||||
BitmapDriver::BitmapDriver(void) : DisplayDriver()
|
||||
{
|
||||
_target=NULL;
|
||||
fTarget=NULL;
|
||||
fGraphicsBuffer=NULL;
|
||||
fPixelRenderer=NULL;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -93,13 +95,58 @@ void BitmapDriver::Shutdown(void)
|
||||
void BitmapDriver::SetTarget(ServerBitmap *target)
|
||||
{
|
||||
Lock();
|
||||
_target=target;
|
||||
|
||||
if(fGraphicsBuffer)
|
||||
{
|
||||
delete fGraphicsBuffer;
|
||||
fGraphicsBuffer=NULL;
|
||||
}
|
||||
|
||||
if(fPixelRenderer)
|
||||
{
|
||||
delete fPixelRenderer;
|
||||
fPixelRenderer=NULL;
|
||||
}
|
||||
|
||||
fTarget=target;
|
||||
|
||||
if(target)
|
||||
{
|
||||
_displaymode.virtual_width=target->Width();
|
||||
_displaymode.virtual_height=target->Height();
|
||||
_displaymode.space=target->ColorSpace();
|
||||
|
||||
fGraphicsBuffer=new GraphicsBuffer((uint8*)fTarget->Bits(),fTarget->Bounds().Width(),
|
||||
fTarget->Bounds().Height(),fTarget->BytesPerRow());
|
||||
|
||||
switch(fTarget->ColorSpace())
|
||||
{
|
||||
case B_RGB32:
|
||||
case B_RGBA32:
|
||||
{
|
||||
fPixelRenderer=new PixelRendererRGBA32(*fGraphicsBuffer);
|
||||
break;
|
||||
}
|
||||
case B_RGB16:
|
||||
{
|
||||
fPixelRenderer=new PixelRendererRGB16(*fGraphicsBuffer);
|
||||
break;
|
||||
}
|
||||
case B_RGB15:
|
||||
case B_RGBA15:
|
||||
{
|
||||
fPixelRenderer=new PixelRendererRGBA15(*fGraphicsBuffer);
|
||||
break;
|
||||
}
|
||||
case B_CMAP8:
|
||||
case B_GRAY8:
|
||||
{
|
||||
fPixelRenderer=new PixelRendererCMAP8(*fGraphicsBuffer);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// Setting mode not necessary. Can get color space stuff via ServerBitmap->ColorSpace
|
||||
}
|
||||
|
||||
@ -121,28 +168,28 @@ void BitmapDriver::SetMode(const display_mode &mode)
|
||||
void BitmapDriver::InvertRect(const BRect &r)
|
||||
{
|
||||
Lock();
|
||||
if(_target)
|
||||
if(fTarget)
|
||||
{
|
||||
if(r.top<0 || r.left<0 ||
|
||||
r.right>_target->Width()-1 || r.bottom>_target->Height()-1)
|
||||
r.right>fTarget->Width()-1 || r.bottom>fTarget->Height()-1)
|
||||
{
|
||||
Unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
switch(_target->BitsPerPixel())
|
||||
switch(fTarget->BitsPerPixel())
|
||||
{
|
||||
case 32:
|
||||
case 24:
|
||||
{
|
||||
uint16 width=r.IntegerWidth(), height=r.IntegerHeight();
|
||||
uint32 *start=(uint32*)_target->Bits(), *index;
|
||||
start+=int32(r.top)*_target->Width();
|
||||
uint32 *start=(uint32*)fTarget->Bits(), *index;
|
||||
start+=int32(r.top)*fTarget->Width();
|
||||
start+=int32(r.left);
|
||||
|
||||
for(int32 i=0;i<height;i++)
|
||||
{
|
||||
index=start + (i*_target->Width());
|
||||
index=start + (i*fTarget->Width());
|
||||
for(int32 j=0; j<width; j++)
|
||||
index[j]^=0xFFFFFF00L;
|
||||
}
|
||||
@ -279,17 +326,17 @@ rgb_color BitmapDriver::GetBlitColor(rgb_color src, rgb_color dest, DrawData *d,
|
||||
void BitmapDriver::SetThickPatternPixel(int x, int y)
|
||||
{
|
||||
int left, right, top, bottom;
|
||||
int bytes_per_row = _target->BytesPerRow();
|
||||
int bytes_per_row = fTarget->BytesPerRow();
|
||||
left = x - fLineThickness/2;
|
||||
right = x + fLineThickness/2;
|
||||
top = y - fLineThickness/2;
|
||||
bottom = y + fLineThickness/2;
|
||||
switch(_target->BitsPerPixel())
|
||||
switch(fTarget->BitsPerPixel())
|
||||
{
|
||||
case 8:
|
||||
{
|
||||
int x,y;
|
||||
uint8 *fb = (uint8 *)_target->Bits() + top*bytes_per_row;
|
||||
uint8 *fb = (uint8 *)fTarget->Bits() + top*bytes_per_row;
|
||||
for (y=top; y<=bottom; y++)
|
||||
{
|
||||
for (x=left; x<=right; x++)
|
||||
@ -300,7 +347,7 @@ void BitmapDriver::SetThickPatternPixel(int x, int y)
|
||||
case 15:
|
||||
{
|
||||
int x,y;
|
||||
uint16 *fb = (uint16 *)((uint8 *)_target->Bits() + top*bytes_per_row);
|
||||
uint16 *fb = (uint16 *)((uint8 *)fTarget->Bits() + top*bytes_per_row);
|
||||
for (y=top; y<=bottom; y++)
|
||||
{
|
||||
for (x=left; x<=right; x++)
|
||||
@ -311,7 +358,7 @@ void BitmapDriver::SetThickPatternPixel(int x, int y)
|
||||
case 16:
|
||||
{
|
||||
int x,y;
|
||||
uint16 *fb = (uint16 *)((uint8 *)_target->Bits() + top*bytes_per_row);
|
||||
uint16 *fb = (uint16 *)((uint8 *)fTarget->Bits() + top*bytes_per_row);
|
||||
for (y=top; y<=bottom; y++)
|
||||
{
|
||||
for (x=left; x<=right; x++)
|
||||
@ -323,7 +370,7 @@ void BitmapDriver::SetThickPatternPixel(int x, int y)
|
||||
case 32:
|
||||
{
|
||||
int x,y;
|
||||
uint32 *fb = (uint32 *)((uint8 *)_target->Bits() + top*bytes_per_row);
|
||||
uint32 *fb = (uint32 *)((uint8 *)fTarget->Bits() + top*bytes_per_row);
|
||||
rgb_color color;
|
||||
for (y=top; y<=bottom; y++)
|
||||
{
|
||||
@ -349,7 +396,7 @@ void BitmapDriver::SetThickPatternPixel(int x, int y)
|
||||
void BitmapDriver::HLinePatternThick(int32 x1, int32 x2, int32 y)
|
||||
{
|
||||
int x, y1, y2;
|
||||
int bytes_per_row = _target->BytesPerRow();
|
||||
int bytes_per_row = fTarget->BytesPerRow();
|
||||
|
||||
if ( x1 > x2 )
|
||||
{
|
||||
@ -359,11 +406,11 @@ void BitmapDriver::HLinePatternThick(int32 x1, int32 x2, int32 y)
|
||||
}
|
||||
y1 = y - fLineThickness/2;
|
||||
y2 = y + fLineThickness/2;
|
||||
switch(_target->BitsPerPixel())
|
||||
switch(fTarget->BitsPerPixel())
|
||||
{
|
||||
case 8:
|
||||
{
|
||||
uint8 *fb = (uint8 *)_target->Bits() + y1*bytes_per_row;
|
||||
uint8 *fb = (uint8 *)fTarget->Bits() + y1*bytes_per_row;
|
||||
for (y=y1; y<=y2; y++)
|
||||
{
|
||||
for (x=x1; x<=x2; x++)
|
||||
@ -373,7 +420,7 @@ void BitmapDriver::HLinePatternThick(int32 x1, int32 x2, int32 y)
|
||||
} break;
|
||||
case 15:
|
||||
{
|
||||
uint16 *fb = (uint16 *)((uint8 *)_target->Bits() + y1*bytes_per_row);
|
||||
uint16 *fb = (uint16 *)((uint8 *)fTarget->Bits() + y1*bytes_per_row);
|
||||
for (y=y1; y<=y2; y++)
|
||||
{
|
||||
for (x=x1; x<=x2; x++)
|
||||
@ -383,7 +430,7 @@ void BitmapDriver::HLinePatternThick(int32 x1, int32 x2, int32 y)
|
||||
} break;
|
||||
case 16:
|
||||
{
|
||||
uint16 *fb = (uint16 *)((uint8 *)_target->Bits() + y1*bytes_per_row);
|
||||
uint16 *fb = (uint16 *)((uint8 *)fTarget->Bits() + y1*bytes_per_row);
|
||||
for (y=y1; y<=y2; y++)
|
||||
{
|
||||
for (x=x1; x<=x2; x++)
|
||||
@ -394,7 +441,7 @@ void BitmapDriver::HLinePatternThick(int32 x1, int32 x2, int32 y)
|
||||
case 24:
|
||||
case 32:
|
||||
{
|
||||
uint32 *fb = (uint32 *)((uint8 *)_target->Bits() + y1*bytes_per_row);
|
||||
uint32 *fb = (uint32 *)((uint8 *)fTarget->Bits() + y1*bytes_per_row);
|
||||
rgb_color color;
|
||||
for (y=y1; y<=y2; y++)
|
||||
{
|
||||
@ -420,7 +467,7 @@ void BitmapDriver::HLinePatternThick(int32 x1, int32 x2, int32 y)
|
||||
void BitmapDriver::VLinePatternThick(int32 x, int32 y1, int32 y2)
|
||||
{
|
||||
int y, x1, x2;
|
||||
int bytes_per_row = _target->BytesPerRow();
|
||||
int bytes_per_row = fTarget->BytesPerRow();
|
||||
|
||||
if ( y1 > y2 )
|
||||
{
|
||||
@ -430,11 +477,11 @@ void BitmapDriver::VLinePatternThick(int32 x, int32 y1, int32 y2)
|
||||
}
|
||||
x1 = x - fLineThickness/2;
|
||||
x2 = x + fLineThickness/2;
|
||||
switch(_target->BitsPerPixel())
|
||||
switch(fTarget->BitsPerPixel())
|
||||
{
|
||||
case 8:
|
||||
{
|
||||
uint8 *fb = (uint8 *)_target->Bits() + y1*bytes_per_row;
|
||||
uint8 *fb = (uint8 *)fTarget->Bits() + y1*bytes_per_row;
|
||||
for (y=y1; y<=y2; y++)
|
||||
{
|
||||
for (x=x1; x<=x2; x++)
|
||||
@ -444,7 +491,7 @@ void BitmapDriver::VLinePatternThick(int32 x, int32 y1, int32 y2)
|
||||
} break;
|
||||
case 15:
|
||||
{
|
||||
uint16 *fb = (uint16 *)((uint8 *)_target->Bits() + y1*bytes_per_row);
|
||||
uint16 *fb = (uint16 *)((uint8 *)fTarget->Bits() + y1*bytes_per_row);
|
||||
for (y=y1; y<=y2; y++)
|
||||
{
|
||||
for (x=x1; x<=x2; x++)
|
||||
@ -454,7 +501,7 @@ void BitmapDriver::VLinePatternThick(int32 x, int32 y1, int32 y2)
|
||||
} break;
|
||||
case 16:
|
||||
{
|
||||
uint16 *fb = (uint16 *)((uint8 *)_target->Bits() + y1*bytes_per_row);
|
||||
uint16 *fb = (uint16 *)((uint8 *)fTarget->Bits() + y1*bytes_per_row);
|
||||
for (y=y1; y<=y2; y++)
|
||||
{
|
||||
for (x=x1; x<=x2; x++)
|
||||
@ -465,7 +512,7 @@ void BitmapDriver::VLinePatternThick(int32 x, int32 y1, int32 y2)
|
||||
case 24:
|
||||
case 32:
|
||||
{
|
||||
uint32 *fb = (uint32 *)((uint8 *)_target->Bits() + y1*bytes_per_row);
|
||||
uint32 *fb = (uint32 *)((uint8 *)fTarget->Bits() + y1*bytes_per_row);
|
||||
rgb_color color;
|
||||
for (y=y1; y<=y2; y++)
|
||||
{
|
||||
@ -491,7 +538,7 @@ void BitmapDriver::DrawBitmap(ServerBitmap *sourcebmp, const BRect &source,
|
||||
if(!sourcebmp | !d)
|
||||
return;
|
||||
|
||||
if(sourcebmp->BitsPerPixel() != _target->BitsPerPixel())
|
||||
if(sourcebmp->BitsPerPixel() != fTarget->BitsPerPixel())
|
||||
return;
|
||||
|
||||
uint8 colorspace_size=sourcebmp->BitsPerPixel()/8;
|
||||
@ -524,7 +571,7 @@ void BitmapDriver::DrawBitmap(ServerBitmap *sourcebmp, const BRect &source,
|
||||
sourcerect.bottom = work_rect.bottom;
|
||||
}
|
||||
|
||||
work_rect.Set(0,0,_target->Width()-1,_target->Height()-1);
|
||||
work_rect.Set(0,0,fTarget->Width()-1,fTarget->Height()-1);
|
||||
|
||||
// Check to see if we actually need to copy anything
|
||||
if( (destrect.right<work_rect.left) || (destrect.left>work_rect.right) ||
|
||||
@ -543,11 +590,11 @@ void BitmapDriver::DrawBitmap(ServerBitmap *sourcebmp, const BRect &source,
|
||||
|
||||
// Set pointers to the actual data
|
||||
uint8 *src_bits = (uint8*) sourcebmp->Bits();
|
||||
uint8 *dest_bits = (uint8*) _target->Bits();
|
||||
uint8 *dest_bits = (uint8*) fTarget->Bits();
|
||||
|
||||
// Get row widths for offset looping
|
||||
uint32 src_width = uint32 (sourcebmp->BytesPerRow());
|
||||
uint32 dest_width = uint32 (_target->BytesPerRow());
|
||||
uint32 dest_width = uint32 (fTarget->BytesPerRow());
|
||||
|
||||
// Offset bitmap pointers to proper spot in each bitmap
|
||||
src_bits += uint32 ( (sourcerect.top * src_width) + (sourcerect.left * colorspace_size) );
|
||||
@ -617,7 +664,7 @@ bool BitmapDriver::AcquireBuffer(FBBitmap *fbmp)
|
||||
if(!fbmp)
|
||||
return false;
|
||||
|
||||
fbmp->ServerBitmap::ShallowCopy(_target);
|
||||
fbmp->ServerBitmap::ShallowCopy(fTarget);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -632,18 +679,18 @@ void BitmapDriver::Blit(const BRect &src, const BRect &dest, const DrawData *d)
|
||||
|
||||
void BitmapDriver::FillSolidRect(const BRect &rect, const RGBColor &color)
|
||||
{
|
||||
int bytes_per_row = _target->BytesPerRow();
|
||||
int bytes_per_row = fTarget->BytesPerRow();
|
||||
int top = (int)rect.top;
|
||||
int left = (int)rect.left;
|
||||
int right = (int)rect.right;
|
||||
int bottom = (int)rect.bottom;
|
||||
RGBColor col(color); // to avoid GetColor8/15/16() const issues
|
||||
|
||||
switch(_target->BitsPerPixel())
|
||||
switch(fTarget->BitsPerPixel())
|
||||
{
|
||||
case 8:
|
||||
{
|
||||
uint8 *fb = (uint8 *)_target->Bits() + top*bytes_per_row;
|
||||
uint8 *fb = (uint8 *)fTarget->Bits() + top*bytes_per_row;
|
||||
uint8 color8 = col.GetColor8();
|
||||
int x,y;
|
||||
for (y=top; y<=bottom; y++)
|
||||
@ -655,7 +702,7 @@ void BitmapDriver::FillSolidRect(const BRect &rect, const RGBColor &color)
|
||||
} break;
|
||||
case 15:
|
||||
{
|
||||
uint16 *fb = (uint16 *)((uint8 *)_target->Bits() + top*bytes_per_row);
|
||||
uint16 *fb = (uint16 *)((uint8 *)fTarget->Bits() + top*bytes_per_row);
|
||||
uint16 color15 = col.GetColor15();
|
||||
int x,y;
|
||||
for (y=top; y<=bottom; y++)
|
||||
@ -667,7 +714,7 @@ void BitmapDriver::FillSolidRect(const BRect &rect, const RGBColor &color)
|
||||
} break;
|
||||
case 16:
|
||||
{
|
||||
uint16 *fb = (uint16 *)((uint8 *)_target->Bits() + top*bytes_per_row);
|
||||
uint16 *fb = (uint16 *)((uint8 *)fTarget->Bits() + top*bytes_per_row);
|
||||
uint16 color16 = col.GetColor16();
|
||||
int x,y;
|
||||
for (y=top; y<=bottom; y++)
|
||||
@ -680,7 +727,7 @@ void BitmapDriver::FillSolidRect(const BRect &rect, const RGBColor &color)
|
||||
case 24:
|
||||
case 32:
|
||||
{
|
||||
uint32 *fb = (uint32 *)((uint8 *)_target->Bits() + top*bytes_per_row);
|
||||
uint32 *fb = (uint32 *)((uint8 *)fTarget->Bits() + top*bytes_per_row);
|
||||
rgb_color fill_color = color.GetColor32();
|
||||
uint32 color32 = (fill_color.alpha << 24) | (fill_color.red << 16) | (fill_color.green << 8) | (fill_color.blue);
|
||||
int x,y;
|
||||
@ -698,17 +745,17 @@ void BitmapDriver::FillSolidRect(const BRect &rect, const RGBColor &color)
|
||||
|
||||
void BitmapDriver::FillPatternRect(const BRect &rect, const DrawData *d)
|
||||
{
|
||||
int bytes_per_row = _target->BytesPerRow();
|
||||
int bytes_per_row = fTarget->BytesPerRow();
|
||||
int top = (int)rect.top;
|
||||
int left = (int)rect.left;
|
||||
int right = (int)rect.right;
|
||||
int bottom = (int)rect.bottom;
|
||||
|
||||
switch(_target->BitsPerPixel())
|
||||
switch(fTarget->BitsPerPixel())
|
||||
{
|
||||
case 8:
|
||||
{
|
||||
uint8 *fb = (uint8 *)_target->Bits() + top*bytes_per_row;
|
||||
uint8 *fb = (uint8 *)fTarget->Bits() + top*bytes_per_row;
|
||||
int x,y;
|
||||
for (y=top; y<=bottom; y++)
|
||||
{
|
||||
@ -719,7 +766,7 @@ void BitmapDriver::FillPatternRect(const BRect &rect, const DrawData *d)
|
||||
} break;
|
||||
case 15:
|
||||
{
|
||||
uint16 *fb = (uint16 *)((uint8 *)_target->Bits() + top*bytes_per_row);
|
||||
uint16 *fb = (uint16 *)((uint8 *)fTarget->Bits() + top*bytes_per_row);
|
||||
int x,y;
|
||||
for (y=top; y<=bottom; y++)
|
||||
{
|
||||
@ -730,7 +777,7 @@ void BitmapDriver::FillPatternRect(const BRect &rect, const DrawData *d)
|
||||
} break;
|
||||
case 16:
|
||||
{
|
||||
uint16 *fb = (uint16 *)((uint8 *)_target->Bits() + top*bytes_per_row);
|
||||
uint16 *fb = (uint16 *)((uint8 *)fTarget->Bits() + top*bytes_per_row);
|
||||
int x,y;
|
||||
for (y=top; y<=bottom; y++)
|
||||
{
|
||||
@ -742,7 +789,7 @@ void BitmapDriver::FillPatternRect(const BRect &rect, const DrawData *d)
|
||||
case 24:
|
||||
case 32:
|
||||
{
|
||||
uint32 *fb = (uint32 *)((uint8 *)_target->Bits() + top*bytes_per_row);
|
||||
uint32 *fb = (uint32 *)((uint8 *)fTarget->Bits() + top*bytes_per_row);
|
||||
int x,y;
|
||||
rgb_color color;
|
||||
for (y=top; y<=bottom; y++)
|
||||
@ -850,11 +897,11 @@ void BitmapDriver::CopyBitmap(ServerBitmap *bitmap, const BRect &sourcerect, con
|
||||
}
|
||||
|
||||
// Set pointers to the actual data
|
||||
uint8 *dest_bits = (uint8*) _target->Bits();
|
||||
uint8 *dest_bits = (uint8*) fTarget->Bits();
|
||||
uint8 *src_bits = (uint8*) bitmap->Bits();
|
||||
|
||||
// Get row widths for offset looping
|
||||
uint32 dest_width = uint32 (_target->BytesPerRow());
|
||||
uint32 dest_width = uint32 (fTarget->BytesPerRow());
|
||||
uint32 src_width = uint32 (bitmap->BytesPerRow());
|
||||
|
||||
// Offset bitmap pointers to proper spot in each bitmap
|
||||
@ -944,11 +991,11 @@ void BitmapDriver::CopyToBitmap(ServerBitmap *destbmp, const BRect &sourcerect)
|
||||
|
||||
// Set pointers to the actual data
|
||||
uint8 *dest_bits = (uint8*) destbmp->Bits();
|
||||
uint8 *src_bits = (uint8*) _target->Bits();
|
||||
uint8 *src_bits = (uint8*) fTarget->Bits();
|
||||
|
||||
// Get row widths for offset looping
|
||||
uint32 dest_width = uint32 (destbmp->BytesPerRow());
|
||||
uint32 src_width = uint32 (_target->BytesPerRow());
|
||||
uint32 src_width = uint32 (fTarget->BytesPerRow());
|
||||
|
||||
// Offset bitmap pointers to proper spot in each bitmap
|
||||
src_bits += uint32 ( (source.top * src_width) + (source.left * colorspace_size) );
|
||||
|
@ -39,6 +39,8 @@
|
||||
#include <OS.h>
|
||||
#include "DisplayDriver.h"
|
||||
#include "FontServer.h"
|
||||
#include "GraphicsBuffer.h"
|
||||
#include "PixelRenderer.h"
|
||||
|
||||
class ServerCursor;
|
||||
class ServerBitmap;
|
||||
@ -68,7 +70,7 @@ public:
|
||||
void Shutdown(void);
|
||||
|
||||
void SetTarget(ServerBitmap *target);
|
||||
ServerBitmap *GetTarget(void) const { return _target; }
|
||||
ServerBitmap *GetTarget(void) const { return fTarget; }
|
||||
|
||||
// Settings functions
|
||||
virtual void DrawBitmap(ServerBitmap *bmp, const BRect &src, const BRect &dest, DrawData *d);
|
||||
@ -96,7 +98,10 @@ protected:
|
||||
// void FillSolidRect(int32 left, int32 top, int32 right, int32 bottom);
|
||||
// void FillPatternRect(int32 left, int32 top, int32 right, int32 bottom);
|
||||
void SetThickPatternPixel(int x, int y);
|
||||
ServerBitmap *_target;
|
||||
|
||||
ServerBitmap *fTarget;
|
||||
GraphicsBuffer *fGraphicsBuffer;
|
||||
PixelRenderer *fPixelRenderer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -4041,7 +4041,6 @@ void DisplayDriver::FillPatternRect(const BRect &rect, const DrawData *d)
|
||||
/* Draws a line with pensize 1. Coordinates are guarenteed to be in bounds */
|
||||
void DisplayDriver::StrokeSolidLine(int32 x1, int32 y1, int32 x2, int32 y2, const RGBColor &color)
|
||||
{
|
||||
debugger("DD:StrokeSolidLine()\n");
|
||||
}
|
||||
|
||||
/* Draws a line with pensize 1. Coordinates are guarenteed to be in bounds */
|
||||
|
87
src/servers/app/server/GraphicsBuffer.cpp
Normal file
87
src/servers/app/server/GraphicsBuffer.cpp
Normal file
@ -0,0 +1,87 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: GraphicsBuffer.cpp
|
||||
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
||||
//
|
||||
// Description: Convenience class for working with graphics buffers
|
||||
// Based on concepts from the Anti-Grain Geometry vector gfx library
|
||||
//------------------------------------------------------------------------------
|
||||
#include "GraphicsBuffer.h"
|
||||
|
||||
GraphicsBuffer::GraphicsBuffer(uint8 *buffer, uint32 width, uint32 height, uint32 rowbytes)
|
||||
{
|
||||
fBuffer=NULL;
|
||||
fRowList=NULL;
|
||||
fWidth=0;
|
||||
fHeight=0;
|
||||
fBytesPerRow=0;
|
||||
fMaxHeight=0;
|
||||
|
||||
SetTo(buffer, width, height, rowbytes);
|
||||
}
|
||||
|
||||
GraphicsBuffer::~GraphicsBuffer()
|
||||
{
|
||||
delete [] fRowList;
|
||||
}
|
||||
|
||||
void GraphicsBuffer::SetTo(uint8 *buffer, uint32 width, uint32 height, uint32 rowbytes)
|
||||
{
|
||||
fBuffer = buffer;
|
||||
fWidth = width;
|
||||
fHeight = height;
|
||||
fBytesPerRow = rowbytes;
|
||||
|
||||
if(height > fMaxHeight)
|
||||
{
|
||||
delete [] fRowList;
|
||||
fRowList = new uint8* [fMaxHeight = height];
|
||||
}
|
||||
|
||||
uint8 *row_ptr = fBuffer;
|
||||
|
||||
if(rowbytes < 0)
|
||||
{
|
||||
row_ptr = fBuffer - int(height - 1) * rowbytes;
|
||||
}
|
||||
|
||||
uint8 **rows = fRowList;
|
||||
|
||||
while(height--)
|
||||
{
|
||||
*rows++ = row_ptr;
|
||||
row_ptr += rowbytes;
|
||||
}
|
||||
}
|
||||
|
||||
void GraphicsBuffer::Unset(void)
|
||||
{
|
||||
delete [] fRowList;
|
||||
fBuffer=NULL;
|
||||
fRowList=NULL;
|
||||
fWidth=0;
|
||||
fHeight=0;
|
||||
fBytesPerRow=0;
|
||||
fMaxHeight=0;
|
||||
}
|
||||
|
||||
|
115
src/servers/app/server/IPoint.cpp
Normal file
115
src/servers/app/server/IPoint.cpp
Normal file
@ -0,0 +1,115 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: IPoint.h
|
||||
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
||||
// Based on BPoint code by Frans Van Nispen
|
||||
// Description: Integer BPoint class
|
||||
//------------------------------------------------------------------------------
|
||||
#include "IPoint.h"
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <Rect.h>
|
||||
|
||||
void IPoint::ConstrainTo(BRect r)
|
||||
{
|
||||
x = (int32)max_c(min_c(x, r.right), r.left);
|
||||
y = (int32)max_c(min_c(y, r.bottom), r.top);
|
||||
}
|
||||
|
||||
void IPoint::PrintToStream() const
|
||||
{
|
||||
printf("IPoint(x:%ld, y:%ld)\n", x, y);
|
||||
}
|
||||
|
||||
IPoint IPoint::operator+(const IPoint &p) const
|
||||
{
|
||||
return IPoint(x + p.x, y + p.y);
|
||||
}
|
||||
|
||||
IPoint IPoint::operator+(const BPoint &p) const
|
||||
{
|
||||
return IPoint(x + (int32)p.x, y + (int32)p.y);
|
||||
}
|
||||
|
||||
IPoint IPoint::operator-(const IPoint &p) const
|
||||
{
|
||||
return IPoint(x - p.x, y - p.y);
|
||||
}
|
||||
|
||||
IPoint IPoint::operator-(const BPoint &p) const
|
||||
{
|
||||
return IPoint(x - (int32)p.x, y - (int32)p.y);
|
||||
}
|
||||
|
||||
IPoint &IPoint::operator+=(const IPoint &p)
|
||||
{
|
||||
x += p.x;
|
||||
y += p.y;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
IPoint &IPoint::operator+=(const BPoint &p)
|
||||
{
|
||||
x += (int32)p.x;
|
||||
y += (int32)p.y;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
IPoint &IPoint::operator-=(const IPoint &p)
|
||||
{
|
||||
x -= p.x;
|
||||
y -= p.y;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
IPoint &IPoint::operator-=(const BPoint &p)
|
||||
{
|
||||
x -= (int32)p.x;
|
||||
y -= (int32)p.y;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool IPoint::operator!=(const IPoint &p) const
|
||||
{
|
||||
return x != p.x || y != p.y;
|
||||
}
|
||||
|
||||
bool IPoint::operator!=(const BPoint &p) const
|
||||
{
|
||||
return x != (int32)p.x || y != (int32)p.y;
|
||||
}
|
||||
|
||||
bool IPoint::operator==(const IPoint &p) const
|
||||
{
|
||||
return x == p.x && y == p.y;
|
||||
}
|
||||
|
||||
bool IPoint::operator==(const BPoint &p) const
|
||||
{
|
||||
return x == (int32)p.x && y == (int32)p.y;
|
||||
}
|
||||
|
||||
|
@ -17,8 +17,11 @@ SharedLibrary appserver :
|
||||
DisplayDriver.cpp
|
||||
DisplaySupport.cpp
|
||||
FontFamily.cpp
|
||||
GraphicsBuffer.cpp
|
||||
IPoint.cpp
|
||||
LayerData.cpp
|
||||
PatternHandler.cpp
|
||||
PixelRenderer.cpp
|
||||
RectUtils.cpp
|
||||
RGBColor.cpp
|
||||
ServerBitmap.cpp
|
||||
|
278
src/servers/app/server/PixelRenderer.cpp
Normal file
278
src/servers/app/server/PixelRenderer.cpp
Normal file
@ -0,0 +1,278 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: PixelRenderer.h
|
||||
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
||||
//
|
||||
// Description: Base class for pixel plotting renderers
|
||||
// Based on concepts from the Anti-Grain Geometry vector gfx library
|
||||
//------------------------------------------------------------------------------
|
||||
#include "PixelRenderer.h"
|
||||
#include <string.h>
|
||||
#include "IPoint.h"
|
||||
|
||||
PixelRenderer::PixelRenderer(GraphicsBuffer &buffer)
|
||||
{
|
||||
fBuffer=&buffer;
|
||||
}
|
||||
|
||||
PixelRenderer::~PixelRenderer(void)
|
||||
{
|
||||
}
|
||||
|
||||
RGBColor PixelRenderer::GetPixel(const IPoint &pt)
|
||||
{
|
||||
RGBColor c(0,0,0,0);
|
||||
return c;
|
||||
}
|
||||
|
||||
void PixelRenderer::PixelRenderer::PutPixel(const IPoint &pt, RGBColor &c)
|
||||
{
|
||||
}
|
||||
|
||||
void PixelRenderer::PutHLine(const IPoint &pt, const uint32 length, RGBColor &c)
|
||||
{
|
||||
}
|
||||
|
||||
void PixelRenderer::PutVLine(const IPoint &pt, const uint32 length, RGBColor &c)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
//
|
||||
// PixelRendererRGBA32: 32-Bit color handler
|
||||
//
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
PixelRendererRGBA32::PixelRendererRGBA32(GraphicsBuffer &buffer)
|
||||
: PixelRenderer(buffer)
|
||||
{
|
||||
}
|
||||
|
||||
PixelRendererRGBA32::~PixelRendererRGBA32(void)
|
||||
{
|
||||
}
|
||||
|
||||
RGBColor PixelRendererRGBA32::GetPixel(const IPoint &pt)
|
||||
{
|
||||
uint8 *pixel=GetBuffer()->RowAt(pt.y) + (pt.x << 2);
|
||||
return RGBColor(pixel[2],pixel[1],pixel[0],pixel[3]);
|
||||
}
|
||||
|
||||
void PixelRendererRGBA32::PutPixel(const IPoint &pt, RGBColor &color)
|
||||
{
|
||||
rgb_color c=color.GetColor32();
|
||||
|
||||
uint8 *pixel=GetBuffer()->RowAt(pt.y) + (pt.x << 2);
|
||||
|
||||
pixel[0]=c.blue;
|
||||
pixel[1]=c.green;
|
||||
pixel[2]=c.red;
|
||||
pixel[3]=c.alpha;
|
||||
}
|
||||
|
||||
void PixelRendererRGBA32::PutHLine(const IPoint &pt, const uint32 length, RGBColor &color)
|
||||
{
|
||||
rgb_color c=color.GetColor32();
|
||||
|
||||
uint32 *pixel32=(uint32*)GetBuffer()->RowAt(pt.y);
|
||||
uint8 *pixel=(uint8*)&(pixel32[pt.x]);
|
||||
|
||||
pixel[0]=c.blue;
|
||||
pixel[1]=c.green;
|
||||
pixel[2]=c.red;
|
||||
pixel[3]=c.alpha;
|
||||
int32 color32=*pixel32;
|
||||
|
||||
uint32 end=pt.x+length;
|
||||
|
||||
for(uint32 i=pt.x+1; i<end; i++)
|
||||
pixel32[i]=color32;
|
||||
}
|
||||
|
||||
void PixelRendererRGBA32::PutVLine(const IPoint &pt, const uint32 length, RGBColor &color)
|
||||
{
|
||||
rgb_color c=color.GetColor32();
|
||||
|
||||
uint32 *pixel32=(uint32*)GetBuffer()->RowAt(pt.y);
|
||||
uint8 *pixel=(uint8*)&(pixel32[pt.x]);
|
||||
|
||||
pixel[0]=c.blue;
|
||||
pixel[1]=c.green;
|
||||
pixel[2]=c.red;
|
||||
pixel[3]=c.alpha;
|
||||
int32 color32=*pixel32;
|
||||
|
||||
uint32 end=pt.y+length;
|
||||
|
||||
for(uint32 i=pt.y+1; i<end; i++)
|
||||
{
|
||||
pixel32=(uint32*)GetBuffer()->RowAt(i);
|
||||
pixel32[pt.x]=color32;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
//
|
||||
// PixelRendererRGB16: 16-Bit color handler -- 565 space
|
||||
//
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
PixelRendererRGB16::PixelRendererRGB16(GraphicsBuffer &buffer)
|
||||
: PixelRenderer(buffer)
|
||||
{
|
||||
}
|
||||
|
||||
PixelRendererRGB16::~PixelRendererRGB16(void)
|
||||
{
|
||||
}
|
||||
|
||||
// TODO: Double check the values in RGB16 renderer to make sure they are correct for little endian
|
||||
|
||||
RGBColor PixelRendererRGB16::GetPixel(const IPoint &pt)
|
||||
{
|
||||
uint16 pixel=((uint16*)GetBuffer()->RowAt(pt.y))[pt.x];
|
||||
return RGBColor( (pixel<<3) & 248, (pixel>>3) & 252, (pixel>>8) & 248);
|
||||
}
|
||||
|
||||
void PixelRendererRGB16::PutPixel(const IPoint &pt, RGBColor &c)
|
||||
{
|
||||
((uint16*)GetBuffer()->RowAt(pt.y))[pt.x]=c.GetColor16();
|
||||
}
|
||||
|
||||
void PixelRendererRGB16::PutHLine(const IPoint &pt, const uint32 length, RGBColor &color)
|
||||
{
|
||||
uint16 *pixel16=(uint16*)GetBuffer()->RowAt(pt.y);
|
||||
uint32 end=pt.x+length;
|
||||
|
||||
for(uint32 i=pt.x; i<end; i++)
|
||||
pixel16[i]=color.GetColor16();
|
||||
}
|
||||
|
||||
void PixelRendererRGB16::PutVLine(const IPoint &pt, const uint32 length, RGBColor &color)
|
||||
{
|
||||
uint32 end=pt.y+length;
|
||||
uint16 *index;
|
||||
|
||||
for(uint32 i=pt.y; i<end; i++)
|
||||
{
|
||||
index=(uint16*)GetBuffer()->RowAt(i);
|
||||
index[pt.x]=color.GetColor16();
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
//
|
||||
// PixelRendererRGBA15: 15-Bit color handler -- 5551 space
|
||||
//
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
PixelRendererRGBA15::PixelRendererRGBA15(GraphicsBuffer &buffer)
|
||||
: PixelRenderer(buffer)
|
||||
{
|
||||
}
|
||||
|
||||
PixelRendererRGBA15::~PixelRendererRGBA15(void)
|
||||
{
|
||||
}
|
||||
|
||||
// TODO: Double check the values in RGBA15 renderer to make sure they are correct for little endian
|
||||
|
||||
RGBColor PixelRendererRGBA15::GetPixel(const IPoint &pt)
|
||||
{
|
||||
uint16 pixel=((uint16*)GetBuffer()->RowAt(pt.y))[pt.x];
|
||||
return RGBColor( (pixel<<3) & 248,
|
||||
(pixel>>3) & 252,
|
||||
(pixel>>7) & 248,
|
||||
((pixel>>8) & 128)?255:0 );
|
||||
}
|
||||
|
||||
void PixelRendererRGBA15::PutPixel(const IPoint &pt, RGBColor &color)
|
||||
{
|
||||
((uint16*)GetBuffer()->RowAt(pt.y))[pt.x]=color.GetColor15();
|
||||
}
|
||||
|
||||
void PixelRendererRGBA15::PutHLine(const IPoint &pt, const uint32 length, RGBColor &color)
|
||||
{
|
||||
uint16 *pixel16=(uint16*)GetBuffer()->RowAt(pt.y);
|
||||
uint32 end=pt.x+length;
|
||||
|
||||
for(uint32 i=pt.x; i<end; i++)
|
||||
pixel16[i]=color.GetColor15();
|
||||
}
|
||||
|
||||
void PixelRendererRGBA15::PutVLine(const IPoint &pt, const uint32 length, RGBColor &color)
|
||||
{
|
||||
uint32 end=pt.y+length;
|
||||
uint16 *index;
|
||||
|
||||
for(uint32 i=pt.y; i<end; i++)
|
||||
{
|
||||
index=(uint16*)GetBuffer()->RowAt(i);
|
||||
index[pt.x]=color.GetColor15();
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
//
|
||||
// PixelRendererCMAP8: 8-Bit color handler
|
||||
//
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
PixelRendererCMAP8::PixelRendererCMAP8(GraphicsBuffer &buffer)
|
||||
: PixelRenderer(buffer)
|
||||
{
|
||||
}
|
||||
|
||||
PixelRendererCMAP8::~PixelRendererCMAP8(void)
|
||||
{
|
||||
}
|
||||
|
||||
// TODO: Double check the values in CMAP8 renderer to make sure they are correct for little endian
|
||||
|
||||
RGBColor PixelRendererCMAP8::GetPixel(const IPoint &pt)
|
||||
{
|
||||
uint8 pixel=((uint8*)GetBuffer()->RowAt(pt.y))[pt.x];
|
||||
return RGBColor(pixel);
|
||||
}
|
||||
|
||||
void PixelRendererCMAP8::PutPixel(const IPoint &pt, RGBColor &color)
|
||||
{
|
||||
(GetBuffer()->RowAt(pt.y))[pt.x]=color.GetColor8();
|
||||
}
|
||||
|
||||
void PixelRendererCMAP8::PutHLine(const IPoint &pt, const uint32 length, RGBColor &color)
|
||||
{
|
||||
uint8 *index=GetBuffer()->RowAt(pt.y)+pt.x;
|
||||
memset(index,color.GetColor8(),length);
|
||||
}
|
||||
|
||||
void PixelRendererCMAP8::PutVLine(const IPoint &pt, const uint32 length, RGBColor &color)
|
||||
{
|
||||
uint8 *index=GetBuffer()->RowAt(pt.y)+pt.x;
|
||||
uint32 end=pt.y+length;
|
||||
|
||||
for(uint32 i=pt.y; i<end; i++)
|
||||
{
|
||||
*index=color.GetColor8();
|
||||
index+=GetBuffer()->BytesPerRow();
|
||||
}
|
||||
}
|
@ -54,7 +54,7 @@
|
||||
#include "LayerData.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#define DEBUG_SERVERAPP
|
||||
//#define DEBUG_SERVERAPP
|
||||
|
||||
#ifdef DEBUG_SERVERAPP
|
||||
# include <stdio.h>
|
||||
|
@ -35,7 +35,94 @@
|
||||
|
||||
Whenever the system's color palette is referenced, this is the variable used.
|
||||
*/
|
||||
rgb_color system_palette[256];
|
||||
const rgb_color system_palette[] = {
|
||||
{ 0, 0, 0, 255 }, { 8, 8, 8, 255 }, { 16, 16, 16, 255 },
|
||||
{ 24, 24, 24, 255 }, { 32, 32, 32, 255 }, { 40, 40, 40, 255 },
|
||||
{ 48, 48, 48, 255 }, { 56, 56, 56, 255 }, { 64, 64, 64, 255 },
|
||||
{ 72, 72, 72, 255 }, { 80, 80, 80, 255 }, { 88, 88, 88, 255 },
|
||||
{ 96, 96, 96, 255 }, { 104, 104, 104, 255 }, { 112, 112, 112, 255 },
|
||||
{ 120, 120, 120, 255 }, { 128, 128, 128, 255 }, { 136, 136, 136, 255 },
|
||||
{ 144, 144, 144, 255 }, { 152, 152, 152, 255 }, { 160, 160, 160, 255 },
|
||||
{ 168, 168, 168, 255 }, { 176, 176, 176, 255 }, { 184, 184, 184, 255 },
|
||||
{ 192, 192, 192, 255 }, { 200, 200, 200, 255 }, { 208, 208, 208, 255 },
|
||||
{ 216, 216, 216, 255 }, { 224, 224, 224, 255 }, { 232, 232, 232, 255 },
|
||||
{ 240, 240, 240, 255 }, { 248, 248, 248, 255 }, { 0, 0, 255, 255 },
|
||||
{ 0, 0, 229, 255 }, { 0, 0, 204, 255 }, { 0, 0, 179, 255 },
|
||||
{ 0, 0, 154, 255 }, { 0, 0, 129, 255 }, { 0, 0, 105, 255 },
|
||||
{ 0, 0, 80, 255 }, { 0, 0, 55, 255 }, { 0, 0, 30, 255 },
|
||||
{ 255, 0, 0, 255 }, { 228, 0, 0, 255 }, { 203, 0, 0, 255 },
|
||||
{ 178, 0, 0, 255 }, { 153, 0, 0, 255 }, { 128, 0, 0, 255 },
|
||||
{ 105, 0, 0, 255 }, { 80, 0, 0, 255 }, { 55, 0, 0, 255 },
|
||||
{ 30, 0, 0, 255 }, { 0, 255, 0, 255 }, { 0, 228, 0, 255 },
|
||||
{ 0, 203, 0, 255 }, { 0, 178, 0, 255 }, { 0, 153, 0, 255 },
|
||||
{ 0, 128, 0, 255 }, { 0, 105, 0, 255 }, { 0, 80, 0, 255 },
|
||||
{ 0, 55, 0, 255 }, { 0, 30, 0, 255 }, { 0, 152, 51, 255 },
|
||||
{ 255, 255, 255, 255 }, { 203, 255, 255, 255 }, { 203, 255, 203, 255 },
|
||||
{ 203, 255, 152, 255 }, { 203, 255, 102, 255 }, { 203, 255, 51, 255 },
|
||||
{ 203, 255, 0, 255 }, { 152, 255, 255, 255 }, { 152, 255, 203, 255 },
|
||||
{ 152, 255, 152, 255 }, { 152, 255, 102, 255 }, { 152, 255, 51, 255 },
|
||||
{ 152, 255, 0, 255 }, { 102, 255, 255, 255 }, { 102, 255, 203, 255 },
|
||||
{ 102, 255, 152, 255 }, { 102, 255, 102, 255 }, { 102, 255, 51, 255 },
|
||||
{ 102, 255, 0, 255 }, { 51, 255, 255, 255 }, { 51, 255, 203, 255 },
|
||||
{ 51, 255, 152, 255 }, { 51, 255, 102, 255 }, { 51, 255, 51, 255 },
|
||||
{ 51, 255, 0, 255 }, { 255, 152, 255, 255 }, { 255, 152, 203, 255 },
|
||||
{ 255, 152, 152, 255 }, { 255, 152, 102, 255 }, { 255, 152, 51, 255 },
|
||||
{ 255, 152, 0, 255 }, { 0, 102, 255, 255 }, { 0, 102, 203, 255 },
|
||||
{ 203, 203, 255, 255 }, { 203, 203, 203, 255 }, { 203, 203, 152, 255 },
|
||||
{ 203, 203, 102, 255 }, { 203, 203, 51, 255 }, { 203, 203, 0, 255 },
|
||||
{ 152, 203, 255, 255 }, { 152, 203, 203, 255 }, { 152, 203, 152, 255 },
|
||||
{ 152, 203, 102, 255 }, { 152, 203, 51, 255 }, { 152, 203, 0, 255 },
|
||||
{ 102, 203, 255, 255 }, { 102, 203, 203, 255 }, { 102, 203, 152, 255 },
|
||||
{ 102, 203, 102, 255 }, { 102, 203, 51, 255 }, { 102, 203, 0, 255 },
|
||||
{ 51, 203, 255, 255 }, { 51, 203, 203, 255 }, { 51, 203, 152, 255 },
|
||||
{ 51, 203, 102, 255 }, { 51, 203, 51, 255 }, { 51, 203, 0, 255 },
|
||||
{ 255, 102, 255, 255 }, { 255, 102, 203, 255 }, { 255, 102, 152, 255 },
|
||||
{ 255, 102, 102, 255 }, { 255, 102, 51, 255 }, { 255, 102, 0, 255 },
|
||||
{ 0, 102, 152, 255 }, { 0, 102, 102, 255 }, { 203, 152, 255, 255 },
|
||||
{ 203, 152, 203, 255 }, { 203, 152, 152, 255 }, { 203, 152, 102, 255 },
|
||||
{ 203, 152, 51, 255 }, { 203, 152, 0, 255 }, { 152, 152, 255, 255 },
|
||||
{ 152, 152, 203, 255 }, { 152, 152, 152, 255 }, { 152, 152, 102, 255 },
|
||||
{ 152, 152, 51, 255 }, { 152, 152, 0, 255 }, { 102, 152, 255, 255 },
|
||||
{ 102, 152, 203, 255 }, { 102, 152, 152, 255 }, { 102, 152, 102, 255 },
|
||||
{ 102, 152, 51, 255 }, { 102, 152, 0, 255 }, { 51, 152, 255, 255 },
|
||||
{ 51, 152, 203, 255 }, { 51, 152, 152, 255 }, { 51, 152, 102, 255 },
|
||||
{ 51, 152, 51, 255 }, { 51, 152, 0, 255 }, { 230, 134, 0, 255 },
|
||||
{ 255, 51, 203, 255 }, { 255, 51, 152, 255 }, { 255, 51, 102, 255 },
|
||||
{ 255, 51, 51, 255 }, { 255, 51, 0, 255 }, { 0, 102, 51, 255 },
|
||||
{ 0, 102, 0, 255 }, { 203, 102, 255, 255 }, { 203, 102, 203, 255 },
|
||||
{ 203, 102, 152, 255 }, { 203, 102, 102, 255 }, { 203, 102, 51, 255 },
|
||||
{ 203, 102, 0, 255 }, { 152, 102, 255, 255 }, { 152, 102, 203, 255 },
|
||||
{ 152, 102, 152, 255 }, { 152, 102, 102, 255 }, { 152, 102, 51, 255 },
|
||||
{ 152, 102, 0, 255 }, { 102, 102, 255, 255 }, { 102, 102, 203, 255 },
|
||||
{ 102, 102, 152, 255 }, { 102, 102, 102, 255 }, { 102, 102, 51, 255 },
|
||||
{ 102, 102, 0, 255 }, { 51, 102, 255, 255 }, { 51, 102, 203, 255 },
|
||||
{ 51, 102, 152, 255 }, { 51, 102, 102, 255 }, { 51, 102, 51, 255 },
|
||||
{ 51, 102, 0, 255 }, { 255, 0, 255, 255 }, { 255, 0, 203, 255 },
|
||||
{ 255, 0, 152, 255 }, { 255, 0, 102, 255 }, { 255, 0, 51, 255 },
|
||||
{ 255, 175, 19, 255 }, { 0, 51, 255, 255 }, { 0, 51, 203, 255 },
|
||||
{ 203, 51, 255, 255 }, { 203, 51, 203, 255 }, { 203, 51, 152, 255 },
|
||||
{ 203, 51, 102, 255 }, { 203, 51, 51, 255 }, { 203, 51, 0, 255 },
|
||||
{ 152, 51, 255, 255 }, { 152, 51, 203, 255 }, { 152, 51, 152, 255 },
|
||||
{ 152, 51, 102, 255 }, { 152, 51, 51, 255 }, { 152, 51, 0, 255 },
|
||||
{ 102, 51, 255, 255 }, { 102, 51, 203, 255 }, { 102, 51, 152, 255 },
|
||||
{ 102, 51, 102, 255 }, { 102, 51, 51, 255 }, { 102, 51, 0, 255 },
|
||||
{ 51, 51, 255, 255 }, { 51, 51, 203, 255 }, { 51, 51, 152, 255 },
|
||||
{ 51, 51, 102, 255 }, { 51, 51, 51, 255 }, { 51, 51, 0, 255 },
|
||||
{ 255, 203, 102, 255 }, { 255, 203, 152, 255 }, { 255, 203, 203, 255 },
|
||||
{ 255, 203, 255, 255 }, { 0, 51, 152, 255 }, { 0, 51, 102, 255 },
|
||||
{ 0, 51, 51, 255 }, { 0, 51, 0, 255 }, { 203, 0, 255, 255 },
|
||||
{ 203, 0, 203, 255 }, { 203, 0, 152, 255 }, { 203, 0, 102, 255 },
|
||||
{ 203, 0, 51, 255 }, { 255, 227, 70, 255 }, { 152, 0, 255, 255 },
|
||||
{ 152, 0, 203, 255 }, { 152, 0, 152, 255 }, { 152, 0, 102, 255 },
|
||||
{ 152, 0, 51, 255 }, { 152, 0, 0, 255 }, { 102, 0, 255, 255 },
|
||||
{ 102, 0, 203, 255 }, { 102, 0, 152, 255 }, { 102, 0, 102, 255 },
|
||||
{ 102, 0, 51, 255 }, { 102, 0, 0, 255 }, { 51, 0, 255, 255 },
|
||||
{ 51, 0, 203, 255 }, { 51, 0, 152, 255 }, { 51, 0, 102, 255 },
|
||||
{ 51, 0, 51, 255 }, { 51, 0, 0, 255 }, { 255, 203, 51, 255 },
|
||||
{ 255, 203, 0, 255 }, { 255, 255, 0, 255 }, { 255, 255, 51, 255 },
|
||||
{ 255, 255, 102, 255 }, { 255, 255, 152, 255 }, { 255, 255, 203, 255 },
|
||||
{ 255, 255, 255, 255 }
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Takes a palette array and places the BeOS System palette in it.
|
||||
|
@ -113,3 +113,191 @@ BString MsgCodeToBString(int32 code)
|
||||
BString bstring(string);
|
||||
return bstring;
|
||||
}
|
||||
|
||||
status_t ConvertModeToDisplayMode(uint32 mode, display_mode *dmode)
|
||||
{
|
||||
if(!mode)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
switch(mode)
|
||||
{
|
||||
case B_8_BIT_640x400:
|
||||
{
|
||||
dmode->virtual_width=640;
|
||||
dmode->virtual_height=400;
|
||||
dmode->space=B_CMAP8;
|
||||
break;
|
||||
}
|
||||
case B_8_BIT_640x480:
|
||||
{
|
||||
dmode->virtual_width=640;
|
||||
dmode->virtual_height=480;
|
||||
dmode->space=B_CMAP8;
|
||||
break;
|
||||
}
|
||||
case B_15_BIT_640x480:
|
||||
{
|
||||
dmode->virtual_width=640;
|
||||
dmode->virtual_height=480;
|
||||
dmode->space=B_RGB15;
|
||||
break;
|
||||
}
|
||||
case B_16_BIT_640x480:
|
||||
{
|
||||
dmode->virtual_width=640;
|
||||
dmode->virtual_height=480;
|
||||
dmode->space=B_RGB16;
|
||||
break;
|
||||
}
|
||||
case B_32_BIT_640x480:
|
||||
{
|
||||
dmode->virtual_width=640;
|
||||
dmode->virtual_height=480;
|
||||
dmode->space=B_RGB32;
|
||||
break;
|
||||
}
|
||||
case B_8_BIT_800x600:
|
||||
{
|
||||
dmode->virtual_width=800;
|
||||
dmode->virtual_height=600;
|
||||
dmode->space=B_CMAP8;
|
||||
break;
|
||||
}
|
||||
case B_15_BIT_800x600:
|
||||
{
|
||||
dmode->virtual_width=800;
|
||||
dmode->virtual_height=600;
|
||||
dmode->space=B_RGB15;
|
||||
break;
|
||||
}
|
||||
case B_16_BIT_800x600:
|
||||
{
|
||||
dmode->virtual_width=800;
|
||||
dmode->virtual_height=600;
|
||||
dmode->space=B_RGB16;
|
||||
break;
|
||||
}
|
||||
case B_32_BIT_800x600:
|
||||
{
|
||||
dmode->virtual_width=800;
|
||||
dmode->virtual_height=600;
|
||||
dmode->space=B_RGB32;
|
||||
break;
|
||||
}
|
||||
case B_8_BIT_1024x768:
|
||||
{
|
||||
dmode->virtual_width=1024;
|
||||
dmode->virtual_height=768;
|
||||
dmode->space=B_CMAP8;
|
||||
break;
|
||||
}
|
||||
case B_15_BIT_1024x768:
|
||||
{
|
||||
dmode->virtual_width=1024;
|
||||
dmode->virtual_height=768;
|
||||
dmode->space=B_RGB15;
|
||||
break;
|
||||
}
|
||||
case B_16_BIT_1024x768:
|
||||
{
|
||||
dmode->virtual_width=1024;
|
||||
dmode->virtual_height=768;
|
||||
dmode->space=B_RGB16;
|
||||
break;
|
||||
}
|
||||
case B_32_BIT_1024x768:
|
||||
{
|
||||
dmode->virtual_width=1024;
|
||||
dmode->virtual_height=768;
|
||||
dmode->space=B_RGB32;
|
||||
break;
|
||||
}
|
||||
case B_8_BIT_1152x900:
|
||||
{
|
||||
dmode->virtual_width=1152;
|
||||
dmode->virtual_height=900;
|
||||
dmode->space=B_CMAP8;
|
||||
break;
|
||||
}
|
||||
case B_15_BIT_1152x900:
|
||||
{
|
||||
dmode->virtual_width=1152;
|
||||
dmode->virtual_height=900;
|
||||
dmode->space=B_RGB15;
|
||||
break;
|
||||
}
|
||||
case B_16_BIT_1152x900:
|
||||
{
|
||||
dmode->virtual_width=1152;
|
||||
dmode->virtual_height=900;
|
||||
dmode->space=B_RGB16;
|
||||
break;
|
||||
}
|
||||
case B_32_BIT_1152x900:
|
||||
{
|
||||
dmode->virtual_width=1152;
|
||||
dmode->virtual_height=900;
|
||||
dmode->space=B_RGB32;
|
||||
break;
|
||||
}
|
||||
case B_8_BIT_1280x1024:
|
||||
{
|
||||
dmode->virtual_width=1280;
|
||||
dmode->virtual_height=1024;
|
||||
dmode->space=B_CMAP8;
|
||||
break;
|
||||
}
|
||||
case B_15_BIT_1280x1024:
|
||||
{
|
||||
dmode->virtual_width=1280;
|
||||
dmode->virtual_height=1024;
|
||||
dmode->space=B_RGB15;
|
||||
break;
|
||||
}
|
||||
case B_16_BIT_1280x1024:
|
||||
{
|
||||
dmode->virtual_width=1280;
|
||||
dmode->virtual_height=1024;
|
||||
dmode->space=B_RGB16;
|
||||
break;
|
||||
}
|
||||
case B_32_BIT_1280x1024:
|
||||
{
|
||||
dmode->virtual_width=1280;
|
||||
dmode->virtual_height=1024;
|
||||
dmode->space=B_RGB32;
|
||||
break;
|
||||
}
|
||||
case B_8_BIT_1600x1200:
|
||||
{
|
||||
dmode->virtual_width=1600;
|
||||
dmode->virtual_height=1200;
|
||||
dmode->space=B_CMAP8;
|
||||
break;
|
||||
}
|
||||
case B_15_BIT_1600x1200:
|
||||
{
|
||||
dmode->virtual_width=1600;
|
||||
dmode->virtual_height=1200;
|
||||
dmode->space=B_RGB15;
|
||||
break;
|
||||
}
|
||||
case B_16_BIT_1600x1200:
|
||||
{
|
||||
dmode->virtual_width=1600;
|
||||
dmode->virtual_height=1200;
|
||||
dmode->space=B_RGB16;
|
||||
break;
|
||||
}
|
||||
case B_32_BIT_1600x1200:
|
||||
{
|
||||
dmode->virtual_width=1600;
|
||||
dmode->virtual_height=1200;
|
||||
dmode->space=B_RGB32;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return B_ERROR;
|
||||
}
|
||||
return B_OK;
|
||||
}
|
||||
|
@ -29,9 +29,11 @@
|
||||
|
||||
#include <Message.h>
|
||||
#include <OS.h>
|
||||
#include <Accelerant.h>
|
||||
|
||||
void SendMessage(port_id port, BMessage *message, int32 target=-1);
|
||||
const char *MsgCodeToString(int32 code);
|
||||
BString MsgCodeToBString(int32 code);
|
||||
status_t ConvertModeToDisplayMode(uint32 mode, display_mode *dmode);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user