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-30 20:53:11 -05:00
|
|
|
#include "PLHandle.h"
|
2019-12-11 00:51:42 -05:00
|
|
|
#include "QDPort.h"
|
2020-05-21 05:01:16 -04:00
|
|
|
#include "RGBAColor.h"
|
2019-12-11 00:51:42 -05:00
|
|
|
|
2019-12-30 20:53:11 -05:00
|
|
|
namespace PortabilityLayer
|
|
|
|
|
{
|
2020-01-18 18:20:16 -05:00
|
|
|
struct AntiAliasTable;
|
2019-12-30 20:53:11 -05:00
|
|
|
class FontFamily;
|
|
|
|
|
struct RGBAColor;
|
2020-03-08 23:14:53 -04:00
|
|
|
class RenderedFont;
|
2020-05-21 03:30:11 -04:00
|
|
|
class ResolveCachingColor;
|
2019-12-30 20:53:11 -05:00
|
|
|
class ScanlineMask;
|
2020-05-21 05:01:16 -04:00
|
|
|
class FontSpec;
|
2019-12-30 20:53:11 -05:00
|
|
|
}
|
|
|
|
|
|
2019-12-11 00:51:42 -05:00
|
|
|
struct PixMap;
|
2020-01-18 21:15:07 -05:00
|
|
|
struct BitmapImage;
|
2019-12-30 20:53:11 -05:00
|
|
|
struct Point;
|
2019-12-11 00:51:42 -05:00
|
|
|
struct Rect;
|
2019-12-24 02:35:24 -05:00
|
|
|
struct IGpDisplayDriver;
|
2019-12-21 18:40:17 -05:00
|
|
|
struct IGpDisplayDriverSurface;
|
2019-12-30 20:53:11 -05:00
|
|
|
class PLPasStr;
|
2019-12-11 00:51:42 -05:00
|
|
|
|
2020-05-20 17:20:50 -04:00
|
|
|
struct DrawSurface
|
2019-12-11 00:51:42 -05:00
|
|
|
{
|
2019-12-30 20:53:11 -05:00
|
|
|
DrawSurface()
|
|
|
|
|
: m_port(PortabilityLayer::QDPortType_DrawSurface)
|
2019-12-21 18:40:17 -05:00
|
|
|
, m_ddSurface(nullptr)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-30 20:53:11 -05:00
|
|
|
explicit DrawSurface(PortabilityLayer::QDPortType overridePortType)
|
2019-12-21 18:40:17 -05:00
|
|
|
: m_port(overridePortType)
|
|
|
|
|
, m_ddSurface(nullptr)
|
2019-12-11 00:51:42 -05:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-01 20:49:18 -05:00
|
|
|
~DrawSurface();
|
|
|
|
|
|
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
|
|
|
{
|
2019-12-29 06:38:18 -05:00
|
|
|
if (PLError_t errorCode = m_port.Init(rect, pixelFormat))
|
2019-12-11 00:51:42 -05:00
|
|
|
return errorCode;
|
|
|
|
|
|
2019-12-29 06:38:18 -05:00
|
|
|
return PLErrors::kNone;
|
2019-12-11 00:51:42 -05:00
|
|
|
}
|
|
|
|
|
|
2019-12-21 18:40:17 -05:00
|
|
|
bool Resize(const Rect &rect)
|
|
|
|
|
{
|
|
|
|
|
return m_port.Resize(rect);
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-24 02:35:24 -05:00
|
|
|
void PushToDDSurface(IGpDisplayDriver *displayDriver);
|
|
|
|
|
|
2020-05-21 03:30:11 -04:00
|
|
|
void FillRect(const Rect &rect, PortabilityLayer::ResolveCachingColor &cacheColor);
|
|
|
|
|
void FillRectWithMaskPattern8x8(const Rect &rect, const uint8_t *pattern, PortabilityLayer::ResolveCachingColor &cacheColor);
|
|
|
|
|
void FrameRect(const Rect &rect, PortabilityLayer::ResolveCachingColor &cacheColor);
|
|
|
|
|
void FrameRoundRect(const Rect &rect, int quadrantWidth, int quadrantHeight, PortabilityLayer::ResolveCachingColor &cacheColor);
|
2019-12-30 20:53:11 -05:00
|
|
|
void InvertFrameRect(const Rect &rect, const uint8_t *pattern);
|
|
|
|
|
void InvertFillRect(const Rect &rect, const uint8_t *pattern);
|
|
|
|
|
|
2020-05-21 03:30:11 -04:00
|
|
|
void FillEllipse(const Rect &rect, PortabilityLayer::ResolveCachingColor &cacheColor);
|
|
|
|
|
void FillEllipseWithMaskPattern(const Rect &rect, const uint8_t *pattern, PortabilityLayer::ResolveCachingColor &cacheColor);
|
|
|
|
|
void FrameEllipse(const Rect &rect, PortabilityLayer::ResolveCachingColor &cacheColor);
|
2019-12-30 20:53:11 -05:00
|
|
|
|
2020-05-21 03:30:11 -04:00
|
|
|
void FillScanlineMask(const PortabilityLayer::ScanlineMask *scanlineMask, PortabilityLayer::ResolveCachingColor &cacheColor);
|
|
|
|
|
void FillScanlineMaskWithMaskPattern(const PortabilityLayer::ScanlineMask *scanlineMask, const uint8_t *pattern, PortabilityLayer::ResolveCachingColor &cacheColor);
|
2019-12-30 20:53:11 -05:00
|
|
|
|
2020-05-21 03:30:11 -04:00
|
|
|
void DrawLine(const Point &a, const Point &b, PortabilityLayer::ResolveCachingColor &cacheColor);
|
2019-12-30 20:53:11 -05:00
|
|
|
|
2020-05-21 05:01:16 -04:00
|
|
|
void DrawString(const Point &point, const PLPasStr &str, PortabilityLayer::ResolveCachingColor &cacheColor, PortabilityLayer::RenderedFont *font);
|
|
|
|
|
void DrawStringConstrained(const Point &point, const PLPasStr &str, const Rect &constraintRect, PortabilityLayer::ResolveCachingColor &cacheColor, PortabilityLayer::RenderedFont *font);
|
|
|
|
|
void DrawStringWrap(const Point &point, const Rect &constrainRect, const PLPasStr &str, PortabilityLayer::ResolveCachingColor &cacheColor, PortabilityLayer::RenderedFont *font);
|
2020-01-01 20:24:46 -05:00
|
|
|
|
2020-11-03 19:59:26 -05:00
|
|
|
void DrawPicture(THandle<BitmapImage> pictHandle, const Rect &rect, bool errorDiffusion = true);
|
2019-12-30 20:53:11 -05:00
|
|
|
|
2019-12-21 18:40:17 -05:00
|
|
|
IGpDisplayDriverSurface *m_ddSurface;
|
2020-01-18 18:20:16 -05:00
|
|
|
|
2020-05-20 23:33:17 -04:00
|
|
|
PortabilityLayer::QDPort m_port;
|
2020-10-20 23:43:02 -04:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
static void StaticOnDriverInvalidate(void *context);
|
|
|
|
|
void OnDriverInvalidate();
|
2019-12-21 18:40:17 -05:00
|
|
|
};
|