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:
@@ -43,6 +43,7 @@
|
|||||||
|
|
||||||
#if DISPLAYDRIVER == HWDRIVER
|
#if DISPLAYDRIVER == HWDRIVER
|
||||||
#include "AccelerantDriver.h"
|
#include "AccelerantDriver.h"
|
||||||
|
// #include "DisplayDriverPainter.h"
|
||||||
#elif DISPLAYDRIVER == DIRECTDRIVER
|
#elif DISPLAYDRIVER == DIRECTDRIVER
|
||||||
#include "DirectDriver.h"
|
#include "DirectDriver.h"
|
||||||
#elif DISPLAYDRIVER == PAINTERDRIVER
|
#elif DISPLAYDRIVER == PAINTERDRIVER
|
||||||
@@ -94,6 +95,7 @@ Desktop::Init(void)
|
|||||||
bool initDrivers = true;
|
bool initDrivers = true;
|
||||||
while (initDrivers) {
|
while (initDrivers) {
|
||||||
driver = new AccelerantDriver();
|
driver = new AccelerantDriver();
|
||||||
|
// driver = new DisplayDriverPainter();
|
||||||
AddDriver(driver);
|
AddDriver(driver);
|
||||||
initDrivers = false;
|
initDrivers = false;
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-1
@@ -21,7 +21,14 @@ if ( $(TARGET_PLATFORM) = haiku ) {
|
|||||||
SubDirCcFlags $(defines) ;
|
SubDirCcFlags $(defines) ;
|
||||||
SubDirC++Flags $(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 {
|
} else {
|
||||||
VIEW_DRIVER_SOURCES =
|
VIEW_DRIVER_SOURCES =
|
||||||
fake_input_server.cpp
|
fake_input_server.cpp
|
||||||
@@ -36,6 +43,7 @@ if ( $(TARGET_PLATFORM) = haiku ) {
|
|||||||
AccelerantBuffer.cpp
|
AccelerantBuffer.cpp
|
||||||
DisplayDriverPainter.cpp
|
DisplayDriverPainter.cpp
|
||||||
HWInterface.cpp
|
HWInterface.cpp
|
||||||
|
MallocBuffer.cpp
|
||||||
UpdateQueue.cpp
|
UpdateQueue.cpp
|
||||||
ViewHWInterface.cpp
|
ViewHWInterface.cpp
|
||||||
AccelerantHWInterface.cpp
|
AccelerantHWInterface.cpp
|
||||||
@@ -111,6 +119,7 @@ if $(TARGET_PLATFORM) = haiku {
|
|||||||
LinkSharedOSLibs app_server :
|
LinkSharedOSLibs app_server :
|
||||||
libroot.so libtranslation.so libz.so libpng.so libbe.so
|
libroot.so libtranslation.so libz.so libpng.so libbe.so
|
||||||
libappserver.so libfreetype.so libtextencoding.so ;
|
libappserver.so libfreetype.so libtextencoding.so ;
|
||||||
|
# libagg.a libpainter.a ;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
# link as test application under R5
|
# link as test application under R5
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
#include "AccelerantHWInterface.h"
|
#include "AccelerantHWInterface.h"
|
||||||
#include "AccelerantBuffer.h"
|
#include "AccelerantBuffer.h"
|
||||||
#include "BitmapBuffer.h"
|
#include "MallocBuffer.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_DRIVER_MODULE
|
#ifdef DEBUG_DRIVER_MODULE
|
||||||
@@ -332,22 +332,23 @@ AccelerantHWInterface::SetMode(const display_mode &mode)
|
|||||||
// NOTE: backbuffer is always B_RGBA32, this simplifies the
|
// NOTE: backbuffer is always B_RGBA32, this simplifies the
|
||||||
// drawing backend implementation tremendously for the time
|
// drawing backend implementation tremendously for the time
|
||||||
// being. The color space conversion is handled in CopyBackToFront()
|
// 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;
|
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;
|
delete fBackBuffer;
|
||||||
fBackBuffer = NULL;
|
fBackBuffer = NULL;
|
||||||
return B_ERROR;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear out backbuffer, alpha is 255 this way
|
// clear out backbuffer, alpha is 255 this way
|
||||||
// TODO: maybe this should handle different color spaces in different
|
// TODO: maybe this should handle different color spaces in different
|
||||||
// ways
|
// ways
|
||||||
memset(backBitmap->Bits(), 255, backBitmap->BitsLength());
|
memset(fBackBuffer->Bits(), 255,
|
||||||
|
fBackBuffer->BytesPerRow() * fBackBuffer->Height());
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#include "HWInterface.h"
|
#include "HWInterface.h"
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
|
|
||||||
class BitmapBuffer;
|
class MallocBuffer;
|
||||||
class AccelerantBuffer;
|
class AccelerantBuffer;
|
||||||
class UpdateQueue;
|
class UpdateQueue;
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ private:
|
|||||||
display_mode *fModeList;
|
display_mode *fModeList;
|
||||||
|
|
||||||
|
|
||||||
BitmapBuffer *fBackBuffer;
|
MallocBuffer *fBackBuffer;
|
||||||
AccelerantBuffer *fFrontBuffer;
|
AccelerantBuffer *fFrontBuffer;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -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
|
||||||
Reference in New Issue
Block a user