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@11986 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2005-03-25 17:29:20 +00:00
parent aab32edf08
commit 10612543aa
13 changed files with 3052 additions and 2973 deletions
+8 -5
View File
@@ -47,7 +47,8 @@
\brief Sets up internal variables needed by AccelerantDriver \brief Sets up internal variables needed by AccelerantDriver
*/ */
AccelerantDriver::AccelerantDriver(void) : DisplayDriver() AccelerantDriver::AccelerantDriver()
: DisplayDriverImpl()
{ {
cursor=NULL; cursor=NULL;
under_cursor=NULL; under_cursor=NULL;
@@ -63,7 +64,7 @@ AccelerantDriver::AccelerantDriver(void) : DisplayDriver()
\brief Deletes the heap memory used by the AccelerantDriver \brief Deletes the heap memory used by the AccelerantDriver
*/ */
AccelerantDriver::~AccelerantDriver(void) AccelerantDriver::~AccelerantDriver()
{ {
if (cursor) if (cursor)
delete cursor; delete cursor;
@@ -80,7 +81,7 @@ AccelerantDriver::~AccelerantDriver(void)
Initialize sets up the driver for display, including the initial clearing Initialize sets up the driver for display, including the initial clearing
of the screen. If things do not go as they should, false should be returned. of the screen. If things do not go as they should, false should be returned.
*/ */
bool AccelerantDriver::Initialize(void) bool AccelerantDriver::Initialize()
{ {
int i; int i;
char signature[1024]; char signature[1024];
@@ -182,7 +183,7 @@ bool AccelerantDriver::Initialize(void)
FillRect(BRect(0,0,1024,768),blue); FillRect(BRect(0,0,1024,768),blue);
#endif #endif
return true; return DisplayDriver::Initialize();
} }
/*! /*!
@@ -191,8 +192,10 @@ bool AccelerantDriver::Initialize(void)
Any work done by Initialize() should be undone here. Note that Shutdown() is Any work done by Initialize() should be undone here. Note that Shutdown() is
called even if Initialize() was unsuccessful. called even if Initialize() was unsuccessful.
*/ */
void AccelerantDriver::Shutdown(void) void AccelerantDriver::Shutdown()
{ {
DisplayDriver::Shutdown();
#ifdef RUN_UNDER_R5 #ifdef RUN_UNDER_R5
set_display_mode SetDisplayMode = (set_display_mode)accelerant_hook(B_SET_DISPLAY_MODE, NULL); set_display_mode SetDisplayMode = (set_display_mode)accelerant_hook(B_SET_DISPLAY_MODE, NULL);
if ( SetDisplayMode ) if ( SetDisplayMode )
+10 -8
View File
@@ -29,22 +29,24 @@
#define _ACCELERANTDRIVER_H_ #define _ACCELERANTDRIVER_H_
#include <Accelerant.h> #include <Accelerant.h>
#include "DisplayDriver.h"
#include "PatternHandler.h" #include "PatternHandler.h"
#include "FontServer.h" #include "FontServer.h"
#include "LayerData.h" #include "LayerData.h"
#include "DisplayDriverImpl.h"
class ServerBitmap; class ServerBitmap;
class ServerCursor; class ServerCursor;
class AccelerantDriver : public DisplayDriver class AccelerantDriver : public DisplayDriverImpl
{ {
public: public:
AccelerantDriver(void); AccelerantDriver();
~AccelerantDriver(void); ~AccelerantDriver();
bool Initialize(void); bool Initialize();
void Shutdown(void); void Shutdown();
virtual void InvertRect(const BRect &r); virtual void InvertRect(const BRect &r);
virtual void SetMode(const int32 &mode); virtual void SetMode(const int32 &mode);
@@ -54,8 +56,8 @@ public:
/* /*
virtual status_t SetDPMSMode(const uint32 &state); virtual status_t SetDPMSMode(const uint32 &state);
virtual uint32 DPMSMode(void) const; virtual uint32 DPMSMode() const;
virtual uint32 DPMSCapabilities(void) const; virtual uint32 DPMSCapabilities() const;
virtual status_t GetDeviceInfo(accelerant_device_info *info); virtual status_t GetDeviceInfo(accelerant_device_info *info);
virtual status_t GetModeList(display_mode **mode_list, uint32 *count); virtual status_t GetModeList(display_mode **mode_list, uint32 *count);
virtual status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high); virtual status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high);
+7 -27
View File
@@ -52,7 +52,11 @@ extern RGBColor workspace_default_color; // defined in AppServer.cpp
Subclasses should follow DisplayDriver's lead and use this function mostly Subclasses should follow DisplayDriver's lead and use this function mostly
for initializing data members. for initializing data members.
*/ */
BitmapDriver::BitmapDriver(void) : DisplayDriver() BitmapDriver::BitmapDriver()
: DisplayDriverImpl(),
// NOTE: fLineThickness appeared to be never
// initialized in DisplayDriver
fLineThickness(1)
{ {
fTarget=NULL; fTarget=NULL;
fGraphicsBuffer=NULL; fGraphicsBuffer=NULL;
@@ -64,34 +68,10 @@ BitmapDriver::BitmapDriver(void) : DisplayDriver()
Subclasses should use the destructor mostly for freeing allocated heap space. Subclasses should use the destructor mostly for freeing allocated heap space.
*/ */
BitmapDriver::~BitmapDriver(void) BitmapDriver::~BitmapDriver()
{ {
} }
/*!
\brief Initializes the driver object.
\return true if successful, false if not
Initialize sets up the driver for display, including the initial clearing
of the screen. If things do not go as they should, false should be returned.
*/
bool BitmapDriver::Initialize(void)
{
// Nothing is needed because of SetTarget taking care of the work for us.
return true;
}
/*!
\brief Shuts down the driver's video subsystem
Any work done by Initialize() should be undone here. Note that Shutdown() is
called even if Initialize() was unsuccessful.
*/
void BitmapDriver::Shutdown(void)
{
// Nothing is needed here
}
void BitmapDriver::SetTarget(ServerBitmap *target) void BitmapDriver::SetTarget(ServerBitmap *target)
{ {
Lock(); Lock();
@@ -669,7 +649,7 @@ bool BitmapDriver::AcquireBuffer(FBBitmap *fbmp)
return true; return true;
} }
void BitmapDriver::ReleaseBuffer(void) void BitmapDriver::ReleaseBuffer()
{ {
} }
+12 -9
View File
@@ -37,11 +37,13 @@
#include <Region.h> // for clipping_rect definition #include <Region.h> // for clipping_rect definition
#include <Bitmap.h> #include <Bitmap.h>
#include <OS.h> #include <OS.h>
#include "DisplayDriver.h"
#include "FontServer.h" #include "FontServer.h"
#include "GraphicsBuffer.h" #include "GraphicsBuffer.h"
#include "PixelRenderer.h" #include "PixelRenderer.h"
#include "DisplayDriverImpl.h"
class ServerCursor; class ServerCursor;
class ServerBitmap; class ServerBitmap;
class RGBColor; class RGBColor;
@@ -60,17 +62,14 @@ class PatternHandler;
Usage: Allocate and call SetTarget on the desired ServerBitmap and start calling Usage: Allocate and call SetTarget on the desired ServerBitmap and start calling
graphics methods. All ServerBitmap memory belongs to the BitmapManager. graphics methods. All ServerBitmap memory belongs to the BitmapManager.
*/ */
class BitmapDriver : public DisplayDriver class BitmapDriver : public DisplayDriverImpl
{ {
public: public:
BitmapDriver(void); BitmapDriver();
~BitmapDriver(void); ~BitmapDriver();
bool Initialize(void);
void Shutdown(void);
void SetTarget(ServerBitmap *target); void SetTarget(ServerBitmap *target);
ServerBitmap *GetTarget(void) const { return fTarget; } ServerBitmap *GetTarget() const { return fTarget; }
// Settings functions // Settings functions
// virtual void DrawBitmap(ServerBitmap *bmp, const BRect &src, const BRect &dest, const DrawData *d); // virtual void DrawBitmap(ServerBitmap *bmp, const BRect &src, const BRect &dest, const DrawData *d);
@@ -80,7 +79,7 @@ public:
virtual void InvertRect(const BRect &rect); virtual void InvertRect(const BRect &rect);
protected: protected:
virtual bool AcquireBuffer(FBBitmap *bmp); virtual bool AcquireBuffer(FBBitmap *bmp);
virtual void ReleaseBuffer(void); virtual void ReleaseBuffer();
virtual void Blit(const BRect &src, const BRect &dest, const DrawData *d); virtual void Blit(const BRect &src, const BRect &dest, const DrawData *d);
virtual void FillSolidRect(const BRect &rect, const RGBColor &color); virtual void FillSolidRect(const BRect &rect, const RGBColor &color);
@@ -102,6 +101,10 @@ protected:
ServerBitmap *fTarget; ServerBitmap *fTarget;
GraphicsBuffer *fGraphicsBuffer; GraphicsBuffer *fGraphicsBuffer;
PixelRenderer *fPixelRenderer; PixelRenderer *fPixelRenderer;
// NOTE: completely outdated?
int fLineThickness;
PatternHandler fDrawPattern;
}; };
#endif #endif
+2
View File
@@ -1,6 +1,8 @@
#ifndef CURSORDATA_H_ #ifndef CURSORDATA_H_
#define CURSORDATA_H_ #define CURSORDATA_H_
#include <SupportDefs.h>
extern int8 default_cursor_data[]; extern int8 default_cursor_data[];
extern int8 default_text_data[]; extern int8 default_text_data[];
extern int8 default_move_data[]; extern int8 default_move_data[];
+44 -36
View File
@@ -36,6 +36,7 @@ CursorHandler::CursorHandler(DisplayDriver *driver)
fSavedData(NULL), fSavedData(NULL),
fCursor(NULL), fCursor(NULL),
fHideLevel(0), fHideLevel(0),
fDrawData(),
fDriverHidden(false), fDriverHidden(false),
fIsObscured(false), fIsObscured(false),
fValidSaveData(false) fValidSaveData(false)
@@ -92,28 +93,34 @@ void CursorHandler::SetCursor(ServerCursor *cursor)
This function fails if asked to move the cursor outside the screen boundaries This function fails if asked to move the cursor outside the screen boundaries
*/ */
void CursorHandler::MoveTo(const BPoint &pt) void CursorHandler::MoveTo(BPoint pt)
{ {
if(pt.x<0 || pt.y<0 || (pt.x>fDriver->fDisplayMode.virtual_width-1) || pt.x = max_c(pt.x, 0.0);
(pt.y>fDriver->fDisplayMode.virtual_height-1)) pt.y = max_c(pt.y, 0.0);
return; pt.x = min_c(pt.x, fDriver->DisplayMode()->virtual_width - 1);
pt.y = min_c(pt.y, fDriver->DisplayMode()->virtual_height - 1);
fCursorPos=pt; if (fCursorPos != pt) {
if (!fSavedData)
debugger("NULL savedata\n");
fDriver->CopyBitmap(fSavedData,fSavedData->Bounds(),fOldPosition,&(fDriver->fDrawData));
fPosition.OffsetTo(fCursorPos.x-fCursor->GetHotSpot().x,
fCursorPos.y-fCursor->GetHotSpot().y);
fDriver->CopyToBitmap(fSavedData,fPosition);
fDriver->fDrawData.draw_mode=B_OP_ALPHA; fCursorPos=pt;
fDriver->CopyBitmap(fCursor,fCursor->Bounds(),fPosition,&(fDriver->fDrawData));
fDriver->fDrawData.draw_mode=B_OP_COPY;
fDriver->Invalidate(fOldPosition); if (!fSavedData)
fOldPosition=fPosition; debugger("NULL savedata\n");
fDriver->Invalidate(fPosition); fDriver->CopyBitmap(fSavedData,fSavedData->Bounds(),fOldPosition,&fDrawData);
fPosition.OffsetTo(fCursorPos.x-fCursor->GetHotSpot().x,
fCursorPos.y-fCursor->GetHotSpot().y);
fDriver->CopyToBitmap(fSavedData,fPosition);
fDrawData.draw_mode=B_OP_ALPHA;
fDriver->CopyBitmap(fCursor,fCursor->Bounds(),fPosition,&fDrawData);
fDrawData.draw_mode=B_OP_COPY;
fDriver->Invalidate(fOldPosition);
fOldPosition=fPosition;
fDriver->Invalidate(fPosition);
}
} }
//! Shows the cursor. Unlike BView, calls are not cumulative //! Shows the cursor. Unlike BView, calls are not cumulative
@@ -121,31 +128,32 @@ void CursorHandler::Show(void)
{ {
// This call is pretty simple -- save the area underneath the cursor and draw the thing // This call is pretty simple -- save the area underneath the cursor and draw the thing
if(fHideLevel==0) if (fHideLevel == 0)
return; return;
fIsObscured=false; fIsObscured = false;
fHideLevel--; fHideLevel--;
if(fHideLevel>0) if (fHideLevel > 0)
return; return;
fOldPosition=fPosition; fOldPosition = fPosition;
if(!fCursor) if (!fCursor)
return; return;
fValidSaveData=true; fValidSaveData = true;
if(!fSavedData) if (!fSavedData)
fSavedData=new UtilityBitmap(fCursor->Bounds(),(color_space)fDriver->fDisplayMode.space,0); fSavedData = new UtilityBitmap(fCursor->Bounds(),
(color_space)fDriver->DisplayMode()->space, 0);
fDriver->CopyToBitmap(fSavedData,fPosition); fDriver->CopyToBitmap(fSavedData, fPosition);
// Draw the data to the buffer // Draw the data to the buffer
fDriver->fDrawData.draw_mode=B_OP_ALPHA; fDrawData.draw_mode = B_OP_ALPHA;
fDriver->CopyBitmap(fCursor,fCursor->Bounds(),fPosition,&(fDriver->fDrawData)); fDriver->CopyBitmap(fCursor, fCursor->Bounds(), fPosition, &fDrawData);
fDriver->fDrawData.draw_mode=B_OP_COPY; fDrawData.draw_mode = B_OP_COPY;
fDriver->Invalidate(fPosition); fDriver->Invalidate(fPosition);
} }
@@ -172,7 +180,7 @@ void CursorHandler::Hide(void)
if(!fSavedData) if(!fSavedData)
fSavedData=new UtilityBitmap(fCursor); fSavedData=new UtilityBitmap(fCursor);
fDriver->CopyBitmap(fSavedData,fSavedData->Bounds(),fOldPosition,&(fDriver->fDrawData)); fDriver->CopyBitmap(fSavedData,fSavedData->Bounds(),fOldPosition,&fDrawData);
fDriver->Invalidate(fPosition); fDriver->Invalidate(fPosition);
} }
@@ -193,7 +201,7 @@ void CursorHandler::Obscure(void)
return; return;
} }
fDriver->CopyBitmap(fSavedData,fSavedData->Bounds(),fOldPosition,&(fDriver->fDrawData)); fDriver->CopyBitmap(fSavedData,fSavedData->Bounds(),fOldPosition,&fDrawData);
fDriver->Invalidate(fPosition); fDriver->Invalidate(fPosition);
} }
@@ -210,7 +218,7 @@ void CursorHandler::DriverHide(void)
if(!fSavedData) if(!fSavedData)
fSavedData=new UtilityBitmap(fCursor); fSavedData=new UtilityBitmap(fCursor);
fDriver->CopyBitmap(fSavedData,fSavedData->Bounds(),fOldPosition,&(fDriver->fDrawData)); fDriver->CopyBitmap(fSavedData,fSavedData->Bounds(),fOldPosition,&fDrawData);
fDriver->Invalidate(fPosition); fDriver->Invalidate(fPosition);
} }
@@ -229,13 +237,13 @@ void CursorHandler::DriverShow(void)
fValidSaveData=true; fValidSaveData=true;
if(!fSavedData) if(!fSavedData)
fSavedData=new UtilityBitmap(fCursor->Bounds(),(color_space)fDriver->fDisplayMode.space,0); fSavedData=new UtilityBitmap(fCursor->Bounds(),(color_space)fDriver->DisplayMode()->space,0);
fDriver->CopyToBitmap(fSavedData,fPosition); fDriver->CopyToBitmap(fSavedData,fPosition);
// Draw the data to the buffer // Draw the data to the buffer
fDriver->fDrawData.draw_mode=B_OP_ALPHA; fDrawData.draw_mode=B_OP_ALPHA;
fDriver->CopyBitmap(fCursor,fCursor->Bounds(),fPosition,&(fDriver->fDrawData)); fDriver->CopyBitmap(fCursor,fCursor->Bounds(),fPosition,&fDrawData);
fDriver->fDrawData.draw_mode=B_OP_COPY; fDrawData.draw_mode=B_OP_COPY;
fDriver->Invalidate(fPosition); fDriver->Invalidate(fPosition);
} }
+24 -18
View File
@@ -102,7 +102,8 @@ extern RGBColor workspace_default_color;
by a couple orders of magnitude by a couple orders of magnitude
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
DirectDriver::DirectDriver(void) DirectDriver::DirectDriver()
: DisplayDriverImpl()
{ {
ATRACE(("DirectDriver::DirectDriver\n")); ATRACE(("DirectDriver::DirectDriver\n"));
@@ -133,7 +134,7 @@ DirectDriver::DirectDriver(void)
#endif #endif
} }
DirectDriver::~DirectDriver(void) DirectDriver::~DirectDriver()
{ {
ATRACE(("DirectDriver::~DirectDriver\n")); ATRACE(("DirectDriver::~DirectDriver\n"));
Lock(); Lock();
@@ -143,20 +144,25 @@ DirectDriver::~DirectDriver(void)
Unlock(); Unlock();
} }
bool DirectDriver::Initialize(void) bool DirectDriver::Initialize()
{ {
ATRACE(("DirectDriver::Initialize\n")); if (DisplayDriver::Initialize()) {
screenwin=new DDWindow(640,480,B_RGB32,this); ATRACE(("DirectDriver::Initialize\n"));
while(find_thread("drawing_thread")==B_NAME_NOT_FOUND) screenwin=new DDWindow(640,480,B_RGB32,this);
{ while(find_thread("drawing_thread")==B_NAME_NOT_FOUND)
ATRACE(("\tWaiting for the drawing thread to spawn\n")); {
snooze(100); ATRACE(("\tWaiting for the drawing thread to spawn\n"));
snooze(100);
}
return true;
} }
return true; return false;
} }
void DirectDriver::Shutdown(void) void DirectDriver::Shutdown()
{ {
DisplayDriver::Shutdown();
ATRACE(("DirectDriver::Shutdown\n")); ATRACE(("DirectDriver::Shutdown\n"));
screenwin->PostMessage(B_QUIT_REQUESTED); screenwin->PostMessage(B_QUIT_REQUESTED);
@@ -433,14 +439,14 @@ status_t DirectDriver::SetDPMSMode(const uint32 &state)
return BScreen().SetDPMS(state); return BScreen().SetDPMS(state);
} }
uint32 DirectDriver::DPMSMode(void) const uint32 DirectDriver::DPMSMode() const
{ {
STRACE(("DirectDriver::DPMSMode\n")); STRACE(("DirectDriver::DPMSMode\n"));
// This is a hack, but should do enough to be ok for our purposes // This is a hack, but should do enough to be ok for our purposes
return BScreen().DPMSState(); return BScreen().DPMSState();
} }
uint32 DirectDriver::DPMSCapabilities(void) const uint32 DirectDriver::DPMSCapabilities() const
{ {
STRACE(("DirectDriver::DPMSCapabilities\n")); STRACE(("DirectDriver::DPMSCapabilities\n"));
@@ -1039,7 +1045,7 @@ DDWindow::DDWindow(uint16 width, uint16 height, color_space space, DirectDriver
Show(); Show();
} }
DDWindow::~DDWindow(void) DDWindow::~DDWindow()
{ {
int32 result; int32 result;
@@ -1097,7 +1103,7 @@ void DDWindow::DirectConnected(direct_buffer_info *info)
locker.Unlock(); locker.Unlock();
} }
bool DDWindow::QuitRequested(void) bool DDWindow::QuitRequested()
{ {
port_id serverport=find_port(SERVER_PORT_NAME); port_id serverport=find_port(SERVER_PORT_NAME);
@@ -1296,12 +1302,12 @@ int32 DDWindow::DrawingThread(void *data)
return 0; return 0;
} }
RectPipe::RectPipe(void) RectPipe::RectPipe()
{ {
list.MakeEmpty(); list.MakeEmpty();
} }
RectPipe::~RectPipe(void) RectPipe::~RectPipe()
{ {
lock.Lock(); lock.Lock();
clipping_rect *rect; clipping_rect *rect;
@@ -1357,7 +1363,7 @@ bool RectPipe::GetRect(clipping_rect *rect)
return false; return false;
} }
bool RectPipe::HasRects(void) bool RectPipe::HasRects()
{ {
lock.Lock(); lock.Lock();
bool value=has_rects; bool value=has_rects;
+15 -14
View File
@@ -34,11 +34,12 @@
#include <Region.h> // for clipping_rect definition #include <Region.h> // for clipping_rect definition
#include <GraphicsCard.h> #include <GraphicsCard.h>
#include <Message.h> #include <Message.h>
#include "DisplayDriver.h"
#include "PortLink.h" #include "PortLink.h"
#include <DirectWindow.h> #include <DirectWindow.h>
#include "PatternHandler.h" #include "PatternHandler.h"
#include "DisplayDriverImpl.h"
class UtilityBitmap; class UtilityBitmap;
class SDWindow; class SDWindow;
class LayerData; class LayerData;
@@ -51,14 +52,14 @@ class DirectDriver;
class RectPipe class RectPipe
{ {
public: public:
RectPipe(void); RectPipe();
~RectPipe(void); ~RectPipe();
void PutRect(const BRect &rect); void PutRect(const BRect &rect);
void PutRect(const clipping_rect &rect); void PutRect(const clipping_rect &rect);
bool GetRect(clipping_rect *rect); bool GetRect(clipping_rect *rect);
bool HasRects(void); bool HasRects();
int32 CountRects(void) const { return list.CountItems(); } int32 CountRects() const { return list.CountItems(); }
protected: protected:
BList list; BList list;
BLocker lock; BLocker lock;
@@ -81,9 +82,9 @@ class DDWindow : public BDirectWindow
{ {
public: public:
DDWindow(uint16 width, uint16 height, color_space space, DirectDriver *owner); DDWindow(uint16 width, uint16 height, color_space space, DirectDriver *owner);
~DDWindow(void); ~DDWindow();
virtual bool QuitRequested(void); virtual bool QuitRequested();
virtual void DirectConnected(direct_buffer_info *info); virtual void DirectConnected(direct_buffer_info *info);
virtual void WindowActivated(bool active); virtual void WindowActivated(bool active);
static int32 DrawingThread(void *data); static int32 DrawingThread(void *data);
@@ -114,14 +115,14 @@ public:
the video display. An updater thread simply locks access to this bitmap, copies data to the video display. An updater thread simply locks access to this bitmap, copies data to
the framebuffer, and releases access. Derived DisplayDriver functions operate on this bitmap. the framebuffer, and releases access. Derived DisplayDriver functions operate on this bitmap.
*/ */
class DirectDriver : public DisplayDriver class DirectDriver : public DisplayDriverImpl
{ {
public: public:
DirectDriver(void); DirectDriver();
~DirectDriver(void); ~DirectDriver();
virtual bool Initialize(void); virtual bool Initialize();
virtual void Shutdown(void); virtual void Shutdown();
// void DrawBitmap(ServerBitmap *bmp, const BRect &src, const BRect &dest, const DrawData *d); // void DrawBitmap(ServerBitmap *bmp, const BRect &src, const BRect &dest, const DrawData *d);
@@ -134,8 +135,8 @@ public:
virtual bool DumpToFile(const char *path); virtual bool DumpToFile(const char *path);
virtual status_t SetDPMSMode(const uint32 &state); virtual status_t SetDPMSMode(const uint32 &state);
virtual uint32 DPMSMode(void) const; virtual uint32 DPMSMode() const;
virtual uint32 DPMSCapabilities(void) const; virtual uint32 DPMSCapabilities() const;
virtual status_t GetDeviceInfo(accelerant_device_info *info); virtual status_t GetDeviceInfo(accelerant_device_info *info);
virtual status_t GetModeList(display_mode **mode_list, uint32 *count); virtual status_t GetModeList(display_mode **mode_list, uint32 *count);
virtual status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high); virtual status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high);
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1
View File
@@ -17,6 +17,7 @@ SharedLibrary appserver :
CursorHandler.cpp CursorHandler.cpp
Decorator.cpp Decorator.cpp
DisplayDriver.cpp DisplayDriver.cpp
DisplayDriverImpl.cpp
DisplaySupport.cpp DisplaySupport.cpp
FontFamily.cpp FontFamily.cpp
GraphicsBuffer.cpp GraphicsBuffer.cpp
+17 -12
View File
@@ -110,7 +110,7 @@ VDView::VDView(BRect bounds)
oldcursorframe=cursor->Bounds(); oldcursorframe=cursor->Bounds();
} }
VDView::~VDView(void) VDView::~VDView()
{ {
delete serverlink; delete serverlink;
delete cursor; delete cursor;
@@ -119,7 +119,7 @@ VDView::~VDView(void)
delete viewbmp; delete viewbmp;
} }
void VDView::AttachedToWindow(void) void VDView::AttachedToWindow()
{ {
} }
@@ -243,7 +243,7 @@ VDWindow::VDWindow(BRect frame)
AddChild(view); AddChild(view);
} }
VDWindow::~VDWindow(void) VDWindow::~VDWindow()
{ {
} }
@@ -441,7 +441,7 @@ void VDWindow::MessageReceived(BMessage *msg)
} }
} }
bool VDWindow::QuitRequested(void) bool VDWindow::QuitRequested()
{ {
port_id serverport=find_port(SERVER_PORT_NAME); port_id serverport=find_port(SERVER_PORT_NAME);
@@ -483,7 +483,8 @@ void VDWindow::WindowActivated(bool active)
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
ViewDriver::ViewDriver(void) ViewDriver::ViewDriver()
: DisplayDriverImpl()
{ {
fDisplayMode.virtual_width=640; fDisplayMode.virtual_width=640;
fDisplayMode.virtual_height=480; fDisplayMode.virtual_height=480;
@@ -500,7 +501,7 @@ ViewDriver::ViewDriver(void)
framebuffer->Unlock(); framebuffer->Unlock();
} }
ViewDriver::~ViewDriver(void) ViewDriver::~ViewDriver()
{ {
if(is_initialized) if(is_initialized)
{ {
@@ -510,7 +511,8 @@ ViewDriver::~ViewDriver(void)
} }
} }
bool ViewDriver::Initialize(void) bool
ViewDriver::Initialize()
{ {
Lock(); Lock();
@@ -531,11 +533,14 @@ bool ViewDriver::Initialize(void)
// because the window is locked until Show() is first called // because the window is locked until Show() is first called
screenwin->Show(); screenwin->Show();
Unlock(); Unlock();
return true;
return DisplayDriver::Initialize();
} }
void ViewDriver::Shutdown(void) void ViewDriver::Shutdown()
{ {
DisplayDriver::Shutdown();
Lock(); Lock();
is_initialized=false; is_initialized=false;
Unlock(); Unlock();
@@ -916,13 +921,13 @@ status_t ViewDriver::SetDPMSMode(const uint32 &state)
return BScreen().SetDPMS(state); return BScreen().SetDPMS(state);
} }
uint32 ViewDriver::DPMSMode(void) const uint32 ViewDriver::DPMSMode() const
{ {
// See note for SetDPMSMode if there are questions // See note for SetDPMSMode if there are questions
return BScreen().DPMSState(); return BScreen().DPMSState();
} }
uint32 ViewDriver::DPMSCapabilities(void) const uint32 ViewDriver::DPMSCapabilities() const
{ {
// See note for SetDPMSMode if there are questions // See note for SetDPMSMode if there are questions
return BScreen().DPMSCapabilites(); return BScreen().DPMSCapabilites();
@@ -1205,7 +1210,7 @@ bool ViewDriver::AcquireBuffer(FBBitmap *bmp)
return true; return true;
} }
void ViewDriver::ReleaseBuffer(void) void ViewDriver::ReleaseBuffer()
{ {
if(!is_initialized) if(!is_initialized)
return; return;
+14 -13
View File
@@ -36,9 +36,10 @@
#include <Message.h> #include <Message.h>
#include <Region.h> #include <Region.h>
#include <Font.h> #include <Font.h>
#include "DisplayDriver.h"
#include "FontServer.h" #include "FontServer.h"
#include "DisplayDriverImpl.h"
class BBitmap; class BBitmap;
class BPortLink; class BPortLink;
class VDWindow; class VDWindow;
@@ -48,8 +49,8 @@ class VDView : public BView
{ {
public: public:
VDView(BRect bounds); VDView(BRect bounds);
~VDView(void); ~VDView();
void AttachedToWindow(void); void AttachedToWindow();
void Draw(BRect rect); void Draw(BRect rect);
void MouseDown(BPoint pt); void MouseDown(BPoint pt);
void MouseMoved(BPoint pt, uint32 transit, const BMessage *msg); void MouseMoved(BPoint pt, uint32 transit, const BMessage *msg);
@@ -70,9 +71,9 @@ class VDWindow : public BWindow
{ {
public: public:
VDWindow(BRect frame); VDWindow(BRect frame);
~VDWindow(void); ~VDWindow();
void MessageReceived(BMessage *msg); void MessageReceived(BMessage *msg);
bool QuitRequested(void); bool QuitRequested();
void WindowActivated(bool active); void WindowActivated(bool active);
VDView *view; VDView *view;
@@ -96,14 +97,14 @@ public:
VDWindow - does most of the work. VDWindow - does most of the work.
VDView - doesn't do all that much except display the rendered bitmap VDView - doesn't do all that much except display the rendered bitmap
*/ */
class ViewDriver : public DisplayDriver class ViewDriver : public DisplayDriverImpl
{ {
public: public:
ViewDriver(void); ViewDriver();
~ViewDriver(void); ~ViewDriver();
virtual bool Initialize(void); // Sets the driver virtual bool Initialize(); // Sets the driver
virtual void Shutdown(void); // You never know when you'll need this virtual void Shutdown(); // You never know when you'll need this
// Drawing functions // Drawing functions
// void DrawBitmap(ServerBitmap *bmp, const BRect &src, const BRect &dest, const DrawData *d); // void DrawBitmap(ServerBitmap *bmp, const BRect &src, const BRect &dest, const DrawData *d);
@@ -120,8 +121,8 @@ public:
VDWindow *screenwin; VDWindow *screenwin;
virtual status_t SetDPMSMode(const uint32 &state); virtual status_t SetDPMSMode(const uint32 &state);
virtual uint32 DPMSMode(void) const; virtual uint32 DPMSMode() const;
virtual uint32 DPMSCapabilities(void) const; virtual uint32 DPMSCapabilities() const;
virtual status_t GetDeviceInfo(accelerant_device_info *info); virtual status_t GetDeviceInfo(accelerant_device_info *info);
virtual status_t GetModeList(display_mode **mode_list, uint32 *count); virtual status_t GetModeList(display_mode **mode_list, uint32 *count);
virtual status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high); virtual status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high);
@@ -146,7 +147,7 @@ protected:
virtual bool AcquireBuffer(FBBitmap *bmp); virtual bool AcquireBuffer(FBBitmap *bmp);
virtual void ReleaseBuffer(void); virtual void ReleaseBuffer();
virtual void Invalidate(const BRect &r); virtual void Invalidate(const BRect &r);
// void BlitMono2RGB32(FT_Bitmap *src, BPoint pt, DrawData *d); // void BlitMono2RGB32(FT_Bitmap *src, BPoint pt, DrawData *d);