Documented some more files
ScreenDriver's Get methods return proper values Server with ViewDriver now operates as well as prototype 3 git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2736 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
bfc47a9d3b
commit
7d4ea3a3a3
@ -28,7 +28,7 @@
|
||||
#include "ServerBitmap.h"
|
||||
#include <stdio.h>
|
||||
|
||||
// Define BGET function calls here because of C++ name mangling causes link problems
|
||||
//! BGET function calls - defined here because of C++ name mangling causing link problems
|
||||
typedef long bufsize;
|
||||
extern "C" void bpool(void *buffer, bufsize len);
|
||||
extern "C" void *bget(bufsize size);
|
||||
@ -46,12 +46,16 @@ extern "C" void bufdump(void *buf);
|
||||
extern "C" void bpoold(void *pool, int dumpalloc, int dumpfree);
|
||||
extern "C" int bpoolv(void *pool);
|
||||
|
||||
// This is a call which makes BGET use a couple of home-grown functions which
|
||||
// manage the buffer via area functions
|
||||
/*!
|
||||
\brief This is a call which makes BGET use a couple of home-grown functions which
|
||||
manage the buffer via area functions
|
||||
*/
|
||||
extern "C" void set_area_buffer_management(void);
|
||||
|
||||
//! Number of bytes to allocate to each area used for bitmap storage
|
||||
#define BITMAP_AREA_SIZE B_PAGE_SIZE * 2
|
||||
|
||||
//! Sets up stuff to be ready to allocate space for bitmaps
|
||||
BitmapManager::BitmapManager(void)
|
||||
{
|
||||
bmplist=new BList(0);
|
||||
@ -73,6 +77,7 @@ BitmapManager::BitmapManager(void)
|
||||
bpool(buffer,BITMAP_AREA_SIZE);
|
||||
}
|
||||
|
||||
//! Deallocates everything associated with the manager
|
||||
BitmapManager::~BitmapManager(void)
|
||||
{
|
||||
if(bmplist->CountItems()>0)
|
||||
@ -95,6 +100,15 @@ BitmapManager::~BitmapManager(void)
|
||||
delete_sem(lock);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Allocates a new ServerBitmap.
|
||||
\param bounds Size of the bitmap
|
||||
\param space Color space of the bitmap
|
||||
\param flags Bitmap flags as defined in Bitmap.h
|
||||
\param bytes_per_row Number of bytes per row.
|
||||
\param screen Screen id of the screen associated with it. Unused.
|
||||
\return A new ServerBitmap or NULL if unable to allocate one.
|
||||
*/
|
||||
ServerBitmap * BitmapManager::CreateBitmap(BRect bounds, color_space space, int32 flags,
|
||||
int32 bytes_per_row=-1, screen_id screen=B_MAIN_SCREEN_ID)
|
||||
{
|
||||
@ -117,6 +131,10 @@ ServerBitmap * BitmapManager::CreateBitmap(BRect bounds, color_space space, int3
|
||||
return bmp;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Deletes a ServerBitmap.
|
||||
\param bitmap The bitmap to delete
|
||||
*/
|
||||
void BitmapManager::DeleteBitmap(ServerBitmap *bitmap)
|
||||
{
|
||||
acquire_sem(lock);
|
||||
|
@ -34,6 +34,15 @@
|
||||
#include "TokenHandler.h"
|
||||
|
||||
class ServerBitmap;
|
||||
|
||||
/*!
|
||||
\class BitmapManager BitmapManager.h
|
||||
\brief Handler for BBitmap allocation
|
||||
|
||||
Whenever a ServerBitmap associated with a client-side BBitmap needs to be
|
||||
created or destroyed, the BitmapManager needs to handle it. It takes care of
|
||||
all memory management related to them.
|
||||
*/
|
||||
class BitmapManager
|
||||
{
|
||||
public:
|
||||
|
@ -143,8 +143,8 @@ Screen::Screen(DisplayDriver *gfxmodule, uint8 workspaces)
|
||||
_fbinfo.height=_driver->GetHeight();
|
||||
_fbinfo.display_width=_driver->GetWidth();
|
||||
_fbinfo.display_height=_driver->GetHeight();
|
||||
_fbinfo.display_x=0;
|
||||
_fbinfo.display_y=0;
|
||||
_fbinfo.display_x=_driver->GetWidth();;
|
||||
_fbinfo.display_y=_driver->GetHeight();
|
||||
|
||||
// right now, we won't do anything with the gcinfo structure. ** LAZY PROGRAMMER ALERT ** :P
|
||||
|
||||
|
@ -37,6 +37,13 @@ class DisplayDriver;
|
||||
class ServerWindow;
|
||||
class RGBColor;
|
||||
|
||||
/*!
|
||||
\class Workspace DesktopClasses.h
|
||||
\brief Object used to handle all things Workspace related.
|
||||
|
||||
Doesn't actually do a whole lot except to couple some associated data with a
|
||||
RootLayer.
|
||||
*/
|
||||
class Workspace
|
||||
{
|
||||
public:
|
||||
@ -54,6 +61,13 @@ protected:
|
||||
frame_buffer_info _fbinfo;
|
||||
};
|
||||
|
||||
/*!
|
||||
\class Screen DesktopClasses.h
|
||||
\brief Handles each DisplayDriver/video card pair and associated management.
|
||||
|
||||
There is only one per monitor. Manages all workspaces displayed on that
|
||||
particular monitor and also Window-Desktop management for all workspaces therein.
|
||||
*/
|
||||
class Screen
|
||||
{
|
||||
public:
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include <View.h>
|
||||
#include "RootLayer.h"
|
||||
#include "Desktop.h"
|
||||
#include "PatternHandler.h" // for pattern_union
|
||||
|
||||
|
||||
/*!
|
||||
\brief Sets up internal variables needed by the RootLayer
|
||||
@ -67,12 +69,14 @@ void RootLayer::RequestDraw(void)
|
||||
{
|
||||
if(!_is_dirty)
|
||||
return;
|
||||
pattern_union low;
|
||||
low.type64=0LL;
|
||||
|
||||
// Redraw the base
|
||||
for(int32 i=0; _invalid->CountRects();i++)
|
||||
{
|
||||
if(_invalid->RectAt(i).IsValid())
|
||||
_driver->FillRect(_invalid->RectAt(i),_layerdata, 0LL);
|
||||
_driver->FillRect(_invalid->RectAt(i),_layerdata, (int8*)low.type8);
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
@ -31,6 +31,14 @@
|
||||
#include "DisplayDriver.h"
|
||||
#include "Layer.h"
|
||||
|
||||
/*!
|
||||
\class RootLayer RootLayer.h
|
||||
\brief Class used for the top layer of each workspace's Layer tree
|
||||
|
||||
RootLayers are used to head up the top of each Layer tree and reimplement certain
|
||||
Layer functions to act accordingly. There is only one for each workspace class.
|
||||
|
||||
*/
|
||||
class RootLayer : public Layer
|
||||
{
|
||||
public:
|
||||
|
@ -43,6 +43,8 @@
|
||||
#include <String.h>
|
||||
#include <math.h>
|
||||
|
||||
extern RGBColor workspace_default_color; // defined in AppServer.cpp
|
||||
|
||||
//TODO: Remove the need for these
|
||||
int64 solidhigh64=0xFFFFFFFFLL;
|
||||
int8 *solidhigh=(int8*)solidhigh64;
|
||||
@ -380,11 +382,14 @@ ScreenDriver::ScreenDriver(void) : DisplayDriver()
|
||||
status_t st;
|
||||
fbuffer=new FrameBuffer("OBAppServer",B_8_BIT_640x480,&st,true);
|
||||
|
||||
drawmode = B_OP_COPY;
|
||||
|
||||
cursor=NULL;
|
||||
under_cursor=NULL;
|
||||
cursorframe.Set(0,0,0,0);
|
||||
_SetMode(B_8_BIT_640x480);
|
||||
_SetWidth(640);
|
||||
_SetHeight(480);
|
||||
_SetDepth(8);
|
||||
_SetBytesPerRow(fbuffer->FrameBufferInfo()->bytes_per_row);
|
||||
}
|
||||
|
||||
ScreenDriver::~ScreenDriver(void)
|
||||
@ -402,6 +407,20 @@ bool ScreenDriver::Initialize(void)
|
||||
// wait 1 sec for the window to show...
|
||||
snooze(500000);
|
||||
|
||||
if(fbuffer->IsConnected())
|
||||
{
|
||||
graphics_card_info *info=fbuffer->CardInfo();
|
||||
fbuffer->gcinfo=*info;
|
||||
|
||||
// clear the frame buffer. Otherwise, we'll have garbage in it
|
||||
LayerData d;
|
||||
d.highcolor=workspace_default_color;
|
||||
for(int32 i=0; i<info->height; i++)
|
||||
{
|
||||
Line(BPoint(0,i),BPoint(info->width-1,i),&d,solidhigh);
|
||||
}
|
||||
}
|
||||
|
||||
// we start out without a cursor shown because otherwise we get glitches in the
|
||||
// upper left corner. init_desktop *always* sets a cursor, so this shouldn't be a problem
|
||||
return true;
|
||||
@ -808,11 +827,17 @@ void ScreenDriver::SetMode(int32 space)
|
||||
|
||||
// clear the frame buffer. Otherwise, we'll have garbage in it
|
||||
LayerData d;
|
||||
d.highcolor.SetColor(80,85,152);
|
||||
d.highcolor=workspace_default_color;
|
||||
for(int32 i=0; i<info->height; i++)
|
||||
{
|
||||
Line(BPoint(0,i),BPoint(info->width-1,i),&d,solidhigh);
|
||||
}
|
||||
_SetMode(space);
|
||||
frame_buffer_info fbi=*fbuffer->FrameBufferInfo();
|
||||
_SetBytesPerRow(fbi.bytes_per_row);
|
||||
_SetWidth(fbi.display_width);
|
||||
_SetHeight(fbi.display_height);
|
||||
_SetDepth(fbi.bits_per_pixel);
|
||||
}
|
||||
_Unlock();
|
||||
}
|
||||
|
@ -152,7 +152,6 @@ protected:
|
||||
void SetThickPixel8(int x, int y, int thick, uint8 col);
|
||||
FrameBuffer *fbuffer;
|
||||
ServerCursor *cursor, *under_cursor;
|
||||
int32 drawmode;
|
||||
BRect cursorframe;
|
||||
};
|
||||
|
||||
|
@ -72,7 +72,7 @@ VDView::VDView(BRect bounds)
|
||||
serverlink=new PortLink(find_port(SERVER_INPUT_PORT));
|
||||
|
||||
// Create a cursor which isn't just a box
|
||||
cursor=new BBitmap(BRect(0,0,20,20),B_CMAP8,true);
|
||||
cursor=new BBitmap(BRect(0,0,20,20),B_RGBA32,true);
|
||||
BView *v=new BView(cursor->Bounds(),"v", B_FOLLOW_NONE, B_WILL_DRAW);
|
||||
hide_cursor=0;
|
||||
|
||||
@ -335,6 +335,7 @@ ViewDriver::ViewDriver(void)
|
||||
_SetHeight(480);
|
||||
_SetDepth(8);
|
||||
_SetMode(B_8_BIT_640x480);
|
||||
_SetBytesPerRow(framebuffer->BytesPerRow());
|
||||
}
|
||||
|
||||
ViewDriver::~ViewDriver(void)
|
||||
|
Loading…
Reference in New Issue
Block a user