as a first step, all appearently unused calls are commented outfrom DisplayDriver and derived classes

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11981 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2005-03-25 13:15:33 +00:00
parent f595ecf898
commit f3b44aede9

View File

@ -22,14 +22,16 @@
// File Name: DisplayDriver.h
// Author: DarkWyrm <bpmagic@columbus.rr.com>
// Gabe Yoder <gyoder@stny.rr.com>
// Stephan Aßmus <superstippi@gmx.de>
//
// Description: Mostly abstract class which handles all graphics output
// Description: Abstract class which handles all graphics output
// for the server
//
//------------------------------------------------------------------------------
#ifndef _DISPLAY_DRIVER_H_
#define _DISPLAY_DRIVER_H_
#include <Accelerant.h>
#include <OS.h>
@ -48,12 +50,13 @@
#include <ft2build.h>
#include FT_FREETYPE_H
class ServerCursor;
#ifndef ROUND
#define ROUND(a) ( (long)(a+.5) )
#endif
class ServerCursor;
/*!
\brief Data structure for passing cursor information to hardware drivers.
*/
@ -114,162 +117,387 @@ typedef void (DisplayDriver::* SetRectangleFuncType)(int left, int top, int righ
do very little, so implementing them all more or less required.
*/
class DisplayDriver
{
public:
DisplayDriver(void);
virtual ~DisplayDriver(void);
class DisplayDriver {
public:
DisplayDriver();
virtual ~DisplayDriver();
// Graphics calls implemented in DisplayDriver
void CopyBits(const BRect &src, const BRect &dest, const DrawData *d);
void CopyRegion(BRegion *src, const BPoint &lefttop);
void DrawBitmap(ServerBitmap *bitmap, const BRect &source, const BRect &dest, const DrawData *d);
void DrawBitmap(BRegion *region, ServerBitmap *bitmap, const BRect &source, const BRect &dest, const DrawData *d);
// one more:
void CopyRegionList(BList* list, BList* pList, int32 rCount, BRegion* clipReg);
virtual void CopyBits( const BRect &src,
const BRect &dest,
const DrawData *d);
void FillArc(const BRect &r, const float &angle, const float &span, const RGBColor &color);
void FillArc(const BRect &r, const float &angle, const float &span, const DrawData *d);
void FillBezier(BPoint *pts, const RGBColor &color);
void FillBezier(BPoint *pts, const DrawData *d);
void FillEllipse(const BRect &r, const RGBColor &color);
void FillEllipse(const BRect &r, const DrawData *d);
void FillPolygon(BPoint *ptlist, int32 numpts, const BRect &bounds, const RGBColor &color);
void FillPolygon(BPoint *ptlist, int32 numpts, const BRect &bounds, const DrawData *d);
void FillRect(const BRect &r, const RGBColor &color);
void FillRect(const BRect &r, const DrawData *d);
void FillRegion(BRegion &r, const RGBColor &color);
void FillRegion(BRegion &r, const DrawData *d);
void FillRoundRect(const BRect &r, const float &xrad, const float &yrad, const RGBColor &color);
void FillRoundRect(const BRect &r, const float &xrad, const float &yrad, const DrawData *d);
void FillShape(const BRect &bounds, const int32 &opcount, const int32 *oplist,
const int32 &ptcount, const BPoint *ptlist, const DrawData *d);
void FillTriangle(BPoint *pts, const BRect &bounds, const RGBColor &color);
void FillTriangle(BPoint *pts, const BRect &bounds, const DrawData *d);
virtual void CopyRegion( BRegion *src,
const BPoint &lefttop);
void HideCursor(void);
bool IsCursorHidden(void);
void MoveCursorTo(const float &x, const float &y);
void ShowCursor(void);
void ObscureCursor(void);
void SetCursor(ServerCursor *cursor);
BPoint GetCursorPosition(void);
virtual void InvertRect( const BRect &r);
void StrokeArc(const BRect &r, const float &angle, const float &span, const RGBColor &color);
void StrokeArc(const BRect &r, const float &angle, const float &span, const DrawData *d);
void StrokeBezier(BPoint *pts, const RGBColor &color);
void StrokeBezier(BPoint *pts, const DrawData *d);
void StrokeEllipse(const BRect &r, const RGBColor &color);
void StrokeEllipse(const BRect &r, const DrawData *d);
void StrokeLine(const BPoint &start, const BPoint &end, const RGBColor &color);
void StrokeLine(const BPoint &start, const BPoint &end, const DrawData *d);
void StrokePoint(const BPoint &pt, const RGBColor &color);
void StrokePoint(const BPoint &pt, const DrawData *d);
void StrokePolygon(BPoint *ptlist, int32 numpts, const BRect &bounds, const RGBColor &color, bool is_closed=true);
void StrokePolygon(BPoint *ptlist, int32 numpts, const BRect &bounds, const DrawData *d, bool is_closed=true);
void StrokeRect(const BRect &r, const RGBColor &color);
void StrokeRect(const BRect &r, const DrawData *d);
void StrokeRegion(BRegion &r, const RGBColor &color);
void StrokeRegion(BRegion &r, const DrawData *d);
void StrokeRoundRect(const BRect &r, const float &xrad, const float &yrad, const RGBColor &color);
void StrokeRoundRect(const BRect &r, const float &xrad, const float &yrad, const DrawData *d);
void StrokeShape(const BRect &bounds, const int32 &opcount, const int32 *oplist,
const int32 &ptcount, const BPoint *ptlist, const DrawData *d);
void StrokeTriangle(BPoint *pts, const BRect &bounds, const RGBColor &color);
void StrokeTriangle(BPoint *pts, const BRect &bounds, const DrawData *d);
virtual void DrawBitmap( BRegion *region,
ServerBitmap *bitmap,
const BRect &source,
const BRect &dest,
const DrawData *d);
/* virtual void DrawBitmap( ServerBitmap *bitmap,
const BRect &source,
const BRect &dest,
const DrawData *d);*/
virtual void CopyRegionList( BList* list,
BList* pList,
int32 rCount,
BRegion* clipReg);
/* virtual void FillArc( const BRect &r,
const float &angle,
const float &span,
const RGBColor &color);*/
virtual void FillArc( const BRect &r,
const float &angle,
const float &span,
const DrawData *d);
/* virtual void FillBezier( BPoint *pts,
const RGBColor &color);*/
virtual void FillBezier( BPoint *pts,
const DrawData *d);
/* virtual void FillEllipse( const BRect &r,
const RGBColor &color);*/
virtual void FillEllipse( const BRect &r,
const DrawData *d);
/* virtual void FillPolygon( BPoint *ptlist,
int32 numpts,
const BRect &bounds,
const RGBColor &color);*/
virtual void FillPolygon( BPoint *ptlist,
int32 numpts,
const BRect &bounds,
const DrawData *d);
virtual void FillRect( const BRect &r,
const RGBColor &color);
virtual void FillRect( const BRect &r,
const DrawData *d);
/* virtual void FillRegion( BRegion &r,
const RGBColor &color);*/
virtual void FillRegion( BRegion &r,
const DrawData *d);
/* virtual void FillRoundRect( const BRect &r,
const float &xrad,
const float &yrad,
const RGBColor &color);*/
virtual void FillRoundRect( const BRect &r,
const float &xrad,
const float &yrad,
const DrawData *d);
virtual void FillShape( const BRect &bounds,
const int32 &opcount,
const int32 *oplist,
const int32 &ptcount,
const BPoint *ptlist,
const DrawData *d);
/* virtual void FillTriangle( BPoint *pts,
const BRect &bounds,
const RGBColor &color);*/
virtual void FillTriangle( BPoint *pts,
const BRect &bounds,
const DrawData *d);
/* virtual void StrokeArc( const BRect &r,
const float &angle,
const float &span,
const RGBColor &color);*/
virtual void StrokeArc( const BRect &r,
const float &angle,
const float &span,
const DrawData *d);
/* virtual void StrokeBezier( BPoint *pts,
const RGBColor &color);*/
virtual void StrokeBezier( BPoint *pts,
const DrawData *d);
/* virtual void StrokeEllipse( const BRect &r,
const RGBColor &color);*/
virtual void StrokeEllipse( const BRect &r,
const DrawData *d);
// this version used by Decorator
virtual void StrokeLine( const BPoint &start,
const BPoint &end,
const RGBColor &color);
virtual void StrokeLine( const BPoint &start,
const BPoint &end,
const DrawData *d);
// this version used by Decorator
virtual void StrokePoint( const BPoint &pt,
const RGBColor &color);
virtual void StrokePoint( const BPoint &pt,
const DrawData *d);
/* virtual void StrokePolygon( BPoint *ptlist,
int32 numpts,
const BRect &bounds,
const RGBColor &color,
bool is_closed=true);*/
virtual void StrokePolygon( BPoint *ptlist,
int32 numpts,
const BRect &bounds,
const DrawData *d,
bool is_closed=true);
// this version used by Decorator
virtual void StrokeRect( const BRect &r,
const RGBColor &color);
virtual void StrokeRect( const BRect &r,
const DrawData *d);
/* virtual void StrokeRegion( BRegion &r,
const RGBColor &color);*/
virtual void StrokeRegion( BRegion &r,
const DrawData *d);
/* virtual void StrokeRoundRect(const BRect &r,
const float &xrad,
const float &yrad,
const RGBColor &color);*/
virtual void StrokeRoundRect(const BRect &r,
const float &xrad,
const float &yrad,
const DrawData *d);
virtual void StrokeShape( const BRect &bounds,
const int32 &opcount,
const int32 *oplist,
const int32 &ptcount,
const BPoint *ptlist,
const DrawData *d);
/* virtual void StrokeTriangle( BPoint *pts,
const BRect &bounds,
const RGBColor &color);*/
virtual void StrokeTriangle( BPoint *pts,
const BRect &bounds,
const DrawData *d);
void GetMode(display_mode *mode);
// Font-related calls
// DrawData is NOT const because this call updates the pen position in the passed DrawData
void DrawString(const char *string, const int32 &length, const BPoint &pt, DrawData *d);
void DrawString(const char *string, const int32 &length, const BPoint &pt, const RGBColor &color, escapement_delta *delta=NULL);
virtual void DrawString(const char *string,
const int32 &length,
const BPoint &pt,
DrawData *d);
float StringWidth(const char *string, int32 length, const DrawData *d);
float StringHeight(const char *string, int32 length, const DrawData *d);
virtual void DrawString(const char *string,
const int32 &length,
const BPoint &pt,
const RGBColor &color,
escapement_delta *delta=NULL);
void GetBoundingBoxes(const char *string, int32 count, font_metric_mode mode,
escapement_delta *delta, BRect *rectarray, const DrawData *d);
void GetEscapements(const char *string, int32 charcount, escapement_delta *delta,
escapement_delta *escapements, escapement_delta *offsets, const DrawData *d);
void GetEdges(const char *string, int32 charcount, edge_info *edgearray, const DrawData *d);
void GetHasGlyphs(const char *string, int32 charcount, bool *hasarray);
void GetTruncatedStrings(const char **instrings, const int32 &stringcount, const uint32 &mode,
const float &maxwidth, char **outstrings);
virtual float StringWidth(const char *string,
int32 length,
const DrawData *d);
virtual float StringHeight(const char *string,
int32 length,
const DrawData *d);
virtual void GetBoundingBoxes(const char *string,
int32 count,
font_metric_mode mode,
escapement_delta *delta,
BRect *rectarray,
const DrawData *d);
virtual void GetEscapements(const char *string,
int32 charcount,
escapement_delta *delta,
escapement_delta *escapements,
escapement_delta *offsets,
const DrawData *d);
virtual void GetEdges(const char *string,
int32 charcount,
edge_info *edgearray,
const DrawData *d);
virtual void GetHasGlyphs(const char *string,
int32 charcount,
bool *hasarray);
virtual void GetTruncatedStrings(const char **instrings,
const int32 &stringcount,
const uint32 &mode,
const float &maxwidth,
char **outstrings);
bool IsCursorObscured(bool state);
virtual void HideCursor();
virtual bool IsCursorHidden();
virtual void MoveCursorTo(const float &x, const float &y);
virtual void ShowCursor();
virtual void ObscureCursor();
virtual void SetCursor(ServerCursor *cursor);
BPoint GetCursorPosition();
virtual bool IsCursorObscured(bool state);
// Virtual methods which need to be implemented by each subclass
virtual bool Initialize(void);
virtual void Shutdown(void);
virtual bool Initialize(void);
virtual void Shutdown(void);
// These two will rarely be implemented by subclasses, but it still needs to be possible
virtual bool Lock(bigtime_t timeout=B_INFINITE_TIMEOUT);
virtual void Unlock(void);
// These two will rarely be implemented by subclasses,
// but it still needs to be possible
virtual bool Lock(bigtime_t timeout = B_INFINITE_TIMEOUT);
virtual void Unlock(void);
virtual void SetMode(const display_mode &mode);
// display mode access
virtual void SetMode(const display_mode &mode);
virtual void GetMode( display_mode *mode);
virtual bool DumpToFile(const char *path);
virtual ServerBitmap *DumpToBitmap(void);
virtual void InvertRect(const BRect &r);
virtual void StrokeLineArray(const int32 &numlines, const LineArrayData *data, const DrawData *d);
virtual bool DumpToFile(const char *path);
virtual ServerBitmap* DumpToBitmap(void);
virtual status_t SetDPMSMode(const uint32 &state);
virtual uint32 DPMSMode(void) const;
virtual uint32 DPMSCapabilities(void) const;
virtual status_t GetDeviceInfo(accelerant_device_info *info);
virtual status_t GetModeList(display_mode **mode_list, uint32 *count);
virtual status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high);
virtual status_t GetTimingConstraints(display_timing_constraints *dtc);
virtual status_t ProposeMode(display_mode *candidate, const display_mode *low, const display_mode *high);
virtual status_t WaitForRetrace(bigtime_t timeout=B_INFINITE_TIMEOUT);
virtual void StrokeLineArray(const int32 &numlines,
const LineArrayData *data,
const DrawData *d);
virtual status_t SetDPMSMode(const uint32 &state);
virtual uint32 DPMSMode() const;
virtual uint32 DPMSCapabilities() const;
virtual status_t GetDeviceInfo(accelerant_device_info *info);
virtual status_t GetModeList(display_mode **mode_list,
uint32 *count);
virtual status_t GetPixelClockLimits(display_mode *mode,
uint32 *low,
uint32 *high);
virtual status_t GetTimingConstraints(display_timing_constraints *dtc);
virtual status_t ProposeMode(display_mode *candidate,
const display_mode *low,
const display_mode *high);
virtual status_t WaitForRetrace(bigtime_t timeout = B_INFINITE_TIMEOUT);
protected:
friend class Layer;
friend class WinBorder;
friend CursorHandler;
ServerCursor *_GetCursor(void);
virtual void HLinePatternThick(int32 x1, int32 x2, int32 y);
virtual void VLinePatternThick(int32 x, int32 y1, int32 y2);
// virtual void FillSolidRect(int32 left, int32 top, int32 right, int32 bottom);
// virtual void FillPatternRect(int32 left, int32 top, int32 right, int32 bottom);
virtual void SetThickPatternPixel(int x, int y);
ServerCursor* _GetCursor(void);
virtual void HLinePatternThick(int32 x1, int32 x2, int32 y);
virtual void VLinePatternThick(int32 x, int32 y1, int32 y2);
virtual void SetThickPatternPixel(int x, int y);
// Blit functions specific to FreeType2 glyph copying. These probably could be replaced with
// more generic functions, but these are written and can be replaced later.
void BlitMono2RGB32(FT_Bitmap *src, const BPoint &pt, const DrawData *d);
void BlitGray2RGB32(FT_Bitmap *src, const BPoint &pt, const DrawData *d);
// Blit functions specific to FreeType2 glyph copying.
// These probably could be replaced with more generic functions,
// but these are written and can be replaced later.
void BlitMono2RGB32(FT_Bitmap *src,
const BPoint &pt,
const DrawData *d);
void BlitGray2RGB32(FT_Bitmap *src,
const BPoint &pt,
const DrawData *d);
// Two functions for gaining direct access to the framebuffer of a child class. This removes the need
// for a set of glyph-blitting virtual functions for each driver.
virtual bool AcquireBuffer(FBBitmap *bmp);
virtual void ReleaseBuffer(void);
// Two functions for gaining direct access to the framebuffer
// of a child class. This removes the need for a set of
// glyph-blitting virtual functions for each driver.
virtual bool AcquireBuffer(FBBitmap *bmp);
virtual void ReleaseBuffer(void);
// This is for drivers which are internally double buffered and calling this will cause the real
// framebuffer to be updated
virtual void Invalidate(const BRect &r);
// This is for drivers which are internally double buffered
// and calling this will cause the real framebuffer to be updated
virtual void Invalidate(const BRect &r);
void FillBezier(BPoint *pts, DisplayDriver* driver, SetHorizontalLineFuncType setLine);
void FillRegion(BRegion &r, DisplayDriver* driver, SetRectangleFuncType setRect);
void StrokeArc(const BRect &r, const float &angle, const float &span, DisplayDriver* driver, SetPixelFuncType setPixel);
void StrokeBezier(BPoint *pts, DisplayDriver* driver, SetPixelFuncType setPixel);
void StrokeEllipse(const BRect &r, DisplayDriver* driver, SetPixelFuncType setPixel);
void StrokeLine(const BPoint &start, const BPoint &end, DisplayDriver* driver, SetPixelFuncType setPixel);
/* void FillBezier(BPoint *pts,
DisplayDriver* driver,
SetHorizontalLineFuncType setLine);
void FillRegion(BRegion &r,
DisplayDriver* driver,
SetRectangleFuncType setRect);
void StrokeArc(const BRect &r,
const float &angle,
const float &span,
DisplayDriver* driver,
SetPixelFuncType setPixel);
void StrokeBezier(BPoint *pts,
DisplayDriver* driver,
SetPixelFuncType setPixel);
void StrokeEllipse(const BRect &r,
DisplayDriver* driver,
SetPixelFuncType setPixel);
void StrokeLine(const BPoint &start,
const BPoint &end,
DisplayDriver* driver,
SetPixelFuncType setPixel);*/
// Support functions for the rest of the driver
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(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);
virtual void CopyToBitmap(ServerBitmap *target, const BRect &source);
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(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);
virtual void CopyToBitmap(ServerBitmap *target,
const BRect &source);
// temporarily virtual - until clipping code is added in DisplayDriver
virtual void ConstrainClippingRegion(BRegion *reg);
virtual void ConstrainClippingRegion(BRegion *reg);
PatternHandler fDrawPattern;
RGBColor fDrawColor;