Files
haiku-beta6/src/servers/app/Screen.h
T
X512 0e268215f3 app_server/Screen: fix finalization order to avoid use after free
Change-Id: I41ba464a365be9449dfd47b2248746b9a338769e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7416
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Axel Dörfler <[email protected]>
2024-02-19 14:29:37 +00:00

71 lines
1.7 KiB
C++

/*
* Copyright 2001-2009, Haiku, Inc.
* Distributed under the terms of the MIT license.
*
* Authors:
* Adi Oanca <[email protected]>
* Axel Dörfler, [email protected]
* Stephan Aßmus, <[email protected]>
*/
#ifndef SCREEN_H
#define SCREEN_H
#include <AutoDeleter.h>
#include <Accelerant.h>
#include <GraphicsDefs.h>
#include <Point.h>
class DrawingEngine;
class HWInterface;
class Screen {
public:
Screen(::HWInterface *interface, int32 id);
Screen();
virtual ~Screen();
status_t Initialize();
void Shutdown();
int32 ID() const { return fID; }
status_t GetMonitorInfo(monitor_info& info) const;
status_t SetMode(const display_mode& mode);
status_t SetMode(uint16 width, uint16 height,
uint32 colorspace,
const display_timing& timing);
status_t SetPreferredMode();
status_t SetBestMode(uint16 width, uint16 height,
uint32 colorspace, float frequency,
bool strict = true);
void GetMode(display_mode& mode) const;
void GetMode(uint16 &width, uint16 &height,
uint32 &colorspace, float &frequency) const;
void SetFrame(const BRect& rect);
BRect Frame() const;
color_space ColorSpace() const;
inline DrawingEngine* GetDrawingEngine() const
{ return fDriver.Get(); }
inline ::HWInterface* HWInterface() const
{ return fHWInterface.Get(); }
private:
int32 _FindBestMode(const display_mode* modeList,
uint32 count, uint16 width, uint16 height,
uint32 colorspace, float frequency) const;
int32 fID;
ObjectDeleter< ::HWInterface>
fHWInterface;
ObjectDeleter<DrawingEngine>
fDriver;
};
#endif /* SCREEN_H */