AccelerantHWInterface now uses a MallocBuffer as RenderingBuffer for the back buffer instead of a BitmapBuffer, which under Haiku does not work.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12217 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
7d5778defa
commit
8940f93c1d
@ -43,6 +43,7 @@
|
||||
|
||||
#if DISPLAYDRIVER == HWDRIVER
|
||||
#include "AccelerantDriver.h"
|
||||
// #include "DisplayDriverPainter.h"
|
||||
#elif DISPLAYDRIVER == DIRECTDRIVER
|
||||
#include "DirectDriver.h"
|
||||
#elif DISPLAYDRIVER == PAINTERDRIVER
|
||||
@ -94,6 +95,7 @@ Desktop::Init(void)
|
||||
bool initDrivers = true;
|
||||
while (initDrivers) {
|
||||
driver = new AccelerantDriver();
|
||||
// driver = new DisplayDriverPainter();
|
||||
AddDriver(driver);
|
||||
initDrivers = false;
|
||||
}
|
||||
|
@ -21,7 +21,14 @@ if ( $(TARGET_PLATFORM) = haiku ) {
|
||||
SubDirCcFlags $(defines) ;
|
||||
SubDirC++Flags $(defines) ;
|
||||
|
||||
VIEW_DRIVER_SOURCES = AccelerantDriver.cpp ;
|
||||
VIEW_DRIVER_SOURCES =
|
||||
# AccelerantBuffer.cpp
|
||||
AccelerantDriver.cpp
|
||||
# AccelerantHWInterface.cpp
|
||||
# DisplayDriverPainter.cpp
|
||||
# HWInterface.cpp
|
||||
# UpdateQueue.cpp
|
||||
;
|
||||
} else {
|
||||
VIEW_DRIVER_SOURCES =
|
||||
fake_input_server.cpp
|
||||
@ -36,6 +43,7 @@ if ( $(TARGET_PLATFORM) = haiku ) {
|
||||
AccelerantBuffer.cpp
|
||||
DisplayDriverPainter.cpp
|
||||
HWInterface.cpp
|
||||
MallocBuffer.cpp
|
||||
UpdateQueue.cpp
|
||||
ViewHWInterface.cpp
|
||||
AccelerantHWInterface.cpp
|
||||
@ -111,6 +119,7 @@ if $(TARGET_PLATFORM) = haiku {
|
||||
LinkSharedOSLibs app_server :
|
||||
libroot.so libtranslation.so libz.so libpng.so libbe.so
|
||||
libappserver.so libfreetype.so libtextencoding.so ;
|
||||
# libagg.a libpainter.a ;
|
||||
|
||||
} else {
|
||||
# link as test application under R5
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
#include "AccelerantHWInterface.h"
|
||||
#include "AccelerantBuffer.h"
|
||||
#include "BitmapBuffer.h"
|
||||
#include "MallocBuffer.h"
|
||||
|
||||
|
||||
#ifdef DEBUG_DRIVER_MODULE
|
||||
@ -332,22 +332,23 @@ AccelerantHWInterface::SetMode(const display_mode &mode)
|
||||
// NOTE: backbuffer is always B_RGBA32, this simplifies the
|
||||
// drawing backend implementation tremendously for the time
|
||||
// being. The color space conversion is handled in CopyBackToFront()
|
||||
BRect bounds(0, 0, fDisplayMode.virtual_width - 1, fDisplayMode.virtual_height - 1);
|
||||
BBitmap *backBitmap = new BBitmap(bounds, 0, B_RGBA32);
|
||||
|
||||
delete fBackBuffer;
|
||||
fBackBuffer = new BitmapBuffer(backBitmap);
|
||||
fBackBuffer = new MallocBuffer(fDisplayMode.virtual_width - 1,
|
||||
fDisplayMode.virtual_height - 1);
|
||||
|
||||
if (fBackBuffer->InitCheck() != B_OK) {
|
||||
status_t ret = fBackBuffer->InitCheck();
|
||||
if (ret < B_OK) {
|
||||
delete fBackBuffer;
|
||||
fBackBuffer = NULL;
|
||||
return B_ERROR;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// clear out backbuffer, alpha is 255 this way
|
||||
// TODO: maybe this should handle different color spaces in different
|
||||
// ways
|
||||
memset(backBitmap->Bits(), 255, backBitmap->BitsLength());
|
||||
memset(fBackBuffer->Bits(), 255,
|
||||
fBackBuffer->BytesPerRow() * fBackBuffer->Height());
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "HWInterface.h"
|
||||
#include <image.h>
|
||||
|
||||
class BitmapBuffer;
|
||||
class MallocBuffer;
|
||||
class AccelerantBuffer;
|
||||
class UpdateQueue;
|
||||
|
||||
@ -96,7 +96,7 @@ private:
|
||||
display_mode *fModeList;
|
||||
|
||||
|
||||
BitmapBuffer *fBackBuffer;
|
||||
MallocBuffer *fBackBuffer;
|
||||
AccelerantBuffer *fFrontBuffer;
|
||||
|
||||
|
||||
|
80
src/servers/app/drawing/MallocBuffer.cpp
Normal file
80
src/servers/app/drawing/MallocBuffer.cpp
Normal file
@ -0,0 +1,80 @@
|
||||
// MallocBuffer.h
|
||||
|
||||
#include <malloc.h>
|
||||
|
||||
#include "MallocBuffer.h"
|
||||
|
||||
// TODO: maybe this class could be more flexible by taking
|
||||
// a color_space argument in the constructor
|
||||
// the hardcoded width * 4 (because that's how it's used now anyways)
|
||||
// could be avoided, but I'm in a hurry... :-)
|
||||
|
||||
// constructor
|
||||
MallocBuffer::MallocBuffer(uint32 width,
|
||||
uint32 height)
|
||||
: fBuffer(NULL),
|
||||
fWidth(width),
|
||||
fHeight(height)
|
||||
{
|
||||
if (fWidth > 0 && fHeight > 0) {
|
||||
fBuffer = malloc((fWidth * 4) * fHeight);
|
||||
}
|
||||
}
|
||||
|
||||
// destructor
|
||||
MallocBuffer::~MallocBuffer()
|
||||
{
|
||||
if (fBuffer)
|
||||
free(fBuffer);
|
||||
}
|
||||
|
||||
// InitCheck
|
||||
status_t
|
||||
MallocBuffer::InitCheck() const
|
||||
{
|
||||
return fBuffer ? B_OK : B_NO_MEMORY;
|
||||
}
|
||||
|
||||
// ColorSpace
|
||||
color_space
|
||||
MallocBuffer::ColorSpace() const
|
||||
{
|
||||
return B_RGBA32;
|
||||
}
|
||||
|
||||
// Bits
|
||||
void*
|
||||
MallocBuffer::Bits() const
|
||||
{
|
||||
if (InitCheck() >= B_OK)
|
||||
return fBuffer;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// BytesPerRow
|
||||
uint32
|
||||
MallocBuffer::BytesPerRow() const
|
||||
{
|
||||
if (InitCheck() >= B_OK)
|
||||
return fWidth * 4;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Width
|
||||
uint32
|
||||
MallocBuffer::Width() const
|
||||
{
|
||||
if (InitCheck() >= B_OK)
|
||||
return fWidth;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Height
|
||||
uint32
|
||||
MallocBuffer::Height() const
|
||||
{
|
||||
if (InitCheck() >= B_OK)
|
||||
return fHeight;
|
||||
return 0;
|
||||
}
|
||||
|
31
src/servers/app/drawing/MallocBuffer.h
Normal file
31
src/servers/app/drawing/MallocBuffer.h
Normal file
@ -0,0 +1,31 @@
|
||||
// MallocBuffer.h
|
||||
|
||||
#ifndef MALLOC_BUFFER_H
|
||||
#define MALLOC_BUFFER_H
|
||||
|
||||
#include "RenderingBuffer.h"
|
||||
|
||||
class BBitmap;
|
||||
|
||||
class MallocBuffer : public RenderingBuffer {
|
||||
public:
|
||||
MallocBuffer(uint32 width,
|
||||
uint32 height);
|
||||
virtual ~MallocBuffer();
|
||||
|
||||
virtual status_t InitCheck() const;
|
||||
|
||||
virtual color_space ColorSpace() const;
|
||||
virtual void* Bits() const;
|
||||
virtual uint32 BytesPerRow() const;
|
||||
virtual uint32 Width() const;
|
||||
virtual uint32 Height() const;
|
||||
|
||||
private:
|
||||
|
||||
void* fBuffer;
|
||||
uint32 fWidth;
|
||||
uint32 fHeight;
|
||||
};
|
||||
|
||||
#endif // MALLOC_BUFFER_H
|
Loading…
x
Reference in New Issue
Block a user