2019-12-11 00:51:42 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2019-12-23 17:43:10 -05:00
|
|
|
#include "GpPixelFormat.h"
|
2019-12-29 06:38:18 -05:00
|
|
|
#include "PLErrorCodes.h"
|
2020-01-01 20:24:46 -05:00
|
|
|
#include "PLHandle.h"
|
2019-12-11 00:51:42 -05:00
|
|
|
|
|
|
|
|
struct PixMap;
|
2019-12-23 17:43:10 -05:00
|
|
|
struct Rect;
|
2019-12-11 00:51:42 -05:00
|
|
|
|
|
|
|
|
namespace PortabilityLayer
|
|
|
|
|
{
|
2020-01-01 20:24:46 -05:00
|
|
|
class PixMapImpl;
|
|
|
|
|
|
2019-12-11 00:51:42 -05:00
|
|
|
enum QDPortType
|
|
|
|
|
{
|
|
|
|
|
QDPortType_Invalid,
|
|
|
|
|
|
2019-12-30 20:53:11 -05:00
|
|
|
QDPortType_DrawSurface,
|
2019-12-23 17:43:10 -05:00
|
|
|
QDPortType_Window,
|
2019-12-21 18:40:17 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum QDPortDirtyFlag
|
2019-12-23 17:43:10 -05:00
|
|
|
{
|
2019-12-21 18:40:17 -05:00
|
|
|
QDPortDirtyFlag_Size = 1,
|
|
|
|
|
QDPortDirtyFlag_Contents = 2,
|
2019-12-23 17:43:10 -05:00
|
|
|
};
|
2019-12-11 00:51:42 -05:00
|
|
|
|
|
|
|
|
class QDPort
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
explicit QDPort(QDPortType portType);
|
2019-12-23 17:43:10 -05:00
|
|
|
~QDPort();
|
2019-12-11 00:51:42 -05:00
|
|
|
|
2019-12-29 06:38:18 -05:00
|
|
|
PLError_t Init(const Rect &rect, GpPixelFormat_t pixelFormat);
|
2019-12-11 00:51:42 -05:00
|
|
|
QDPortType GetPortType() const;
|
2019-12-23 17:43:10 -05:00
|
|
|
|
2020-01-01 20:24:46 -05:00
|
|
|
THandle<PixMap> GetPixMap() const;
|
2019-12-23 17:43:10 -05:00
|
|
|
GpPixelFormat_t GetPixelFormat() const;
|
2019-12-11 00:51:42 -05:00
|
|
|
Rect GetRect() const;
|
|
|
|
|
|
2019-12-21 18:40:17 -05:00
|
|
|
bool Resize(const Rect &rect);
|
|
|
|
|
|
|
|
|
|
bool IsDirty(uint32_t flag) const;
|
|
|
|
|
void SetDirty(uint32_t flag);
|
|
|
|
|
void ClearDirty(uint32_t flag);
|
|
|
|
|
|
2020-01-01 20:24:46 -05:00
|
|
|
#if GP_DEBUG_CONFIG
|
|
|
|
|
void CheckPortSentinel() const;
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-12-11 00:51:42 -05:00
|
|
|
private:
|
2019-12-21 18:40:17 -05:00
|
|
|
void DisposePixMap();
|
|
|
|
|
|
2020-01-01 20:24:46 -05:00
|
|
|
#if GP_DEBUG_CONFIG
|
|
|
|
|
int32_t m_portSentinel;
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-12-23 17:43:10 -05:00
|
|
|
QDPortType m_portType;
|
|
|
|
|
|
2020-01-01 20:24:46 -05:00
|
|
|
THandle<PixMapImpl> m_pixMap;
|
2019-12-11 00:51:42 -05:00
|
|
|
|
2019-12-23 17:43:10 -05:00
|
|
|
int16_t m_left;
|
|
|
|
|
int16_t m_top;
|
|
|
|
|
uint16_t m_width;
|
|
|
|
|
uint16_t m_height;
|
2019-12-21 18:40:17 -05:00
|
|
|
uint32_t m_dirtyFlags;
|
2019-12-23 17:43:10 -05:00
|
|
|
GpPixelFormat_t m_pixelFormat;
|
2019-12-27 14:18:05 -05:00
|
|
|
|
|
|
|
|
uint32_t m_debugID;
|
2019-12-11 00:51:42 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
inline QDPortType QDPort::GetPortType() const
|
|
|
|
|
{
|
|
|
|
|
return m_portType;
|
|
|
|
|
}
|
|
|
|
|
}
|