step 3, exracted code from DisplayDriver into DisplayDriverImpl, adjusted the existing implementations to derive from the new class, got rid of some "friend" stuff along the way, essentially I made room for the new Painter based DisplayDriver implementation.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11987 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -28,6 +28,7 @@
|
|||||||
#define CURSORHANDLER_H
|
#define CURSORHANDLER_H
|
||||||
|
|
||||||
#include "GraphicsBuffer.h"
|
#include "GraphicsBuffer.h"
|
||||||
|
#include "LayerData.h"
|
||||||
#include "ServerCursor.h"
|
#include "ServerCursor.h"
|
||||||
#include "ServerBitmap.h"
|
#include "ServerBitmap.h"
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@ public:
|
|||||||
void SetCursor(ServerCursor *cursor);
|
void SetCursor(ServerCursor *cursor);
|
||||||
ServerCursor *GetCursor(void) const { return fCursor; }
|
ServerCursor *GetCursor(void) const { return fCursor; }
|
||||||
|
|
||||||
void MoveTo(const BPoint &pt);
|
void MoveTo(BPoint pt);
|
||||||
BPoint GetPosition(void) const { return fPosition.LeftTop(); }
|
BPoint GetPosition(void) const { return fPosition.LeftTop(); }
|
||||||
|
|
||||||
void Hide(void);
|
void Hide(void);
|
||||||
@@ -70,6 +71,7 @@ private:
|
|||||||
UtilityBitmap *fSavedData;
|
UtilityBitmap *fSavedData;
|
||||||
ServerCursor *fCursor;
|
ServerCursor *fCursor;
|
||||||
int8 fHideLevel;
|
int8 fHideLevel;
|
||||||
|
DrawData fDrawData;
|
||||||
|
|
||||||
bool fDriverHidden;
|
bool fDriverHidden;
|
||||||
bool fIsObscured;
|
bool fIsObscured;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
// File Name: DisplayDriver.h
|
// File Name: DisplayDriver.h
|
||||||
// Author: DarkWyrm <[email protected]>
|
// Authors: DarkWyrm <[email protected]>
|
||||||
// Gabe Yoder <[email protected]>
|
// Gabe Yoder <[email protected]>
|
||||||
// Stephan Aßmus <[email protected]>
|
// Stephan Aßmus <[email protected]>
|
||||||
//
|
//
|
||||||
@@ -31,42 +31,31 @@
|
|||||||
#ifndef _DISPLAY_DRIVER_H_
|
#ifndef _DISPLAY_DRIVER_H_
|
||||||
#define _DISPLAY_DRIVER_H_
|
#define _DISPLAY_DRIVER_H_
|
||||||
|
|
||||||
|
|
||||||
#include <Accelerant.h>
|
#include <Accelerant.h>
|
||||||
#include <OS.h>
|
|
||||||
|
|
||||||
#include <View.h>
|
|
||||||
#include <Font.h>
|
#include <Font.h>
|
||||||
#include <Rect.h>
|
|
||||||
#include <Locker.h>
|
#include <Locker.h>
|
||||||
#include <Screen.h>
|
|
||||||
#include "RGBColor.h"
|
|
||||||
#include <Region.h>
|
|
||||||
#include "PatternHandler.h"
|
|
||||||
#include "CursorHandler.h"
|
#include "CursorHandler.h"
|
||||||
#include "DisplaySupport.h"
|
|
||||||
#include "LayerData.h"
|
|
||||||
#include "ServerBitmap.h"
|
|
||||||
#include <ft2build.h>
|
|
||||||
#include FT_FREETYPE_H
|
|
||||||
|
|
||||||
#ifndef ROUND
|
|
||||||
#define ROUND(a) ( (long)(a+.5) )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
class BPoint;
|
||||||
|
class BRect;
|
||||||
|
class BRegion;
|
||||||
|
|
||||||
|
class DrawData;
|
||||||
|
class RGBColor;
|
||||||
|
class ServerBitmap;
|
||||||
class ServerCursor;
|
class ServerCursor;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Data structure for passing cursor information to hardware drivers.
|
\brief Data structure for passing cursor information to hardware drivers.
|
||||||
*/
|
*/
|
||||||
typedef struct
|
/*typedef struct
|
||||||
{
|
{
|
||||||
uchar *xormask, *andmask;
|
uchar *xormask, *andmask;
|
||||||
int32 width, height;
|
int32 width, height;
|
||||||
int32 hotx, hoty;
|
int32 hotx, hoty;
|
||||||
|
|
||||||
} cursor_data;
|
} cursor_data;*/
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -76,7 +65,7 @@ typedef struct
|
|||||||
|
|
||||||
} LineArrayData;
|
} LineArrayData;
|
||||||
|
|
||||||
|
/*
|
||||||
#ifndef HOOK_DEFINE_CURSOR
|
#ifndef HOOK_DEFINE_CURSOR
|
||||||
|
|
||||||
#define HOOK_DEFINE_CURSOR 0
|
#define HOOK_DEFINE_CURSOR 0
|
||||||
@@ -103,6 +92,7 @@ typedef void (DisplayDriver::* SetPixelFuncType)(int x, int y);
|
|||||||
typedef void (DisplayDriver::* SetHorizontalLineFuncType)(int xstart, int xend, int y);
|
typedef void (DisplayDriver::* SetHorizontalLineFuncType)(int xstart, int xend, int y);
|
||||||
typedef void (DisplayDriver::* SetVerticalLineFuncType)(int x, int ystart, int yend);
|
typedef void (DisplayDriver::* SetVerticalLineFuncType)(int x, int ystart, int yend);
|
||||||
typedef void (DisplayDriver::* SetRectangleFuncType)(int left, int top, int right, int bottom);
|
typedef void (DisplayDriver::* SetRectangleFuncType)(int left, int top, int right, int bottom);
|
||||||
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class DisplayDriver DisplayDriver.h
|
\class DisplayDriver DisplayDriver.h
|
||||||
@@ -125,178 +115,179 @@ class DisplayDriver {
|
|||||||
// Graphics calls implemented in DisplayDriver
|
// Graphics calls implemented in DisplayDriver
|
||||||
virtual void CopyBits( const BRect &src,
|
virtual void CopyBits( const BRect &src,
|
||||||
const BRect &dest,
|
const BRect &dest,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void CopyRegion( BRegion *src,
|
virtual void CopyRegion( BRegion *src,
|
||||||
const BPoint &lefttop);
|
const BPoint &lefttop) = 0;
|
||||||
|
|
||||||
virtual void InvertRect( const BRect &r);
|
virtual void CopyRegionList( BList* list,
|
||||||
|
BList* pList,
|
||||||
|
int32 rCount,
|
||||||
|
BRegion* clipReg) = 0;
|
||||||
|
|
||||||
|
virtual void InvertRect( const BRect &r) = 0;
|
||||||
|
|
||||||
virtual void DrawBitmap( BRegion *region,
|
virtual void DrawBitmap( BRegion *region,
|
||||||
ServerBitmap *bitmap,
|
ServerBitmap *bitmap,
|
||||||
const BRect &source,
|
const BRect &source,
|
||||||
const BRect &dest,
|
const BRect &dest,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void CopyRegionList( BList* list,
|
|
||||||
BList* pList,
|
|
||||||
int32 rCount,
|
|
||||||
BRegion* clipReg);
|
|
||||||
|
|
||||||
virtual void FillArc( const BRect &r,
|
virtual void FillArc( const BRect &r,
|
||||||
const float &angle,
|
const float &angle,
|
||||||
const float &span,
|
const float &span,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void FillBezier( BPoint *pts,
|
virtual void FillBezier( BPoint *pts,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void FillEllipse( const BRect &r,
|
virtual void FillEllipse( const BRect &r,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void FillPolygon( BPoint *ptlist,
|
virtual void FillPolygon( BPoint *ptlist,
|
||||||
int32 numpts,
|
int32 numpts,
|
||||||
const BRect &bounds,
|
const BRect &bounds,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void FillRect( const BRect &r,
|
virtual void FillRect( const BRect &r,
|
||||||
const RGBColor &color);
|
const RGBColor &color) = 0;
|
||||||
|
|
||||||
virtual void FillRect( const BRect &r,
|
virtual void FillRect( const BRect &r,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void FillRegion( BRegion &r,
|
virtual void FillRegion( BRegion &r,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void FillRoundRect( const BRect &r,
|
virtual void FillRoundRect( const BRect &r,
|
||||||
const float &xrad,
|
const float &xrad,
|
||||||
const float &yrad,
|
const float &yrad,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void FillShape( const BRect &bounds,
|
virtual void FillShape( const BRect &bounds,
|
||||||
const int32 &opcount,
|
const int32 &opcount,
|
||||||
const int32 *oplist,
|
const int32 *oplist,
|
||||||
const int32 &ptcount,
|
const int32 &ptcount,
|
||||||
const BPoint *ptlist,
|
const BPoint *ptlist,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void FillTriangle( BPoint *pts,
|
virtual void FillTriangle( BPoint *pts,
|
||||||
const BRect &bounds,
|
const BRect &bounds,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void StrokeArc( const BRect &r,
|
virtual void StrokeArc( const BRect &r,
|
||||||
const float &angle,
|
const float &angle,
|
||||||
const float &span,
|
const float &span,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void StrokeBezier( BPoint *pts,
|
virtual void StrokeBezier( BPoint *pts,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void StrokeEllipse( const BRect &r,
|
virtual void StrokeEllipse( const BRect &r,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
// this version used by Decorator
|
// this version used by Decorator
|
||||||
virtual void StrokeLine( const BPoint &start,
|
virtual void StrokeLine( const BPoint &start,
|
||||||
const BPoint &end,
|
const BPoint &end,
|
||||||
const RGBColor &color);
|
const RGBColor &color) = 0;
|
||||||
|
|
||||||
virtual void StrokeLine( const BPoint &start,
|
virtual void StrokeLine( const BPoint &start,
|
||||||
const BPoint &end,
|
const BPoint &end,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
// this version used by Decorator
|
// this version used by Decorator
|
||||||
virtual void StrokePoint( const BPoint &pt,
|
virtual void StrokePoint( const BPoint &pt,
|
||||||
const RGBColor &color);
|
const RGBColor &color) = 0;
|
||||||
|
|
||||||
virtual void StrokePoint( const BPoint &pt,
|
virtual void StrokePoint( const BPoint &pt,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void StrokePolygon( BPoint *ptlist,
|
virtual void StrokePolygon( BPoint *ptlist,
|
||||||
int32 numpts,
|
int32 numpts,
|
||||||
const BRect &bounds,
|
const BRect &bounds,
|
||||||
const DrawData *d,
|
const DrawData *d,
|
||||||
bool is_closed=true);
|
bool is_closed=true) = 0;
|
||||||
|
|
||||||
// this version used by Decorator
|
// this version used by Decorator
|
||||||
virtual void StrokeRect( const BRect &r,
|
virtual void StrokeRect( const BRect &r,
|
||||||
const RGBColor &color);
|
const RGBColor &color) = 0;
|
||||||
|
|
||||||
virtual void StrokeRect( const BRect &r,
|
virtual void StrokeRect( const BRect &r,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void StrokeRegion( BRegion &r,
|
virtual void StrokeRegion( BRegion &r,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void StrokeRoundRect(const BRect &r,
|
virtual void StrokeRoundRect(const BRect &r,
|
||||||
const float &xrad,
|
const float &xrad,
|
||||||
const float &yrad,
|
const float &yrad,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void StrokeShape( const BRect &bounds,
|
virtual void StrokeShape( const BRect &bounds,
|
||||||
const int32 &opcount,
|
const int32 &opcount,
|
||||||
const int32 *oplist,
|
const int32 *oplist,
|
||||||
const int32 &ptcount,
|
const int32 &ptcount,
|
||||||
const BPoint *ptlist,
|
const BPoint *ptlist,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void StrokeTriangle( BPoint *pts,
|
virtual void StrokeTriangle( BPoint *pts,
|
||||||
const BRect &bounds,
|
const BRect &bounds,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
// Font-related calls
|
// Font-related calls
|
||||||
|
|
||||||
// DrawData is NOT const because this call updates the pen position in the passed DrawData
|
// DrawData is NOT const because this call updates the pen position in the passed DrawData
|
||||||
virtual void DrawString(const char *string,
|
virtual void DrawString( const char *string,
|
||||||
const int32 &length,
|
const int32 &length,
|
||||||
const BPoint &pt,
|
const BPoint &pt,
|
||||||
DrawData *d);
|
DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void DrawString(const char *string,
|
virtual void DrawString( const char *string,
|
||||||
const int32 &length,
|
const int32 &length,
|
||||||
const BPoint &pt,
|
const BPoint &pt,
|
||||||
const RGBColor &color,
|
const RGBColor &color,
|
||||||
escapement_delta *delta=NULL);
|
escapement_delta *delta=NULL) = 0;
|
||||||
|
|
||||||
virtual float StringWidth(const char *string,
|
virtual float StringWidth( const char *string,
|
||||||
int32 length,
|
int32 length,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual float StringHeight(const char *string,
|
virtual float StringHeight( const char *string,
|
||||||
int32 length,
|
int32 length,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void GetBoundingBoxes(const char *string,
|
virtual void GetBoundingBoxes(const char *string,
|
||||||
int32 count,
|
int32 count,
|
||||||
font_metric_mode mode,
|
font_metric_mode mode,
|
||||||
escapement_delta *delta,
|
escapement_delta *delta,
|
||||||
BRect *rectarray,
|
BRect *rectarray,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void GetEscapements(const char *string,
|
virtual void GetEscapements( const char *string,
|
||||||
int32 charcount,
|
int32 charcount,
|
||||||
escapement_delta *delta,
|
escapement_delta *delta,
|
||||||
escapement_delta *escapements,
|
escapement_delta *escapements,
|
||||||
escapement_delta *offsets,
|
escapement_delta *offsets,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void GetEdges(const char *string,
|
virtual void GetEdges( const char *string,
|
||||||
int32 charcount,
|
int32 charcount,
|
||||||
edge_info *edgearray,
|
edge_info *edgearray,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void GetHasGlyphs(const char *string,
|
virtual void GetHasGlyphs( const char *string,
|
||||||
int32 charcount,
|
int32 charcount,
|
||||||
bool *hasarray);
|
bool *hasarray) = 0;
|
||||||
|
|
||||||
virtual void GetTruncatedStrings(const char **instrings,
|
virtual void GetTruncatedStrings(const char **instrings,
|
||||||
const int32 &stringcount,
|
const int32 &stringcount,
|
||||||
const uint32 &mode,
|
const uint32 &mode,
|
||||||
const float &maxwidth,
|
const float &maxwidth,
|
||||||
char **outstrings);
|
char **outstrings) = 0;
|
||||||
|
|
||||||
virtual void HideCursor();
|
virtual void HideCursor();
|
||||||
virtual bool IsCursorHidden();
|
virtual bool IsCursorHidden();
|
||||||
virtual void MoveCursorTo(const float &x, const float &y);
|
virtual void MoveCursorTo( const float &x,
|
||||||
|
const float &y);
|
||||||
virtual void ShowCursor();
|
virtual void ShowCursor();
|
||||||
virtual void ObscureCursor();
|
virtual void ObscureCursor();
|
||||||
virtual void SetCursor(ServerCursor *cursor);
|
virtual void SetCursor(ServerCursor *cursor);
|
||||||
@@ -305,152 +296,73 @@ class DisplayDriver {
|
|||||||
|
|
||||||
|
|
||||||
// Virtual methods which need to be implemented by each subclass
|
// Virtual methods which need to be implemented by each subclass
|
||||||
virtual bool Initialize(void);
|
virtual bool Initialize();
|
||||||
virtual void Shutdown(void);
|
virtual void Shutdown();
|
||||||
|
|
||||||
// These two will rarely be implemented by subclasses,
|
// These two will rarely be implemented by subclasses,
|
||||||
// but it still needs to be possible
|
// but it still needs to be possible
|
||||||
virtual bool Lock(bigtime_t timeout = B_INFINITE_TIMEOUT);
|
virtual bool Lock(bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||||
virtual void Unlock(void);
|
virtual void Unlock();
|
||||||
|
|
||||||
// display mode access
|
// display mode access
|
||||||
virtual void SetMode(const display_mode &mode);
|
virtual void SetMode(const display_mode &mode);
|
||||||
virtual void GetMode( display_mode *mode);
|
void GetMode(display_mode *mode);
|
||||||
|
inline const display_mode* DisplayMode() const
|
||||||
|
{ return &fDisplayMode; }
|
||||||
|
|
||||||
virtual bool DumpToFile(const char *path);
|
virtual bool DumpToFile(const char *path) = 0;
|
||||||
virtual ServerBitmap* DumpToBitmap(void);
|
virtual ServerBitmap* DumpToBitmap() = 0;
|
||||||
|
|
||||||
virtual void StrokeLineArray(const int32 &numlines,
|
virtual void StrokeLineArray(const int32 &numlines,
|
||||||
const LineArrayData *data,
|
const LineArrayData *data,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual status_t SetDPMSMode(const uint32 &state);
|
virtual status_t SetDPMSMode(const uint32 &state);
|
||||||
virtual uint32 DPMSMode() const;
|
virtual uint32 DPMSMode() const;
|
||||||
virtual uint32 DPMSCapabilities() const;
|
virtual uint32 DPMSCapabilities() const;
|
||||||
virtual status_t GetDeviceInfo(accelerant_device_info *info);
|
virtual status_t GetDeviceInfo(accelerant_device_info *info) = 0;
|
||||||
|
|
||||||
virtual status_t GetModeList(display_mode **mode_list,
|
virtual status_t GetModeList(display_mode **mode_list,
|
||||||
uint32 *count);
|
uint32 *count) = 0;
|
||||||
|
|
||||||
virtual status_t GetPixelClockLimits(display_mode *mode,
|
virtual status_t GetPixelClockLimits(display_mode *mode,
|
||||||
uint32 *low,
|
uint32 *low,
|
||||||
uint32 *high);
|
uint32 *high) = 0;
|
||||||
|
|
||||||
virtual status_t GetTimingConstraints(display_timing_constraints *dtc);
|
virtual status_t GetTimingConstraints(display_timing_constraints *dtc) = 0;
|
||||||
virtual status_t ProposeMode(display_mode *candidate,
|
virtual status_t ProposeMode(display_mode *candidate,
|
||||||
const display_mode *low,
|
const display_mode *low,
|
||||||
const display_mode *high);
|
const display_mode *high) = 0;
|
||||||
|
|
||||||
virtual status_t WaitForRetrace(bigtime_t timeout = B_INFINITE_TIMEOUT);
|
virtual status_t WaitForRetrace(bigtime_t timeout = B_INFINITE_TIMEOUT) = 0;
|
||||||
|
|
||||||
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 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);
|
|
||||||
|
|
||||||
// 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);
|
|
||||||
|
|
||||||
/* 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);
|
|
||||||
|
|
||||||
|
// needed by CursorHandler
|
||||||
virtual void CopyBitmap(ServerBitmap *bitmap,
|
virtual void CopyBitmap(ServerBitmap *bitmap,
|
||||||
const BRect &source,
|
const BRect &source,
|
||||||
const BRect &dest,
|
const BRect &dest,
|
||||||
const DrawData *d);
|
const DrawData *d) = 0;
|
||||||
|
|
||||||
virtual void CopyToBitmap(ServerBitmap *target,
|
virtual void CopyToBitmap(ServerBitmap *target,
|
||||||
const BRect &source);
|
const BRect &source) = 0;
|
||||||
|
|
||||||
// temporarily virtual - until clipping code is added in DisplayDriver
|
// This is for drivers which are internally double buffered
|
||||||
virtual void ConstrainClippingRegion(BRegion *reg);
|
// and calling this will cause the real framebuffer to be updated
|
||||||
|
// needed by CursorHandler, (Layer ?)
|
||||||
|
virtual void Invalidate(const BRect &r) = 0;
|
||||||
|
|
||||||
PatternHandler fDrawPattern;
|
// temporarily virtual - until clipping code is added in DisplayDriver
|
||||||
RGBColor fDrawColor;
|
// needed by Layer
|
||||||
int fLineThickness;
|
virtual void ConstrainClippingRegion(BRegion *reg) = 0;
|
||||||
|
|
||||||
BLocker *_locker;
|
|
||||||
|
|
||||||
uint32 fDPMSState;
|
protected:
|
||||||
uint32 fDPMSCaps;
|
BLocker fLocker;
|
||||||
accelerant_device_info fAccDeviceInfo;
|
|
||||||
display_mode fDisplayMode;
|
CursorHandler fCursorHandler;
|
||||||
|
|
||||||
CursorHandler fCursorHandler;
|
display_mode fDisplayMode;
|
||||||
|
uint32 fDPMSState;
|
||||||
DrawData fDrawData;
|
uint32 fDPMSCaps;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -0,0 +1,420 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2001-2005, Haiku, Inc.
|
||||||
|
//
|
||||||
|
// 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: DisplayDriver.h
|
||||||
|
// Authors: DarkWyrm <[email protected]>
|
||||||
|
// Gabe Yoder <[email protected]>
|
||||||
|
// Stephan Aßmus <[email protected]>
|
||||||
|
//
|
||||||
|
// Description: Abstract class which handles all graphics output
|
||||||
|
// for the server
|
||||||
|
//
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
#ifndef _DISPLAY_DRIVER_IMPL_H_
|
||||||
|
#define _DISPLAY_DRIVER_IMPL_H_
|
||||||
|
|
||||||
|
#include <OS.h>
|
||||||
|
|
||||||
|
#include <View.h>
|
||||||
|
#include <Rect.h>
|
||||||
|
#include <Screen.h>
|
||||||
|
#include <Region.h>
|
||||||
|
|
||||||
|
#include <ft2build.h>
|
||||||
|
#include FT_FREETYPE_H
|
||||||
|
|
||||||
|
//#include "CursorHandler.h"
|
||||||
|
#include "DisplaySupport.h"
|
||||||
|
#include "LayerData.h"
|
||||||
|
#include "PatternHandler.h"
|
||||||
|
#include "RGBColor.h"
|
||||||
|
#include "ServerBitmap.h"
|
||||||
|
|
||||||
|
#include "DisplayDriver.h"
|
||||||
|
|
||||||
|
#ifndef ROUND
|
||||||
|
#define ROUND(a) ( (long)(a+.5) )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
class ServerCursor;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Data structure for passing cursor information to hardware drivers.
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uchar *xormask, *andmask;
|
||||||
|
int32 width, height;
|
||||||
|
int32 hotx, hoty;
|
||||||
|
|
||||||
|
} cursor_data;
|
||||||
|
|
||||||
|
#ifndef HOOK_DEFINE_CURSOR
|
||||||
|
|
||||||
|
#define HOOK_DEFINE_CURSOR 0
|
||||||
|
#define HOOK_MOVE_CURSOR 1
|
||||||
|
#define HOOK_SHOW_CURSOR 2
|
||||||
|
#define HOOK_DRAW_LINE_8BIT 3
|
||||||
|
#define HOOK_DRAW_LINE_16BIT 12
|
||||||
|
#define HOOK_DRAW_LINE_32BIT 4
|
||||||
|
#define HOOK_DRAW_RECT_8BIT 5
|
||||||
|
#define HOOK_DRAW_RECT_16BIT 13
|
||||||
|
#define HOOK_DRAW_RECT_32BIT 6
|
||||||
|
#define HOOK_BLIT 7
|
||||||
|
#define HOOK_DRAW_ARRAY_8BIT 8
|
||||||
|
#define HOOK_DRAW_ARRAY_16BIT 14 // Not implemented in current R5 drivers
|
||||||
|
#define HOOK_DRAW_ARRAY_32BIT 9
|
||||||
|
#define HOOK_SYNC 10
|
||||||
|
#define HOOK_INVERT_RECT 11
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class DisplayDriverImpl;
|
||||||
|
|
||||||
|
typedef void (DisplayDriverImpl::* SetPixelFuncType)(int x, int y);
|
||||||
|
typedef void (DisplayDriverImpl::* SetHorizontalLineFuncType)(int xstart, int xend, int y);
|
||||||
|
typedef void (DisplayDriverImpl::* SetVerticalLineFuncType)(int x, int ystart, int yend);
|
||||||
|
typedef void (DisplayDriverImpl::* SetRectangleFuncType)(int left, int top, int right, int bottom);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\class DisplayDriverImpl DisplayDriverImpl.h
|
||||||
|
\brief original DisplayDriver implementation.
|
||||||
|
|
||||||
|
While all virtual functions are technically optional, the default versions
|
||||||
|
do very little, so implementing them all more or less required.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class DisplayDriverImpl : public DisplayDriver {
|
||||||
|
public:
|
||||||
|
DisplayDriverImpl();
|
||||||
|
virtual ~DisplayDriverImpl();
|
||||||
|
|
||||||
|
// Graphics calls implemented in DisplayDriver
|
||||||
|
virtual void CopyBits( const BRect &src,
|
||||||
|
const BRect &dest,
|
||||||
|
const DrawData *d);
|
||||||
|
|
||||||
|
virtual void CopyRegion( BRegion *src,
|
||||||
|
const BPoint &lefttop);
|
||||||
|
|
||||||
|
virtual void InvertRect( const BRect &r);
|
||||||
|
|
||||||
|
virtual void DrawBitmap( BRegion *region,
|
||||||
|
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 DrawData *d);
|
||||||
|
|
||||||
|
virtual void FillBezier( BPoint *pts,
|
||||||
|
const DrawData *d);
|
||||||
|
|
||||||
|
virtual void FillEllipse( const BRect &r,
|
||||||
|
const DrawData *d);
|
||||||
|
|
||||||
|
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 DrawData *d);
|
||||||
|
|
||||||
|
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 DrawData *d);
|
||||||
|
|
||||||
|
virtual void StrokeArc( const BRect &r,
|
||||||
|
const float &angle,
|
||||||
|
const float &span,
|
||||||
|
const DrawData *d);
|
||||||
|
|
||||||
|
virtual void StrokeBezier( BPoint *pts,
|
||||||
|
const DrawData *d);
|
||||||
|
|
||||||
|
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 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 DrawData *d);
|
||||||
|
|
||||||
|
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 DrawData *d);
|
||||||
|
|
||||||
|
// Font-related calls
|
||||||
|
|
||||||
|
// DrawData is NOT const because this call updates the pen position in the passed DrawData
|
||||||
|
virtual void DrawString(const char *string,
|
||||||
|
const int32 &length,
|
||||||
|
const BPoint &pt,
|
||||||
|
DrawData *d);
|
||||||
|
|
||||||
|
virtual void DrawString(const char *string,
|
||||||
|
const int32 &length,
|
||||||
|
const BPoint &pt,
|
||||||
|
const RGBColor &color,
|
||||||
|
escapement_delta *delta=NULL);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
|
||||||
|
virtual bool DumpToFile(const char *path);
|
||||||
|
virtual ServerBitmap* DumpToBitmap();
|
||||||
|
|
||||||
|
virtual void StrokeLineArray(const int32 &numlines,
|
||||||
|
const LineArrayData *data,
|
||||||
|
const DrawData *d);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
// needed by CursorHandler
|
||||||
|
virtual void CopyBitmap(ServerBitmap *bitmap,
|
||||||
|
const BRect &source,
|
||||||
|
const BRect &dest,
|
||||||
|
const DrawData *d);
|
||||||
|
|
||||||
|
virtual void CopyToBitmap(ServerBitmap *target,
|
||||||
|
const BRect &source);
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
// temporarily virtual - until clipping code is added in DisplayDriver
|
||||||
|
// needed by Layer
|
||||||
|
virtual void ConstrainClippingRegion(BRegion *reg);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//friend class Layer;
|
||||||
|
friend class WinBorder;
|
||||||
|
//friend CursorHandler;
|
||||||
|
|
||||||
|
ServerCursor* _GetCursor();
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
// 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 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);
|
||||||
|
|
||||||
|
|
||||||
|
// PatternHandler fDrawPattern;
|
||||||
|
// RGBColor fDrawColor;
|
||||||
|
// int fLineThickness;
|
||||||
|
|
||||||
|
// accelerant_device_info fAccDeviceInfo;
|
||||||
|
|
||||||
|
|
||||||
|
// DrawData fDrawData;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user