[Scummvm-git-logs] scummvm master -> e165cd228f2c296ee0f984f5cd03c4ba46351e96
OMGPizzaGuy
noreply at scummvm.org
Thu Apr 25 00:36:14 UTC 2024
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
fdb63c2127 ULTIMA8: Remove unused gamma correction tables
a67dba439b UTLIMA8: Move graphics initialization up to engine
e165cd228f ULTIMA8: Replace create secondary render surface with a constructor
Commit: fdb63c2127b06e6b7bc1128c8af397b21a604764
https://github.com/scummvm/scummvm/commit/fdb63c2127b06e6b7bc1128c8af397b21a604764
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2024-04-24T18:19:49-05:00
Commit Message:
ULTIMA8: Remove unused gamma correction tables
Changed paths:
engines/ultima/ultima8/graphics/render_surface.cpp
engines/ultima/ultima8/graphics/render_surface.h
diff --git a/engines/ultima/ultima8/graphics/render_surface.cpp b/engines/ultima/ultima8/graphics/render_surface.cpp
index f23a471a7d8..82aaa478fe7 100644
--- a/engines/ultima/ultima8/graphics/render_surface.cpp
+++ b/engines/ultima/ultima8/graphics/render_surface.cpp
@@ -33,9 +33,6 @@
namespace Ultima {
namespace Ultima8 {
-uint8 RenderSurface::_gamma10toGamma22[256];
-uint8 RenderSurface::_gamma22toGamma10[256];
-
RenderSurface::RenderSurface(Graphics::ManagedSurface *s, DisposeAfterUse::Flag disposeAfterUse) :
_pixels(nullptr), _ox(0), _oy(0), _pitch(0),
_flipped(false), _clipWindow(0, 0, 0, 0), _lockCount(0),
@@ -588,12 +585,6 @@ RenderSurface *RenderSurface::SetVideoMode(uint32 width, uint32 height) {
Graphics::ManagedSurface *surface = new Graphics::Screen(width, height, format);
assert(surface);
- // Initialize gamma correction tables
- for (int i = 0; i < 256; i++) {
- _gamma22toGamma10[i] = static_cast<uint8>(0.5 + (pow(i / 255.0, 2.2 / 1.0) * 255.0));
- _gamma10toGamma22[i] = static_cast<uint8>(0.5 + (pow(i / 255.0, 1.0 / 2.2) * 255.0));
- }
-
return new RenderSurface(surface);
}
diff --git a/engines/ultima/ultima8/graphics/render_surface.h b/engines/ultima/ultima8/graphics/render_surface.h
index 19107d0eefb..0f65bdc06ad 100644
--- a/engines/ultima/ultima8/graphics/render_surface.h
+++ b/engines/ultima/ultima8/graphics/render_surface.h
@@ -63,9 +63,6 @@ private:
void SetPixelsPointer();
public:
- static uint8 _gamma10toGamma22[256];
- static uint8 _gamma22toGamma10[256];
-
//! Create a standard RenderSurface
static RenderSurface *SetVideoMode(uint32 width, uint32 height);
Commit: a67dba439beec4e7f125969439c2e3845bb9276b
https://github.com/scummvm/scummvm/commit/a67dba439beec4e7f125969439c2e3845bb9276b
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2024-04-24T18:19:49-05:00
Commit Message:
UTLIMA8: Move graphics initialization up to engine
Changed paths:
engines/ultima/ultima8/graphics/render_surface.cpp
engines/ultima/ultima8/graphics/render_surface.h
engines/ultima/ultima8/gumps/desktop_gump.cpp
engines/ultima/ultima8/gumps/desktop_gump.h
engines/ultima/ultima8/ultima8.cpp
diff --git a/engines/ultima/ultima8/graphics/render_surface.cpp b/engines/ultima/ultima8/graphics/render_surface.cpp
index 82aaa478fe7..05ae82c3dc1 100644
--- a/engines/ultima/ultima8/graphics/render_surface.cpp
+++ b/engines/ultima/ultima8/graphics/render_surface.cpp
@@ -26,7 +26,6 @@
#include "ultima/ultima8/graphics/texture.h"
#include "ultima/ultima8/ultima8.h"
#include "common/system.h"
-#include "engines/util.h"
#include "graphics/blit.h"
#include "graphics/screen.h"
@@ -559,35 +558,6 @@ void RenderSurface::MaskedBlit(const Graphics::ManagedSurface &src, const Common
}
}
-//
-// RenderSurface::SetVideoMode()
-//
-// Desc: Create a standard RenderSurface
-// Returns: Created RenderSurface or 0
-//
-
-RenderSurface *RenderSurface::SetVideoMode(uint32 width, uint32 height) {
- Common::List<Graphics::PixelFormat> tryModes = g_system->getSupportedFormats();
- for (Common::List<Graphics::PixelFormat>::iterator g = tryModes.begin(); g != tryModes.end(); ++g) {
- if (g->bytesPerPixel != 2 && g->bytesPerPixel != 4) {
- g = tryModes.reverse_erase(g);
- }
- }
-
- initGraphics(width, height, tryModes);
-
- Graphics::PixelFormat format = g_system->getScreenFormat();
- if (format.bytesPerPixel != 2 && format.bytesPerPixel != 4) {
- error("Only 16 bit and 32 bit video modes supported");
- }
-
- // Set up blitting surface
- Graphics::ManagedSurface *surface = new Graphics::Screen(width, height, format);
- assert(surface);
-
- return new RenderSurface(surface);
-}
-
// Create a SecondaryRenderSurface with an associated Texture object
RenderSurface *RenderSurface::CreateSecondaryRenderSurface(uint32 width, uint32 height) {
const Graphics::PixelFormat &format = Ultima8Engine::get_instance()->getScreen()->format;
diff --git a/engines/ultima/ultima8/graphics/render_surface.h b/engines/ultima/ultima8/graphics/render_surface.h
index 0f65bdc06ad..7c06f0a50fe 100644
--- a/engines/ultima/ultima8/graphics/render_surface.h
+++ b/engines/ultima/ultima8/graphics/render_surface.h
@@ -56,19 +56,16 @@ private:
Graphics::ManagedSurface *_surface;
DisposeAfterUse::Flag _disposeAfterUse;
- // Create from a managed surface
- RenderSurface(Graphics::ManagedSurface *s, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
-
// Update the Pixels Pointer
void SetPixelsPointer();
public:
- //! Create a standard RenderSurface
- static RenderSurface *SetVideoMode(uint32 width, uint32 height);
-
//! Create a SecondaryRenderSurface with an associated Texture object
static RenderSurface *CreateSecondaryRenderSurface(uint32 width, uint32 height);
+ // Create from a managed surface
+ RenderSurface(Graphics::ManagedSurface *s, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
+
~RenderSurface();
//
diff --git a/engines/ultima/ultima8/gumps/desktop_gump.cpp b/engines/ultima/ultima8/gumps/desktop_gump.cpp
index 3ad25df85e1..3267572958c 100644
--- a/engines/ultima/ultima8/gumps/desktop_gump.cpp
+++ b/engines/ultima/ultima8/gumps/desktop_gump.cpp
@@ -70,26 +70,6 @@ void DesktopGump::PaintChildren(RenderSurface *surf, int32 lerp_factor, bool sca
}
}
-void DesktopGump::RenderSurfaceChanged(RenderSurface *surf) {
- // Resize the desktop gump to match the RenderSurface
- Rect new_dims;
- surf->GetSurfaceDims(new_dims);
- _dims.setWidth(new_dims.width());
- _dims.setHeight(new_dims.height());
-
- Gump::RenderSurfaceChanged();
-}
-
-void DesktopGump::RenderSurfaceChanged() {
- // Resize the desktop gump to match the parent
- Rect new_dims;
- _parent->GetDims(new_dims);
- _dims.setWidth(new_dims.width());
- _dims.setHeight(new_dims.height());
-
- Gump::RenderSurfaceChanged();
-}
-
void DesktopGump::saveData(Common::WriteStream *ws) {
warning("Trying to save DesktopGump");
}
diff --git a/engines/ultima/ultima8/gumps/desktop_gump.h b/engines/ultima/ultima8/gumps/desktop_gump.h
index 586ecd95f8e..f5b727a2341 100644
--- a/engines/ultima/ultima8/gumps/desktop_gump.h
+++ b/engines/ultima/ultima8/gumps/desktop_gump.h
@@ -46,14 +46,9 @@ public:
bool loadData(Common::ReadStream *rs, uint32 version);
void saveData(Common::WriteStream *ws) override;
- void RenderSurfaceChanged(RenderSurface *surf);
-
static void SetFadedModal(bool set) {
_fadedModal = set;
}
-
-protected:
- void RenderSurfaceChanged() override;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index 265a4a42b77..9dfbd2fcc42 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -26,6 +26,7 @@
#include "gui/saveload.h"
#include "image/png.h"
#include "engines/dialogs.h"
+#include "engines/util.h"
// TODO: !! a lot of these includes are just for some hacks... clean up sometime
#include "ultima/ultima8/conf/config_file_manager.h"
@@ -347,7 +348,6 @@ Common::Error Ultima8Engine::startup() {
debug(MM_INFO, "-- Pentagram Initialized -- ");
if (setupGame()) {
- GraphicSysInit();
Common::Error result = startupGame();
if (result.getCode() != Common::kNoError)
return result;
@@ -737,26 +737,32 @@ void Ultima8Engine::GraphicSysInit() {
delete _screen;
}
- _screen = nullptr;
// Set Screen Resolution
debugN(MM_INFO, "Setting Video Mode %dx%d...\n", width, height);
- RenderSurface *new_screen = RenderSurface::SetVideoMode(width, height);
-
- if (!new_screen) {
- warning("Unable to set new video mode. Trying %dx%d", U8_DEFAULT_SCREEN_WIDTH, U8_DEFAULT_SCREEN_HEIGHT);
- new_screen = RenderSurface::SetVideoMode(U8_DEFAULT_SCREEN_WIDTH, U8_DEFAULT_SCREEN_HEIGHT);
+ Common::List<Graphics::PixelFormat> tryModes = g_system->getSupportedFormats();
+ for (Common::List<Graphics::PixelFormat>::iterator g = tryModes.begin(); g != tryModes.end(); ++g) {
+ if (g->bytesPerPixel != 2 && g->bytesPerPixel != 4) {
+ g = tryModes.reverse_erase(g);
+ }
}
- if (!new_screen) {
- error("Unable to set video mode");
+ initGraphics(width, height, tryModes);
+
+ Graphics::PixelFormat format = g_system->getScreenFormat();
+ if (format.bytesPerPixel != 2 && format.bytesPerPixel != 4) {
+ error("Only 16 bit and 32 bit video modes supported");
}
+ // Set up blitting surface
+ Graphics::ManagedSurface *surface = new Graphics::Screen(width, height, format);
+ _screen = new RenderSurface(surface);
+
if (_desktopGump) {
- _paletteManager->PixelFormatChanged(new_screen->getRawSurface()->format);
- static_cast<DesktopGump *>(_desktopGump)->RenderSurfaceChanged(new_screen);
- _screen = new_screen;
+ _paletteManager->PixelFormatChanged(format);
+ _desktopGump->SetDims(Rect(0, 0, width, height));
+ _desktopGump->RenderSurfaceChanged();
paint();
return;
}
@@ -770,7 +776,6 @@ void Ultima8Engine::GraphicSysInit() {
_inverterGump->InitGump(0);
}
- _screen = new_screen;
// Show the splash screen immediately now that the screen has been set up
int saveSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
@@ -779,7 +784,7 @@ void Ultima8Engine::GraphicSysInit() {
showSplashScreen();
}
- _paletteManager = new PaletteManager(new_screen->getRawSurface()->format);
+ _paletteManager = new PaletteManager(format);
ConfMan.registerDefault("fadedModal", true);
bool faded_modal = ConfMan.getBool("fadedModal");
Commit: e165cd228f2c296ee0f984f5cd03c4ba46351e96
https://github.com/scummvm/scummvm/commit/e165cd228f2c296ee0f984f5cd03c4ba46351e96
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2024-04-24T18:19:49-05:00
Commit Message:
ULTIMA8: Replace create secondary render surface with a constructor
Changed paths:
engines/ultima/ultima8/graphics/palette.h
engines/ultima/ultima8/graphics/render_surface.cpp
engines/ultima/ultima8/graphics/render_surface.h
engines/ultima/ultima8/graphics/skf_player.cpp
engines/ultima/ultima8/gumps/credits_gump.cpp
engines/ultima/ultima8/gumps/cru_credits_gump.cpp
engines/ultima/ultima8/gumps/cru_demo_gump.cpp
engines/ultima/ultima8/gumps/inverter_gump.cpp
engines/ultima/ultima8/misc/debugger.cpp
diff --git a/engines/ultima/ultima8/graphics/palette.h b/engines/ultima/ultima8/graphics/palette.h
index f7f4ea31736..5085f5781ba 100644
--- a/engines/ultima/ultima8/graphics/palette.h
+++ b/engines/ultima/ultima8/graphics/palette.h
@@ -25,6 +25,10 @@
#include "graphics/palette.h"
#include "ultima/ultima8/graphics/pal_transforms.h"
+namespace Common {
+class ReadStream;
+}
+
namespace Ultima {
namespace Ultima8 {
diff --git a/engines/ultima/ultima8/graphics/render_surface.cpp b/engines/ultima/ultima8/graphics/render_surface.cpp
index 05ae82c3dc1..338582afa3e 100644
--- a/engines/ultima/ultima8/graphics/render_surface.cpp
+++ b/engines/ultima/ultima8/graphics/render_surface.cpp
@@ -19,19 +19,28 @@
*
*/
-#include "ultima/ultima8/misc/debugger.h"
+#include "ultima/ultima8/graphics/render_surface.h"
#include "ultima/ultima8/graphics/palette.h"
#include "ultima/ultima8/graphics/shape.h"
#include "ultima/ultima8/graphics/shape_frame.h"
#include "ultima/ultima8/graphics/texture.h"
-#include "ultima/ultima8/ultima8.h"
-#include "common/system.h"
#include "graphics/blit.h"
-#include "graphics/screen.h"
namespace Ultima {
namespace Ultima8 {
+RenderSurface::RenderSurface(int width, int height, const Graphics::PixelFormat &format) :
+ _pixels(nullptr), _ox(0), _oy(0), _pitch(0),
+ _flipped(false), _clipWindow(0, 0, 0, 0), _lockCount(0),
+ _disposeAfterUse(DisposeAfterUse::YES) {
+
+ _surface = new Graphics::ManagedSurface(width, height, format);
+ _clipWindow.setWidth(_surface->w);
+ _clipWindow.setHeight(_surface->h);
+
+ SetPixelsPointer();
+}
+
RenderSurface::RenderSurface(Graphics::ManagedSurface *s, DisposeAfterUse::Flag disposeAfterUse) :
_pixels(nullptr), _ox(0), _oy(0), _pitch(0),
_flipped(false), _clipWindow(0, 0, 0, 0), _lockCount(0),
@@ -558,14 +567,6 @@ void RenderSurface::MaskedBlit(const Graphics::ManagedSurface &src, const Common
}
}
-// Create a SecondaryRenderSurface with an associated Texture object
-RenderSurface *RenderSurface::CreateSecondaryRenderSurface(uint32 width, uint32 height) {
- const Graphics::PixelFormat &format = Ultima8Engine::get_instance()->getScreen()->format;
-
- Graphics::ManagedSurface *surface = new Graphics::ManagedSurface(width, height, format);
- return new RenderSurface(surface);
-}
-
namespace {
template<typename uintX>
diff --git a/engines/ultima/ultima8/graphics/render_surface.h b/engines/ultima/ultima8/graphics/render_surface.h
index 7c06f0a50fe..b0f97ab8847 100644
--- a/engines/ultima/ultima8/graphics/render_surface.h
+++ b/engines/ultima/ultima8/graphics/render_surface.h
@@ -60,8 +60,8 @@ private:
void SetPixelsPointer();
public:
- //! Create a SecondaryRenderSurface with an associated Texture object
- static RenderSurface *CreateSecondaryRenderSurface(uint32 width, uint32 height);
+ // Create a render surface
+ RenderSurface(int width, int height, const Graphics::PixelFormat &format);
// Create from a managed surface
RenderSurface(Graphics::ManagedSurface *s, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
diff --git a/engines/ultima/ultima8/graphics/skf_player.cpp b/engines/ultima/ultima8/graphics/skf_player.cpp
index e52d342605a..ac7f521fb8e 100644
--- a/engines/ultima/ultima8/graphics/skf_player.cpp
+++ b/engines/ultima/ultima8/graphics/skf_player.cpp
@@ -20,6 +20,7 @@
*/
#include "ultima/ultima.h"
+#include "ultima/ultima8/ultima8.h"
#include "ultima/ultima8/misc/debugger.h"
#include "ultima/ultima8/graphics/skf_player.h"
#include "ultima/ultima8/convert/u8/convert_shape_u8.h"
@@ -78,7 +79,8 @@ SKFPlayer::SKFPlayer(Common::SeekableReadStream *rs, int width, int height, bool
parseEventList(eventlist);
delete eventlist;
- _buffer = RenderSurface::CreateSecondaryRenderSurface(_width, _height);
+ Graphics::Screen *screen = Ultima8Engine::get_instance()->getScreen();
+ _buffer = new RenderSurface(_width, _height, screen->format);
}
SKFPlayer::~SKFPlayer() {
diff --git a/engines/ultima/ultima8/gumps/credits_gump.cpp b/engines/ultima/ultima8/gumps/credits_gump.cpp
index b67ee93e05b..61980da2a06 100644
--- a/engines/ultima/ultima8/gumps/credits_gump.cpp
+++ b/engines/ultima/ultima8/gumps/credits_gump.cpp
@@ -24,6 +24,7 @@
#include "ultima/ultima8/gumps/credits_gump.h"
+#include "ultima/ultima8/ultima8.h"
#include "ultima/ultima8/kernel/mouse.h"
#include "ultima/ultima8/graphics/render_surface.h"
#include "ultima/ultima8/graphics/texture.h"
@@ -71,12 +72,14 @@ CreditsGump::~CreditsGump() {
void CreditsGump::InitGump(Gump *newparent, bool take_focus) {
ModalGump::InitGump(newparent, take_focus);
+ Graphics::Screen *screen = Ultima8Engine::get_instance()->getScreen();
uint32 width = 256;
uint32 height = 280;
- _scroll[0] = RenderSurface::CreateSecondaryRenderSurface(width, height);
- _scroll[1] = RenderSurface::CreateSecondaryRenderSurface(width, height);
- _scroll[2] = RenderSurface::CreateSecondaryRenderSurface(width, height);
- _scroll[3] = RenderSurface::CreateSecondaryRenderSurface(width, height);
+
+ _scroll[0] = new RenderSurface(width, height, screen->format);
+ _scroll[1] = new RenderSurface(width, height, screen->format);
+ _scroll[2] = new RenderSurface(width, height, screen->format);
+ _scroll[3] = new RenderSurface(width, height, screen->format);
uint32 color = TEX32_PACK_RGB(0, 0, 0);
_scroll[0]->fill32(color, 0, 0, width, height); // black background
diff --git a/engines/ultima/ultima8/gumps/cru_credits_gump.cpp b/engines/ultima/ultima8/gumps/cru_credits_gump.cpp
index 8edfa5bd7cf..5af5845db34 100644
--- a/engines/ultima/ultima8/gumps/cru_credits_gump.cpp
+++ b/engines/ultima/ultima8/gumps/cru_credits_gump.cpp
@@ -52,7 +52,8 @@ CruCreditsGump::CruCreditsGump(Common::SeekableReadStream *txtrs,
_timer(0), _background(nullptr), _nextScreenStart(0), _screenNo(-1)
{
Image::BitmapDecoder decoder;
- _background = RenderSurface::CreateSecondaryRenderSurface(640, 480);
+ Graphics::Screen *sc = Ultima8Engine::get_instance()->getScreen();
+ _background = new RenderSurface(640, 480, sc->format);
uint32 color = TEX32_PACK_RGB(0, 0, 0);
_background->fill32(color, 0, 0, 640, 480); // black background
diff --git a/engines/ultima/ultima8/gumps/cru_demo_gump.cpp b/engines/ultima/ultima8/gumps/cru_demo_gump.cpp
index 3a03c7edf5f..e0d4cc7166c 100644
--- a/engines/ultima/ultima8/gumps/cru_demo_gump.cpp
+++ b/engines/ultima/ultima8/gumps/cru_demo_gump.cpp
@@ -43,7 +43,8 @@ CruDemoGump::CruDemoGump(Common::SeekableReadStream *bmprs, uint32 flags, int32
: ModalGump(0, 0, 640, 480, 0, flags, layer), _background(nullptr)
{
Image::BitmapDecoder decoder;
- _background = RenderSurface::CreateSecondaryRenderSurface(640, 480);
+ Graphics::Screen *screen = Ultima8Engine::get_instance()->getScreen();
+ _background = new RenderSurface(640, 480, screen->format);
uint32 color = TEX32_PACK_RGB(0, 0, 0);
_background->fill32(color, 0, 0, 640, 480); // black background
diff --git a/engines/ultima/ultima8/gumps/inverter_gump.cpp b/engines/ultima/ultima8/gumps/inverter_gump.cpp
index c9ff6d3f4ef..2902416d26f 100644
--- a/engines/ultima/ultima8/gumps/inverter_gump.cpp
+++ b/engines/ultima/ultima8/gumps/inverter_gump.cpp
@@ -92,7 +92,8 @@ void InverterGump::PaintChildren(RenderSurface *surf, int32 lerp_factor, bool sc
// need a backbuffer
if (!_buffer) {
- _buffer = RenderSurface::CreateSecondaryRenderSurface(width, height);
+ Graphics::Screen *screen = Ultima8Engine::get_instance()->getScreen();
+ _buffer = new RenderSurface(width, height, screen->format);
}
_buffer->BeginPainting();
diff --git a/engines/ultima/ultima8/misc/debugger.cpp b/engines/ultima/ultima8/misc/debugger.cpp
index 244bd9c5389..39910717f9c 100644
--- a/engines/ultima/ultima8/misc/debugger.cpp
+++ b/engines/ultima/ultima8/misc/debugger.cpp
@@ -748,8 +748,8 @@ void Debugger::dumpCurrentMap() {
CurrentMap *currentMap = World::get_instance()->getCurrentMap();
currentMap->setWholeMapFast();
- RenderSurface *s = RenderSurface::CreateSecondaryRenderSurface(awidth,
- aheight);
+ Graphics::Screen *screen = Ultima8Engine::get_instance()->getScreen();
+ RenderSurface *s = new RenderSurface(awidth, aheight, screen->format);
debugPrintf("Rendering map...\n");
@@ -1830,7 +1830,8 @@ bool Debugger::cmdBenchmarkRenderSurface(int argc, const char **argv) {
GameData *gamedata = GameData::get_instance();
Shape *s = gamedata->getMainShapes()->getShape(shapenum);
- RenderSurface *surface = RenderSurface::CreateSecondaryRenderSurface(320, 200);
+ Graphics::Screen *screen = Ultima8Engine::get_instance()->getScreen();
+ RenderSurface *surface = new RenderSurface(320, 200, screen->format);
surface->BeginPainting();
uint32 start, end;
More information about the Scummvm-git-logs
mailing list