first step of geting rid of abstract DisplayDriver base class for less development overhead, DisplayDriverPainter is renamed to DrawingEngine
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14694 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
#include "DrawState.h"
|
||||
|
||||
class DesktopSettings;
|
||||
class DisplayDriver;
|
||||
class DrawingEngine;
|
||||
class ServerFont;
|
||||
class BRegion;
|
||||
|
||||
@@ -52,7 +52,7 @@ class Decorator {
|
||||
virtual ~Decorator();
|
||||
|
||||
void SetColors(const ColorSet &cset);
|
||||
void SetDriver(DisplayDriver *driver);
|
||||
void SetDriver(DrawingEngine *driver);
|
||||
void SetFlags(int32 wflags);
|
||||
void SetFeel(int32 wfeel);
|
||||
void SetFont(ServerFont *font);
|
||||
@@ -137,7 +137,7 @@ class Decorator {
|
||||
virtual void _SetColors();
|
||||
|
||||
ColorSet* _colors;
|
||||
DisplayDriver* _driver;
|
||||
DrawingEngine* _driver;
|
||||
DrawState fDrawState;
|
||||
|
||||
int32 _look;
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <[email protected]>
|
||||
* Gabe Yoder <[email protected]>
|
||||
* Stephan Aßmus <[email protected]>
|
||||
*/
|
||||
#ifndef _DISPLAY_DRIVER_H_
|
||||
#define _DISPLAY_DRIVER_H_
|
||||
|
||||
|
||||
#include <Accelerant.h>
|
||||
#include <Font.h>
|
||||
#include <Locker.h>
|
||||
#include <Point.h>
|
||||
|
||||
class BPoint;
|
||||
class BRect;
|
||||
class BRegion;
|
||||
|
||||
class DrawState;
|
||||
class HWInterface;
|
||||
class Painter;
|
||||
class RGBColor;
|
||||
class ServerBitmap;
|
||||
class ServerCursor;
|
||||
class ServerFont;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
BPoint pt1;
|
||||
BPoint pt2;
|
||||
rgb_color color;
|
||||
|
||||
} LineArrayData;
|
||||
|
||||
class DrawingEngine {
|
||||
public:
|
||||
DrawingEngine(HWInterface* interface = NULL);
|
||||
virtual ~DrawingEngine();
|
||||
|
||||
// when implementing, be sure to call the inherited version
|
||||
virtual status_t Initialize();
|
||||
virtual void Shutdown();
|
||||
|
||||
virtual void Update();
|
||||
|
||||
virtual void SetHWInterface(HWInterface* interface);
|
||||
|
||||
// clipping for all drawing functions, passing a NULL region
|
||||
// will remove any clipping (drawing allowed everywhere)
|
||||
virtual void ConstrainClippingRegion(BRegion* region);
|
||||
|
||||
// drawing functions
|
||||
virtual void CopyRegion( /*const*/ BRegion* region,
|
||||
int32 xOffset,
|
||||
int32 yOffset);
|
||||
|
||||
virtual void CopyRegionList( BList* list,
|
||||
BList* pList,
|
||||
int32 rCount,
|
||||
BRegion* clipReg);
|
||||
|
||||
virtual void InvertRect( BRect r);
|
||||
|
||||
virtual void DrawBitmap( ServerBitmap *bitmap,
|
||||
const BRect &source,
|
||||
const BRect &dest,
|
||||
const DrawState *d);
|
||||
|
||||
virtual void FillArc( BRect r,
|
||||
const float &angle,
|
||||
const float &span,
|
||||
const DrawState *d);
|
||||
|
||||
virtual void FillBezier( BPoint *pts,
|
||||
const DrawState *d);
|
||||
|
||||
virtual void FillEllipse( BRect r,
|
||||
const DrawState *d);
|
||||
|
||||
virtual void FillPolygon( BPoint *ptlist,
|
||||
int32 numpts,
|
||||
BRect bounds,
|
||||
const DrawState *d);
|
||||
|
||||
virtual void FillRect( BRect r,
|
||||
const RGBColor &color);
|
||||
|
||||
virtual void FillRect( BRect r,
|
||||
const DrawState *d);
|
||||
|
||||
virtual void FillRegion( BRegion &r,
|
||||
const DrawState *d);
|
||||
|
||||
virtual void FillRoundRect( BRect r,
|
||||
const float &xrad,
|
||||
const float &yrad,
|
||||
const DrawState *d);
|
||||
|
||||
virtual void FillShape( const BRect &bounds,
|
||||
const int32 &opcount,
|
||||
const int32 *oplist,
|
||||
const int32 &ptcount,
|
||||
const BPoint *ptlist,
|
||||
const DrawState *d);
|
||||
|
||||
virtual void FillTriangle( BPoint *pts,
|
||||
BRect bounds,
|
||||
const DrawState *d);
|
||||
|
||||
virtual void StrokeArc( BRect r,
|
||||
const float &angle,
|
||||
const float &span,
|
||||
const DrawState *d);
|
||||
|
||||
virtual void StrokeBezier( BPoint *pts,
|
||||
const DrawState *d);
|
||||
|
||||
virtual void StrokeEllipse( BRect r,
|
||||
const DrawState *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,
|
||||
DrawState *d);
|
||||
|
||||
virtual void StrokeLineArray(const int32 &numlines,
|
||||
const LineArrayData *data,
|
||||
const DrawState *d);
|
||||
|
||||
// this version used by Decorator
|
||||
virtual void StrokePoint( const BPoint &pt,
|
||||
const RGBColor &color);
|
||||
|
||||
virtual void StrokePoint( const BPoint &pt,
|
||||
DrawState *d);
|
||||
|
||||
virtual void StrokePolygon( BPoint *ptlist,
|
||||
int32 numpts,
|
||||
BRect bounds,
|
||||
const DrawState *d,
|
||||
bool is_closed=true);
|
||||
|
||||
// this version used by Decorator
|
||||
virtual void StrokeRect( BRect r,
|
||||
const RGBColor &color);
|
||||
|
||||
virtual void StrokeRect( BRect r,
|
||||
const DrawState *d);
|
||||
|
||||
virtual void StrokeRegion( BRegion &r,
|
||||
const DrawState *d);
|
||||
|
||||
virtual void StrokeRoundRect(BRect r,
|
||||
const float &xrad,
|
||||
const float &yrad,
|
||||
const DrawState *d);
|
||||
|
||||
virtual void StrokeShape( const BRect &bounds,
|
||||
const int32 &opcount,
|
||||
const int32 *oplist,
|
||||
const int32 &ptcount,
|
||||
const BPoint *ptlist,
|
||||
const DrawState *d);
|
||||
|
||||
virtual void StrokeTriangle( BPoint *pts,
|
||||
const BRect &bounds,
|
||||
const DrawState *d);
|
||||
|
||||
// Font-related calls
|
||||
|
||||
// DrawState is NOT const because this call updates the pen position in the passed DrawState
|
||||
virtual void DrawString( const char* string,
|
||||
int32 length,
|
||||
const BPoint& pt,
|
||||
DrawState* d,
|
||||
escapement_delta* delta = NULL);
|
||||
|
||||
/* 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 DrawState* d,
|
||||
escapement_delta* delta = NULL);
|
||||
|
||||
virtual float StringWidth( const char* string,
|
||||
int32 length,
|
||||
const ServerFont& font,
|
||||
escapement_delta* delta = NULL);
|
||||
|
||||
virtual float StringHeight( const char* string,
|
||||
int32 length,
|
||||
const DrawState* d);
|
||||
|
||||
virtual bool Lock();
|
||||
virtual void Unlock();
|
||||
|
||||
bool WriteLock();
|
||||
void WriteUnlock();
|
||||
|
||||
virtual bool DumpToFile( const char *path);
|
||||
virtual ServerBitmap* DumpToBitmap();
|
||||
|
||||
private:
|
||||
BRect _CopyRect( BRect r,
|
||||
int32 xOffset,
|
||||
int32 yOffset) const;
|
||||
|
||||
void _CopyRect( uint8* bits,
|
||||
uint32 width,
|
||||
uint32 height,
|
||||
uint32 bpr,
|
||||
int32 xOffset,
|
||||
int32 yOffset) const;
|
||||
|
||||
Painter* fPainter;
|
||||
HWInterface* fGraphicsCard;
|
||||
uint32 fAvailableHWAccleration;
|
||||
};
|
||||
|
||||
#endif // _DISPLAY_DRIVER_PAINTER_H_
|
||||
Reference in New Issue
Block a user