I put all that was found in Screen.h and Screen.cpp because there is another Screen.h on the system. BScren's one!

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6060 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca
2004-01-13 11:00:22 +00:00
parent 037eadad77
commit 8ee0c850de
2 changed files with 42 additions and 30 deletions
+21 -15
View File
@@ -11,27 +11,31 @@ Screen::Screen(DisplayDriver *dDriver, BPoint res, uint32 colorspace,
const int32 &ID) const int32 &ID)
{ {
fID = ID; fID = ID;
fDriver = dDriver; fDDriver = dDriver;
SetResolution(res, colorspace); SetResolution(res, colorspace);
} }
Screen::Screen(void)
{
}
Screen::~Screen(void){ Screen::~Screen(void){
//printf("~Screen( %ld )\n", fID); //printf("~Screen( %ld )\n", fID);
} }
bool Screen::SupportsResolution(const BPoint &res, const uint32 &colorspace) void Screen::SetColorSpace(const uint32 &colorspace){
{ // fDDriver->SetColorSpace(colorspace);
display_mode *dm=NULL; }
uint32 Screen::ColorSpace(void) const{
// return fDDriver->ColorSpace();
}
bool Screen::SupportsResolution(BPoint res, uint32 colorspace){
// TODO: remove/improve
return true;
display_mode *dm = NULL;
uint32 count; uint32 count;
fDriver->GetModeList(&dm, &count); fDDriver->GetModeList(&dm, &count);
for (uint32 i=0; i < count; i++) for (uint32 i=0; i < count; i++){
{
if (dm[i].virtual_width == (uint16)res.x && if (dm[i].virtual_width == (uint16)res.x &&
dm[i].virtual_height == (uint16)res.y && dm[i].virtual_height == (uint16)res.y &&
dm[i].space == colorspace) dm[i].space == colorspace)
@@ -42,8 +46,7 @@ bool Screen::SupportsResolution(const BPoint &res, const uint32 &colorspace)
return false; return false;
} }
bool Screen::SetResolution(const BPoint &res, const uint32 &colorspace) bool Screen::SetResolution(BPoint res, uint32 colorspace){
{
if (!SupportsResolution(res, colorspace)) if (!SupportsResolution(res, colorspace))
return false; return false;
@@ -53,7 +56,7 @@ bool Screen::SetResolution(const BPoint &res, const uint32 &colorspace)
mode.virtual_height = (uint16)res.y; mode.virtual_height = (uint16)res.y;
mode.space = colorspace; mode.space = colorspace;
fDriver->SetMode(mode); // fDDriver->SetMode(&mode);
return true; return true;
} }
@@ -61,7 +64,10 @@ bool Screen::SetResolution(const BPoint &res, const uint32 &colorspace)
BPoint Screen::Resolution() const{ BPoint Screen::Resolution() const{
display_mode mode; display_mode mode;
fDriver->GetMode(&mode); // fDDriver->GetMode(&mode);
//TODO: remove!
return BPoint(fDDriver->GetWidth(), fDDriver->GetHeight());
//------------
return BPoint(mode.virtual_width, mode.virtual_height); return BPoint(mode.virtual_width, mode.virtual_height);
} }
+21 -15
View File
@@ -1,30 +1,36 @@
#ifndef _SERVERSCREEN_H_ #ifndef _SCREEN_H_
#define _SERVERSCREEN_H_ #define _SCREEN_H_
#include <Point.h> #include <Point.h>
#include "DisplayDriver.h" //#include "DisplayDriver.h"
class DisplayDriver;
class Screen{ class Screen{
public: public:
Screen(DisplayDriver *dDriver, BPoint res, uint32 colorspace, const int32 &ID); Screen(DisplayDriver *dDriver, BPoint res,
Screen(void); uint32 colorspace, const int32 &ID);
~Screen(void); Screen(){ ; }
~Screen(void);
void SetID(int32 ID){ fID = ID; } void SetColorSpace(const uint32 &colorspace);
uint32 ColorSpace(void) const;
void SetID(int32 ID){ fID = ID; }
// TODO: get/set prototype methods for graphic card features // TODO: get/set prototype methods for graphic card features
bool SupportsResolution(const BPoint &res, const uint32 &colorspace); bool SupportsResolution(BPoint res, uint32 colorspace);
bool SetResolution(const BPoint &res, const uint32 &colorspace); bool SetResolution(BPoint res, uint32 colorspace);
BPoint Resolution() const; BPoint Resolution() const;
int32 ScreenNumber(void) const; int32 ScreenNumber(void) const;
DisplayDriver* GetDriver(void) const { return fDriver; } DisplayDriver* DDriver() const { return fDDriver; }
private: private:
// TODO: add members in which we should store data. // TODO: members in witch we should store data.
int32 fID;
DisplayDriver *fDriver; int32 fID;
DisplayDriver *fDDriver;
}; };
#endif #endif