app_server: Remove IsDoubleBuffered() default implementation from HWInterface.

It just causes confusion and is wrong in the case where double buffering
status changed during the object lifetime.

Change-Id: Ia1a9ae3f5a1b1b7d521b79c7d1c7be92cef60a06
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4633
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Augustin Cavalier 2021-10-21 15:19:39 -04:00 committed by waddlesplash
parent f638102196
commit b419a79f8f
5 changed files with 12 additions and 23 deletions

View File

@ -24,7 +24,7 @@ using std::nothrow;
BitmapHWInterface::BitmapHWInterface(ServerBitmap* bitmap)
:
HWInterface(false, false),
HWInterface(),
fBackBuffer(NULL),
fFrontBuffer(new(nothrow) BitmapBuffer(bitmap))
{
@ -204,9 +204,8 @@ BitmapHWInterface::BackBuffer() const
bool
BitmapHWInterface::IsDoubleBuffered() const
{
// overwrite double buffered preference
if (fFrontBuffer.IsSet())
return fBackBuffer.IsSet();
return HWInterface::IsDoubleBuffered();
return false;
}

View File

@ -40,7 +40,7 @@ HWInterfaceListener::~HWInterfaceListener()
// #pragma mark - HWInterface
HWInterface::HWInterface(bool doubleBuffered, bool enableUpdateQueue)
HWInterface::HWInterface()
:
MultiLocker("hw interface lock"),
fFloatingOverlaysLock("floating overlays lock"),
@ -52,12 +52,10 @@ HWInterface::HWInterface(bool doubleBuffered, bool enableUpdateQueue)
fCursorObscured(false),
fHardwareCursorEnabled(false),
fCursorLocation(0, 0),
fDoubleBuffered(doubleBuffered),
fVGADevice(-1),
fUpdateExecutor(NULL),
fListeners(20)
{
SetAsyncDoubleBuffered(doubleBuffered && enableUpdateQueue);
}
@ -307,13 +305,6 @@ HWInterface::SetAsyncDoubleBuffered(bool doubleBuffered)
}
bool
HWInterface::IsDoubleBuffered() const
{
return fDoubleBuffered;
}
/*! The object needs to be already locked!
*/
status_t

View File

@ -57,8 +57,7 @@ public:
class HWInterface : protected MultiLocker {
public:
HWInterface(bool doubleBuffered = false,
bool enableUpdateQueue = true);
HWInterface();
virtual ~HWInterface();
// locking
@ -165,7 +164,7 @@ public:
virtual RenderingBuffer* FrontBuffer() const = 0;
virtual RenderingBuffer* BackBuffer() const = 0;
void SetAsyncDoubleBuffered(bool doubleBuffered);
virtual bool IsDoubleBuffered() const;
virtual bool IsDoubleBuffered() const = 0;
// Invalidate is used for scheduling an area for updating
virtual status_t InvalidateRegion(const BRegion& region);
@ -268,7 +267,6 @@ protected:
BRect fTrackingRect;
bool fDoubleBuffered;
int fVGADevice;
private:

View File

@ -405,11 +405,13 @@ CardWindow::Invalidate(const BRect& frame)
ViewHWInterface::ViewHWInterface()
:
HWInterface(kDefaultDoubleBuffered),
HWInterface(),
fBackBuffer(NULL),
fFrontBuffer(NULL),
fWindow(NULL)
{
SetAsyncDoubleBuffered(kDefaultDoubleBuffered);
fDisplayMode.virtual_width = 640;
fDisplayMode.virtual_height = 480;
fDisplayMode.space = B_RGBA32;
@ -527,7 +529,7 @@ ViewHWInterface::SetMode(const display_mode& mode)
// TODO: Above not true anymore for single buffered mode!!!
// -> fall back to double buffer for fDisplayMode.space != B_RGB32
// as intermediate solution...
bool doubleBuffered = HWInterface::IsDoubleBuffered();
bool doubleBuffered = true;
if ((color_space)fDisplayMode.space != B_RGB32
&& (color_space)fDisplayMode.space != B_RGBA32)
doubleBuffered = true;
@ -792,7 +794,7 @@ ViewHWInterface::IsDoubleBuffered() const
if (fFrontBuffer.IsSet())
return fBackBuffer.IsSet();
return HWInterface::IsDoubleBuffered();
return false;
}

View File

@ -688,8 +688,7 @@ AccelerantHWInterface::SetMode(const display_mode& mode)
|| fBackBuffer->Width() != fFrontBuffer->Width()
|| fBackBuffer->Height() != fFrontBuffer->Height()
|| fOffscreenBackBuffer
|| (fFrontBuffer->ColorSpace() == B_RGB32 && fBackBuffer.IsSet()
&& !HWInterface::IsDoubleBuffered())) {
|| (fFrontBuffer->ColorSpace() == B_RGB32 && fBackBuffer.IsSet())) {
// 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()
@ -699,7 +698,7 @@ AccelerantHWInterface::SetMode(const display_mode& mode)
// TODO: Above not true anymore for single buffered mode!!!
// -> fall back to double buffer for fDisplayMode.space != B_RGB32
// as intermediate solution...
bool doubleBuffered = HWInterface::IsDoubleBuffered();
bool doubleBuffered = false;
if ((fFrontBuffer->ColorSpace() != B_RGB32
&& fFrontBuffer->ColorSpace() != B_RGBA32)
|| fVGADevice >= 0 || fOffscreenBackBuffer)