2 * Copyright 2002-2009, Haiku.
3 * Distributed under the terms of the MIT License.
6 * Michael Lotz <mmlr@mlotz.ch>
7 * DarkWyrm <bpmagic@columbus.rr.com>
8 * Stephan Aßmus <superstippi@gmx.de>
17 #include "BitmapBuffer.h"
18 #include "BBitmapBuffer.h"
20 #include "BitmapHWInterface.h"
25 BitmapHWInterface::BitmapHWInterface(ServerBitmap
* bitmap
)
27 HWInterface(false, false),
29 fFrontBuffer(new(nothrow
) BitmapBuffer(bitmap
))
34 BitmapHWInterface::~BitmapHWInterface()
42 BitmapHWInterface::Initialize()
44 status_t ret
= HWInterface::Initialize();
48 ret
= fFrontBuffer
->InitCheck();
52 // TODO: Remove once unnecessary...
53 // fall back to double buffered mode until Painter knows how
54 // to draw onto non 32-bit surfaces...
55 if (fFrontBuffer
->ColorSpace() != B_RGB32
56 && fFrontBuffer
->ColorSpace() != B_RGBA32
) {
57 BBitmap
* backBitmap
= new BBitmap(fFrontBuffer
->Bounds(),
58 B_BITMAP_NO_SERVER_LINK
, B_RGBA32
);
59 fBackBuffer
= new BBitmapBuffer(backBitmap
);
61 ret
= fBackBuffer
->InitCheck();
66 // import the current contents of the bitmap
67 // into the back bitmap
68 backBitmap
->ImportBits(fFrontBuffer
->Bits(),
69 fFrontBuffer
->BitsLength(), fFrontBuffer
->BytesPerRow(), 0,
70 fFrontBuffer
->ColorSpace());
79 BitmapHWInterface::Shutdown()
86 BitmapHWInterface::SetMode(const display_mode
& mode
)
93 BitmapHWInterface::GetMode(display_mode
* mode
)
96 memset(mode
, 0, sizeof(display_mode
));
101 BitmapHWInterface::GetDeviceInfo(accelerant_device_info
* info
)
103 return B_UNSUPPORTED
;
108 BitmapHWInterface::GetFrameBufferConfig(frame_buffer_config
& config
)
110 return B_UNSUPPORTED
;
115 BitmapHWInterface::GetModeList(display_mode
** modes
, uint32
*count
)
117 return B_UNSUPPORTED
;
122 BitmapHWInterface::GetPixelClockLimits(display_mode
* mode
, uint32
* low
,
125 return B_UNSUPPORTED
;
130 BitmapHWInterface::GetTimingConstraints(display_timing_constraints
* constraints
)
132 return B_UNSUPPORTED
;
137 BitmapHWInterface::ProposeMode(display_mode
* candidate
, const display_mode
* low
,
138 const display_mode
* high
)
140 return B_UNSUPPORTED
;
145 BitmapHWInterface::RetraceSemaphore()
152 BitmapHWInterface::WaitForRetrace(bigtime_t timeout
)
154 return B_UNSUPPORTED
;
159 BitmapHWInterface::SetDPMSMode(uint32 state
)
161 return B_UNSUPPORTED
;
166 BitmapHWInterface::DPMSMode()
173 BitmapHWInterface::DPMSCapabilities()
180 BitmapHWInterface::SetBrightness(float)
182 return B_UNSUPPORTED
;
187 BitmapHWInterface::GetBrightness(float*)
189 return B_UNSUPPORTED
;
194 BitmapHWInterface::FrontBuffer() const
201 BitmapHWInterface::BackBuffer() const
208 BitmapHWInterface::IsDoubleBuffered() const
210 // overwrite double buffered preference
212 return fBackBuffer
!= NULL
;
214 return HWInterface::IsDoubleBuffered();