Major overhaul of the DisplayDriver API
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6336 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
// File Name: DisplayDriver.h
|
// File Name: DisplayDriver.h
|
||||||
// Author: DarkWyrm <[email protected]>
|
// Author: DarkWyrm <[email protected]>
|
||||||
// Gabe Yoder <[email protected]>
|
// Gabe Yoder <[email protected]>
|
||||||
|
//
|
||||||
// Description: Mostly abstract class which handles all graphics output
|
// Description: Mostly abstract class which handles all graphics output
|
||||||
// for the server
|
// for the server
|
||||||
//
|
//
|
||||||
@@ -40,10 +41,10 @@
|
|||||||
#include "RGBColor.h"
|
#include "RGBColor.h"
|
||||||
#include <Region.h>
|
#include <Region.h>
|
||||||
#include "PatternHandler.h"
|
#include "PatternHandler.h"
|
||||||
|
#include "LayerData.h"
|
||||||
|
|
||||||
class ServerCursor;
|
class ServerCursor;
|
||||||
class ServerBitmap;
|
class ServerBitmap;
|
||||||
class LayerData;
|
|
||||||
|
|
||||||
#ifndef ROUND
|
#ifndef ROUND
|
||||||
#define ROUND(a) ( (long)(a+.5) )
|
#define ROUND(a) ( (long)(a+.5) )
|
||||||
@@ -133,89 +134,100 @@ class DisplayDriver
|
|||||||
public:
|
public:
|
||||||
DisplayDriver(void);
|
DisplayDriver(void);
|
||||||
virtual ~DisplayDriver(void);
|
virtual ~DisplayDriver(void);
|
||||||
virtual bool Initialize(void);
|
|
||||||
virtual void Shutdown(void);
|
|
||||||
virtual void CopyBits(BRect src, BRect dest);
|
|
||||||
virtual void CopyRegion(BRegion *src, const BPoint &lefttop);
|
|
||||||
virtual void DrawBitmap(ServerBitmap *bmp, BRect src, BRect dest, LayerData *d);
|
|
||||||
virtual void DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *delta=NULL);
|
|
||||||
|
|
||||||
virtual void FillArc(const BRect r, float angle, float span, RGBColor &color);
|
// Graphics calls implemented in DisplayDriver
|
||||||
virtual void FillArc(const BRect r, float angle, float span, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color);
|
void CopyBits(const BRect &src, const BRect &dest);
|
||||||
virtual void FillBezier(BPoint *pts, RGBColor &color);
|
void CopyRegion(BRegion *src, const BPoint &lefttop);
|
||||||
virtual void FillBezier(BPoint *pts, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color);
|
void DrawBitmap(ServerBitmap *bitmap, const BRect &source, const BRect &dest, const DrawData *d);
|
||||||
virtual void FillEllipse(BRect r, RGBColor &color);
|
|
||||||
virtual void FillEllipse(BRect r, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color);
|
|
||||||
virtual void FillPolygon(BPoint *ptlist, int32 numpts, RGBColor &color);
|
|
||||||
virtual void FillPolygon(BPoint *ptlist, int32 numpts, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color);
|
|
||||||
virtual void FillRect(const BRect r, RGBColor &color);
|
|
||||||
virtual void FillRect(const BRect r, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color);
|
|
||||||
virtual void FillRegion(BRegion& r, RGBColor &color);
|
|
||||||
virtual void FillRegion(BRegion& r, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color);
|
|
||||||
virtual void FillRoundRect(BRect r, float xrad, float yrad, RGBColor &color);
|
|
||||||
virtual void FillRoundRect(BRect r, float xrad, float yrad, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color);
|
|
||||||
// virtual void FillShape(SShape *sh, LayerData *d, const Pattern &pat);
|
|
||||||
virtual void FillTriangle(BPoint *pts, RGBColor &color);
|
|
||||||
virtual void FillTriangle(BPoint *pts, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color);
|
|
||||||
|
|
||||||
virtual void HideCursor(void);
|
void FillArc(const BRect &r, const float &angle, const float &span, RGBColor &color);
|
||||||
virtual bool IsCursorHidden(void);
|
void FillArc(const BRect &r, const float &angle, const float &span, const DrawData *d, const Pattern &pattern);
|
||||||
virtual void MoveCursorTo(float x, float y);
|
void FillBezier(BPoint *pts, RGBColor &color);
|
||||||
virtual void InvertRect(BRect r);
|
void FillBezier(BPoint *pts, const DrawData *d, const Pattern &pattern);
|
||||||
virtual void ShowCursor(void);
|
void FillEllipse(const BRect &r, RGBColor &color);
|
||||||
virtual void ObscureCursor(void);
|
void FillEllipse(const BRect &r, const DrawData *d, const Pattern &pattern);
|
||||||
virtual void SetCursor(ServerCursor *cursor);
|
void FillPolygon(BPoint *ptlist, int32 numpts, RGBColor &color);
|
||||||
|
void FillPolygon(BPoint *ptlist, int32 numpts, const DrawData *d, const Pattern &pattern);
|
||||||
|
void FillRect(const BRect &r, RGBColor &color);
|
||||||
|
void FillRect(const BRect &r, const DrawData *d, const Pattern &pattern);
|
||||||
|
void FillRegion(BRegion &r, RGBColor &color);
|
||||||
|
void FillRegion(BRegion &r, const DrawData *d, const Pattern &pattern);
|
||||||
|
void FillRoundRect(const BRect &r, const float &xrad, const float &yrad, RGBColor &color);
|
||||||
|
void FillRoundRect(const BRect &r, const float &xrad, const float &yrad, const DrawData *d, const Pattern &pattern);
|
||||||
|
// void FillShape(SShape *sh, const DrawData *d, const Pattern &pat);
|
||||||
|
void FillTriangle(BPoint *pts, RGBColor &color);
|
||||||
|
void FillTriangle(BPoint *pts, const DrawData *d, const Pattern &pattern);
|
||||||
|
|
||||||
virtual void StrokeArc(BRect r, float angle, float span, float pensize, RGBColor &color);
|
void HideCursor(void);
|
||||||
virtual void StrokeArc(BRect r, float angle, float span, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color);
|
bool IsCursorHidden(void);
|
||||||
virtual void StrokeBezier(BPoint *pts, float pensize, RGBColor &color);
|
void MoveCursorTo(const float &x, const float &y);
|
||||||
virtual void StrokeBezier(BPoint *pts, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color);
|
void ShowCursor(void);
|
||||||
virtual void StrokeEllipse(BRect r, float pensize, RGBColor &color);
|
void ObscureCursor(void);
|
||||||
virtual void StrokeEllipse(BRect r, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color);
|
void SetCursor(ServerCursor *cursor);
|
||||||
virtual void StrokeLine(BPoint start, BPoint end, float pensize, RGBColor &color);
|
|
||||||
virtual void StrokeLine(BPoint start, BPoint end, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color);
|
|
||||||
virtual void StrokePoint(BPoint& pt, RGBColor &color);
|
|
||||||
virtual void StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, RGBColor &color, bool is_closed=true);
|
|
||||||
virtual void StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color, bool is_closed=true);
|
|
||||||
virtual void StrokeRect(BRect r, float pensize, RGBColor &color);
|
|
||||||
virtual void StrokeRect(BRect r, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color);
|
|
||||||
virtual void StrokeRegion(BRegion& r, float pensize, RGBColor &color);
|
|
||||||
virtual void StrokeRegion(BRegion& r, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color);
|
|
||||||
virtual void StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, RGBColor &color);
|
|
||||||
virtual void StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color);
|
|
||||||
// virtual void StrokeShape(SShape *sh, LayerData *d, const Pattern &pat);
|
|
||||||
virtual void StrokeTriangle(BPoint *pts, float pensize, RGBColor &color);
|
|
||||||
virtual void StrokeTriangle(BPoint *pts, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color);
|
|
||||||
|
|
||||||
virtual void StrokeLineArray(BPoint *pts, int32 numlines, float pensize, RGBColor *colors);
|
void StrokeArc(const BRect &r, const float &angle, const float &span, RGBColor &color);
|
||||||
|
void StrokeArc(const BRect &r, const float &angle, const float &span, const DrawData *d, const Pattern &pattern);
|
||||||
|
void StrokeBezier(BPoint *pts, RGBColor &color);
|
||||||
|
void StrokeBezier(BPoint *pts, const DrawData *d, const Pattern &pattern);
|
||||||
|
void StrokeEllipse(const BRect &r, RGBColor &color);
|
||||||
|
void StrokeEllipse(const BRect &r, const DrawData *d, const Pattern &pattern);
|
||||||
|
void StrokeLine(const BPoint &start, const BPoint &end, RGBColor &color);
|
||||||
|
void StrokeLine(const BPoint &start, const BPoint &end, const DrawData *d, const Pattern &pattern);
|
||||||
|
void StrokePoint(BPoint &pt, RGBColor &color);
|
||||||
|
void StrokePolygon(BPoint *ptlist, int32 numpts, RGBColor &color, bool is_closed=true);
|
||||||
|
void StrokePolygon(BPoint *ptlist, int32 numpts, const DrawData *d, const Pattern &pattern, bool is_closed=true);
|
||||||
|
void StrokeRect(const BRect &r, RGBColor &color);
|
||||||
|
void StrokeRect(const BRect &r, const DrawData *d, const Pattern &pattern);
|
||||||
|
void StrokeRegion(BRegion &r, RGBColor &color);
|
||||||
|
void StrokeRegion(BRegion &r, const DrawData *d, const Pattern &pattern);
|
||||||
|
void StrokeRoundRect(const BRect &r, const float &xrad, const float &yrad, RGBColor &color);
|
||||||
|
void StrokeRoundRect(const BRect &r, const float &xrad, const float &yrad, const DrawData *d, const Pattern &pattern);
|
||||||
|
// void StrokeShape(SShape *sh, const DrawData *d, const Pattern &pat);
|
||||||
|
void StrokeTriangle(BPoint *pts, RGBColor &color);
|
||||||
|
void StrokeTriangle(BPoint *pts, const DrawData *d, const Pattern &pattern);
|
||||||
|
|
||||||
virtual void SetMode(int32 mode);
|
void GetMode(display_mode *mode);
|
||||||
virtual void SetMode(const display_mode &mode);
|
|
||||||
virtual void GetMode(display_mode *mode);
|
|
||||||
virtual bool DumpToFile(const char *path);
|
|
||||||
virtual ServerBitmap *DumpToBitmap(void);
|
|
||||||
|
|
||||||
virtual float StringWidth(const char *string, int32 length, LayerData *d);
|
|
||||||
virtual float StringHeight(const char *string, int32 length, LayerData *d);
|
|
||||||
|
|
||||||
virtual void GetBoundingBoxes(const char *string, int32 count, font_metric_mode mode,
|
|
||||||
escapement_delta *delta, BRect *rectarray, LayerData *d);
|
|
||||||
virtual void GetEscapements(const char *string, int32 charcount, escapement_delta *delta,
|
|
||||||
escapement_delta *escapements, escapement_delta *offsets, LayerData *d);
|
|
||||||
virtual void GetEdges(const char *string, int32 charcount, edge_info *edgearray, LayerData *d);
|
|
||||||
virtual void GetHasGlyphs(const char *string, int32 charcount, bool *hasarray);
|
|
||||||
virtual void GetTruncatedStrings( const char **instrings, int32 stringcount, uint32 mode,
|
|
||||||
float maxwidth, char **outstrings);
|
|
||||||
|
|
||||||
uint8 GetDepth(void);
|
|
||||||
uint16 GetHeight(void);
|
|
||||||
uint16 GetWidth(void);
|
|
||||||
uint32 GetBytesPerRow(void);
|
|
||||||
int32 GetMode(void);
|
int32 GetMode(void);
|
||||||
|
|
||||||
|
|
||||||
|
// Font-related calls
|
||||||
|
void DrawString(const char *string, const int32 &length, const BPoint &pt, const DrawData *d);
|
||||||
|
void DrawString(const char *string, const int32 &length, const BPoint &pt, RGBColor &color, escapement_delta *delta=NULL);
|
||||||
|
|
||||||
|
float StringWidth(const char *string, int32 length, const DrawData *d);
|
||||||
|
float StringHeight(const char *string, int32 length, const DrawData *d);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
bool IsCursorObscured(bool state);
|
bool IsCursorObscured(bool state);
|
||||||
|
|
||||||
bool Lock(bigtime_t timeout=B_INFINITE_TIMEOUT);
|
|
||||||
void Unlock(void);
|
// Virtual methods which need to be implemented by each subclass
|
||||||
|
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);
|
||||||
|
|
||||||
|
virtual void SetMode(const int32 &mode);
|
||||||
|
virtual void SetMode(const display_mode &mode);
|
||||||
|
|
||||||
|
// Eventually, this method will go away....
|
||||||
|
uint8 GetDepth(void);
|
||||||
|
uint32 GetBytesPerRow(void);
|
||||||
|
|
||||||
|
virtual bool DumpToFile(const char *path);
|
||||||
|
virtual ServerBitmap *DumpToBitmap(void);
|
||||||
|
virtual void InvertRect(const BRect &r);
|
||||||
|
virtual void StrokeLineArray(BPoint *pts, const int32 &numlines, const DrawData *d, RGBColor *colors);
|
||||||
|
|
||||||
virtual status_t SetDPMSMode(const uint32 &state);
|
virtual status_t SetDPMSMode(const uint32 &state);
|
||||||
virtual uint32 DPMSMode(void) const;
|
virtual uint32 DPMSMode(void) const;
|
||||||
@@ -228,45 +240,42 @@ public:
|
|||||||
virtual status_t WaitForRetrace(bigtime_t timeout=B_INFINITE_TIMEOUT);
|
virtual status_t WaitForRetrace(bigtime_t timeout=B_INFINITE_TIMEOUT);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _SetDepth(uint8 d);
|
|
||||||
void _SetHeight(uint16 h);
|
|
||||||
void _SetWidth(uint16 w);
|
|
||||||
void _SetMode(int32 m);
|
|
||||||
void _SetBytesPerRow(uint32 bpr);
|
|
||||||
void _SetDPMSCapabilities(uint32 caps);
|
|
||||||
void _SetDPMSState(uint32 state);
|
|
||||||
void _SetDeviceInfo(const accelerant_device_info &infO);
|
|
||||||
ServerCursor *_GetCursor(void);
|
ServerCursor *_GetCursor(void);
|
||||||
//virtual void HLine(int32 x1, int32 x2, int32 y, PatternHandler *pat);
|
|
||||||
//virtual void HLineThick(int32 x1, int32 x2, int32 y, int32 thick, PatternHandler *pat);
|
|
||||||
virtual void HLinePatternThick(int32 x1, int32 x2, int32 y);
|
virtual void HLinePatternThick(int32 x1, int32 x2, int32 y);
|
||||||
virtual void VLinePatternThick(int32 x, int32 y1, int32 y2);
|
virtual void VLinePatternThick(int32 x, int32 y1, int32 y2);
|
||||||
virtual void FillSolidRect(int32 left, int32 top, int32 right, int32 bottom);
|
virtual void FillSolidRect(int32 left, int32 top, int32 right, int32 bottom);
|
||||||
virtual void FillPatternRect(int32 left, int32 top, int32 right, int32 bottom);
|
virtual void FillPatternRect(int32 left, int32 top, int32 right, int32 bottom);
|
||||||
//virtual void SetPixel(int x, int y, RGBColor col);
|
|
||||||
//virtual void SetThickPixel(int x, int y, int thick, PatternHandler *pat);
|
|
||||||
virtual void SetThickPatternPixel(int x, int y);
|
virtual void SetThickPatternPixel(int x, int y);
|
||||||
|
|
||||||
void FillArc(const BRect r, float angle, float span, DisplayDriver*, SetHorizontalLineFuncType setLine);
|
void FillArc(const BRect &r, const float &angle, const float &span, DisplayDriver*, SetHorizontalLineFuncType setLine);
|
||||||
void FillBezier(BPoint *pts, DisplayDriver* driver, SetHorizontalLineFuncType setLine);
|
void FillBezier(BPoint *pts, DisplayDriver* driver, SetHorizontalLineFuncType setLine);
|
||||||
void FillEllipse(BRect r, DisplayDriver* driver, SetHorizontalLineFuncType setLine);
|
void FillEllipse(const BRect &r, DisplayDriver* driver, SetHorizontalLineFuncType setLine);
|
||||||
void FillPolygon(BPoint *ptlist, int32 numpts, DisplayDriver* driver, SetHorizontalLineFuncType setLine);
|
void FillPolygon(BPoint *ptlist, int32 numpts, DisplayDriver* driver, SetHorizontalLineFuncType setLine);
|
||||||
void FillRegion(BRegion &r, DisplayDriver* driver, SetRectangleFuncType setRect);
|
void FillRegion(BRegion &r, DisplayDriver* driver, SetRectangleFuncType setRect);
|
||||||
void FillRoundRect(BRect r, float xrad, float yrad, DisplayDriver* driver, SetRectangleFuncType setRect, SetHorizontalLineFuncType setLine);
|
void FillRoundRect(const BRect &r, const float &xrad, const float &yrad, DisplayDriver* driver, SetRectangleFuncType setRect, SetHorizontalLineFuncType setLine);
|
||||||
void FillTriangle(BPoint *pts, DisplayDriver* driver, SetHorizontalLineFuncType setLine);
|
void FillTriangle(BPoint *pts, DisplayDriver* driver, SetHorizontalLineFuncType setLine);
|
||||||
void StrokeArc(BRect r, float angle, float span, DisplayDriver* driver, SetPixelFuncType setPixel);
|
void StrokeArc(const BRect &r, const float &angle, const float &span, DisplayDriver* driver, SetPixelFuncType setPixel);
|
||||||
void StrokeBezier(BPoint *pts, DisplayDriver* driver, SetPixelFuncType setPixel);
|
void StrokeBezier(BPoint *pts, DisplayDriver* driver, SetPixelFuncType setPixel);
|
||||||
void StrokeEllipse(BRect r, DisplayDriver* driver, SetPixelFuncType setPixel);
|
void StrokeEllipse(const BRect &r, DisplayDriver* driver, SetPixelFuncType setPixel);
|
||||||
void StrokeLine(BPoint start, BPoint end, DisplayDriver* driver, SetPixelFuncType setPixel);
|
void StrokeLine(const BPoint &start, const BPoint &end, DisplayDriver* driver, SetPixelFuncType setPixel);
|
||||||
void StrokePolygon(BPoint *ptlist, int32 numpts, DisplayDriver* driver, SetPixelFuncType setPixel, bool is_closed=true);
|
void StrokePolygon(BPoint *ptlist, int32 numpts, DisplayDriver* driver, SetPixelFuncType setPixel, bool is_closed=true);
|
||||||
void StrokeRect(BRect r, DisplayDriver* driver, SetHorizontalLineFuncType setHLine, SetVerticalLineFuncType setVLine);
|
void StrokeRect(const BRect &r, DisplayDriver* driver, SetHorizontalLineFuncType setHLine, SetVerticalLineFuncType setVLine);
|
||||||
void StrokeRoundRect(BRect r, float xrad, float yrad, DisplayDriver* driver, SetHorizontalLineFuncType setHLine, SetVerticalLineFuncType setVLine, SetPixelFuncType setPixel);
|
void StrokeRoundRect(const BRect &r, const float &xrad, const float &yrad, DisplayDriver* driver, SetHorizontalLineFuncType setHLine, SetVerticalLineFuncType setVLine, 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, RGBColor &color);
|
||||||
|
virtual void FillPatternRect(const BRect &rect, const DrawData *d);
|
||||||
|
virtual void StrokeSolidLine(const BPoint &start, const BPoint &end, RGBColor &color);
|
||||||
|
virtual void StrokeSolidRect(const BRect &rect, RGBColor &color);
|
||||||
|
virtual void CopyBitmap(ServerBitmap *bitmap, const BRect &source, const BRect &dest, const DrawData *d);
|
||||||
|
virtual void CopyToBitmap(ServerBitmap *target, const BRect &source);
|
||||||
|
|
||||||
PatternHandler fDrawPattern;
|
PatternHandler fDrawPattern;
|
||||||
RGBColor fDrawColor;
|
RGBColor fDrawColor;
|
||||||
int fLineThickness;
|
int fLineThickness;
|
||||||
|
|
||||||
private:
|
|
||||||
BLocker *_locker;
|
BLocker *_locker;
|
||||||
uint8 _buffer_depth;
|
uint8 _buffer_depth;
|
||||||
uint16 _buffer_width;
|
uint16 _buffer_width;
|
||||||
@@ -275,10 +284,16 @@ private:
|
|||||||
uint32 _bytes_per_row;
|
uint32 _bytes_per_row;
|
||||||
bool _is_cursor_hidden;
|
bool _is_cursor_hidden;
|
||||||
bool _is_cursor_obscured;
|
bool _is_cursor_obscured;
|
||||||
|
|
||||||
ServerCursor *_cursor;
|
ServerCursor *_cursor;
|
||||||
|
ServerBitmap *_cursorsave;
|
||||||
|
|
||||||
uint32 _dpms_state;
|
uint32 _dpms_state;
|
||||||
uint32 _dpms_caps;
|
uint32 _dpms_caps;
|
||||||
accelerant_device_info _acc_device_info;
|
accelerant_device_info _acc_device_info;
|
||||||
|
|
||||||
|
BRect oldcursorframe, cursorframe, saveframe;
|
||||||
|
DrawData _drawdata;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,3 +1,30 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// 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: LayerData.h
|
||||||
|
// Author: DarkWyrm <[email protected]>
|
||||||
|
// Adi Oanca <[email protected]>
|
||||||
|
// Description: Data classes for working with BView states and draw parameters
|
||||||
|
//
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
#ifndef LAYERDATA_H_
|
#ifndef LAYERDATA_H_
|
||||||
#define LAYERDATA_H_
|
#define LAYERDATA_H_
|
||||||
|
|
||||||
@@ -14,74 +41,23 @@
|
|||||||
class ServerBitmap;
|
class ServerBitmap;
|
||||||
class ServerFont;
|
class ServerFont;
|
||||||
class ServerPicture;
|
class ServerPicture;
|
||||||
|
class Layer;
|
||||||
|
|
||||||
class LayerData
|
class DrawData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LayerData(void)
|
DrawData(void);
|
||||||
{
|
DrawData(const DrawData &data);
|
||||||
penlocation.Set(0,0);
|
~DrawData(void);
|
||||||
pensize = 1.0;
|
DrawData &operator=(const DrawData &from);
|
||||||
highcolor.SetColor(0, 0, 0, 255);
|
|
||||||
lowcolor.SetColor(255, 255, 255, 255);
|
|
||||||
viewcolor.SetColor(255, 255, 255, 255);
|
|
||||||
patt = pat_solidhigh;
|
|
||||||
draw_mode = B_OP_COPY;
|
|
||||||
coordOrigin.Set(0.0, 0.0);
|
|
||||||
|
|
||||||
lineCap = B_BUTT_CAP;
|
|
||||||
lineJoin = B_BEVEL_JOIN;
|
|
||||||
miterLimit = B_DEFAULT_MITER_LIMIT;
|
|
||||||
|
|
||||||
alphaSrcMode = B_PIXEL_ALPHA;
|
|
||||||
alphaFncMode = B_ALPHA_OVERLAY;
|
|
||||||
scale = 1.0;
|
|
||||||
fontAliasing = true;
|
|
||||||
if(fontserver)
|
|
||||||
font = *(fontserver->GetSystemPlain());
|
|
||||||
|
|
||||||
clippReg = NULL;
|
|
||||||
|
|
||||||
// NOTE: read below!
|
|
||||||
//background = NULL;
|
|
||||||
//overlay = NULL;
|
|
||||||
image = NULL;
|
|
||||||
isOverlay = false;
|
|
||||||
|
|
||||||
edelta.space = 0;
|
|
||||||
edelta.nonspace = 0;
|
|
||||||
|
|
||||||
prevState = NULL;
|
|
||||||
}
|
|
||||||
~LayerData(void)
|
|
||||||
{
|
|
||||||
if (clippReg)
|
|
||||||
delete clippReg;
|
|
||||||
|
|
||||||
if (image){
|
|
||||||
/* NOTE: I don't know yet how bitmap allocation/deallocation
|
|
||||||
is managed by server. I tend to think it's a reference
|
|
||||||
count type, so a 'delete' it's NOT good here.
|
|
||||||
Maybe a image.Release()?
|
|
||||||
|
|
||||||
TODO: tell 'image' we're finished with it! :-)
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
if (prevState){
|
|
||||||
delete prevState;
|
|
||||||
prevState = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// BView related
|
|
||||||
BPoint penlocation;
|
BPoint penlocation;
|
||||||
float pensize;
|
|
||||||
RGBColor highcolor,
|
RGBColor highcolor,
|
||||||
lowcolor,
|
lowcolor;
|
||||||
viewcolor;
|
|
||||||
|
float pensize;
|
||||||
Pattern patt;
|
Pattern patt;
|
||||||
drawing_mode draw_mode;
|
drawing_mode draw_mode;
|
||||||
BPoint coordOrigin;
|
|
||||||
|
|
||||||
cap_mode lineCap;
|
cap_mode lineCap;
|
||||||
join_mode lineJoin;
|
join_mode lineJoin;
|
||||||
@@ -95,21 +71,29 @@ public:
|
|||||||
|
|
||||||
BRegion *clippReg;
|
BRegion *clippReg;
|
||||||
|
|
||||||
// server related
|
|
||||||
// NOTE: only one image is needed. It's a bitmap OR an overlay!
|
|
||||||
ServerBitmap *image;
|
|
||||||
bool isOverlay;
|
|
||||||
//ServerBitmap *background;
|
|
||||||
//ServerBitmap *overlay;
|
|
||||||
|
|
||||||
escapement_delta edelta;
|
escapement_delta edelta;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class LayerData : public DrawData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LayerData(void);
|
||||||
|
LayerData(const Layer *layer);
|
||||||
|
LayerData(const LayerData &data);
|
||||||
|
LayerData &operator=(const LayerData &from);
|
||||||
|
~LayerData(void);
|
||||||
|
|
||||||
|
BPoint coordOrigin;
|
||||||
|
|
||||||
|
RGBColor viewcolor;
|
||||||
|
|
||||||
|
// We have both because we are not going to suffer from the limitation that R5
|
||||||
|
// places on us. We can have both. :)
|
||||||
|
ServerBitmap *background;
|
||||||
|
ServerBitmap *overlay;
|
||||||
|
|
||||||
// used for the state stack
|
// used for the state stack
|
||||||
LayerData *prevState;
|
LayerData *prevState;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
@log
|
|
||||||
* modified 'font' member from '*font' to 'font'. '*font' was getting the pointer to system's plain font, and worse, it modified it. Now, it's all OK.
|
|
||||||
*/
|
|
||||||
|
|||||||
Reference in New Issue
Block a user