34 #ifndef AGS_ENGINE_GFX_ALI_3D_SCUMMVM_H 35 #define AGS_ENGINE_GFX_ALI_3D_SCUMMVM_H 37 #include "common/std/memory.h" 38 #include "common/std/vector.h" 39 #include "ags/shared/core/platform.h" 40 #include "ags/shared/gfx/bitmap.h" 41 #include "ags/engine/gfx/ddb.h" 42 #include "ags/engine/gfx/gfx_driver_factory_base.h" 43 #include "ags/engine/gfx/gfx_driver_base.h" 50 class ScummVMRendererGraphicsDriver;
51 class ScummVMRendererGfxFilter;
52 using AGS::Shared::Bitmap;
55 FLIP_NONE = 0x00000000,
56 FLIP_HORIZONTAL = 0x00000001,
57 FLIP_VERTICAL = 0x00000002
62 uint32_t GetRefID()
const override {
return UINT32_MAX ; }
64 int GetAlpha()
const override {
67 void SetAlpha(
int alpha)
override {
70 void SetFlippedLeftRight(
bool isFlipped)
override {
73 void SetStretch(
int width,
int height,
bool )
override {
74 _stretchToWidth = width;
75 _stretchToHeight = height;
77 void SetLightLevel(
int )
override {}
78 void SetTint(
int ,
int ,
int ,
int )
override {}
81 bool _flipped =
false;
82 int _stretchToWidth = 0, _stretchToHeight = 0;
88 _colDepth = color_depth;
90 _stretchToWidth = _width;
91 _stretchToHeight = _height;
96 _width = bmp->GetWidth();
97 _height = bmp->GetHeight();
98 _colDepth = bmp->GetColorDepth();
100 _hasAlpha = hasAlpha;
101 _stretchToWidth = _width;
102 _stretchToHeight = _height;
105 int GetWidthToRender() {
106 return _stretchToWidth;
108 int GetHeightToRender() {
109 return _stretchToHeight;
122 int GetModeCount()
const override {
123 return _modes.size();
126 bool GetMode(
int index,
DisplayMode &mode)
const override {
127 if (index >= 0 && (
size_t)index < _modes.size()) {
128 mode = _modes[index];
151 bool IsParentRegion =
false;
163 const char *GetDriverID()
override {
166 const char *GetDriverName()
override {
167 return "ScummVM 2D renderer";
170 void SetTintMethod(TintMethod )
override;
171 bool SetDisplayMode(
const DisplayMode &mode)
override;
172 void UpdateDeviceScreen(
const Size &screen_sz)
override;
174 bool SetRenderFrame(
const Rect &dst_rect)
override;
175 bool IsModeSupported(
const DisplayMode &mode)
override;
176 int GetDisplayDepthForNativeDepth(
int native_color_depth)
const override;
177 IGfxModeList *GetSupportedModeList(
int color_depth)
override;
178 PGfxFilter GetGraphicsFilter()
const override;
181 void ClearRectangle(
int x1,
int y1,
int x2,
int y2,
RGB *colorToUse)
override;
182 int GetCompatibleBitmapFormat(
int color_depth)
override;
185 IDriverDependantBitmap *CreateRenderTargetDDB(
int width,
int height,
int color_depth,
bool opaque)
override;
190 Bitmap *bitmap,
bool hasAlpha,
bool opaque)
override {
192 return CreateDDBFromBitmap(bitmap, hasAlpha, opaque);
195 void UpdateSharedDDB(uint32_t ,
Bitmap *,
bool ,
bool )
override {
198 void ClearSharedDDB(uint32_t )
override {
203 void SetScreenFade(
int red,
int green,
int blue)
override;
204 void SetScreenTint(
int red,
int green,
int blue)
override;
205 void SetStageScreen(
const Size &sz,
int x = 0,
int y = 0)
override;
207 void RenderToBackBuffer()
override;
208 void Render()
override;
209 void Render(
int xoff,
int yoff, Shared::GraphicFlip flip)
override;
211 void FadeOut(
int speed,
int targetColourRed,
int targetColourGreen,
int targetColourBlue)
override;
212 void FadeIn(
int speed, PALETTE pal,
int targetColourRed,
int targetColourGreen,
int targetColourBlue)
override;
213 void BoxOutEffect(
bool blackingOut,
int speed,
int delay)
override;
214 bool SupportsGammaControl()
override;
215 void SetGamma(
int newGamma)
override;
216 void UseSmoothScaling(
bool )
override {}
217 bool DoesSupportVsyncToggle()
override;
218 void RenderSpritesAtScreenResolution(
bool ,
int )
override {}
219 bool RequiresFullRedrawEachFrame()
override {
222 bool HasAcceleratedTransform()
override {
225 bool UsesMemoryBackBuffer()
override {
228 Bitmap *GetMemoryBackBuffer()
override;
229 void SetMemoryBackBuffer(
Bitmap *backBuffer)
override;
230 Bitmap *GetStageBackBuffer(
bool mark_dirty)
override;
231 void SetStageBackBuffer(
Bitmap *backBuffer)
override;
238 void SetGraphicsFilter(PSDLRenderFilter filter);
241 bool SetVsyncImpl(
bool vsync,
bool &vsync_res)
override;
242 size_t GetLastDrawEntryIndex()
override {
243 return _spriteList.size();
248 PSDLRenderFilter _filter;
250 bool _hasGamma =
false;
252 uint16 _defaultGammaRed[256] {};
253 uint16 _defaultGammaGreen[256] {};
254 uint16 _defaultGammaBlue[256] {};
261 BITMAP *_fakeTexBitmap =
nullptr;
262 unsigned char *_lastTexPixels =
nullptr;
263 int _lastTexPitch = -1;
274 Bitmap *_stageVirtualScreen;
275 int _tint_red, _tint_green, _tint_blue;
278 ALSpriteBatches _spriteBatches;
282 void InitSpriteBatch(
size_t index,
const SpriteBatchDesc &desc)
override;
283 void ResetAllBatches()
override;
286 void CreateVirtualScreen();
287 void DestroyVirtualScreen();
289 void ReleaseDisplayMode();
293 void highcolor_fade_in(
Bitmap *vs,
void(*draw_callback)(),
int speed,
int targetColourRed,
int targetColourGreen,
int targetColourBlue);
294 void highcolor_fade_out(
Bitmap *vs,
void(*draw_callback)(),
int speed,
int targetColourRed,
int targetColourGreen,
int targetColourBlue);
295 void __fade_from_range(PALETTE source, PALETTE dest,
int speed,
int from,
int to);
296 void __fade_out_range(
int speed,
int from,
int to,
int targetColourRed,
int targetColourGreen,
int targetColourBlue);
300 void Present(
int xoff = 0,
int yoff = 0, Shared::GraphicFlip flip = Shared::kFlip_None);
308 size_t GetFilterCount()
const override;
309 const GfxFilterInfo *GetFilterInfo(
size_t index)
const override;
310 String GetDefaultFilterID()
const override;
Definition: achievements_tables.h:27
Definition: allegro_bitmap.h:44
Definition: ali_3d_scummvm.h:60
Definition: ali_3d_scummvm.h:304
Definition: gfx_driver_base.h:194
Definition: ali_3d_scummvm.h:141
Definition: ali_3d_scummvm.h:116
Definition: gfxfilter_scummvm_renderer.h:39
Definition: gfx_defines.h:60
Definition: viewport.h:128
Definition: gfxfilter.h:41
Definition: gfx_driver_base.h:47
Definition: gfx_driver_factory_base.h:44
Definition: surface.h:329
Definition: geometry.h:215
Definition: ali_3d_scummvm.h:158
Definition: geometry.h:144
Definition: gfx_defines.h:33
Definition: gfx_mode_list.h:38
Definition: gfx_driver_base.h:93
Definition: graphics_driver.h:85
Definition: gfx_driver_base.h:74