GRIM: Remove unneeded use of Graphics::createPixelFormat

This commit is contained in:
Cameron Cawley 2021-04-18 17:21:51 +01:00 committed by Eugene Sandulenko
parent f9dc98b0f6
commit 757a819da9
7 changed files with 4 additions and 26 deletions

View file

@ -22,7 +22,6 @@
#include "common/endian.h" #include "common/endian.h"
#include "graphics/colormasks.h"
#include "graphics/pixelbuffer.h" #include "graphics/pixelbuffer.h"
#include "image/tga.h" #include "image/tga.h"

View file

@ -222,7 +222,7 @@ void EMIEngine::storeSaveGameImage(SaveGame *state) {
// copy the actual screenshot to the correct position // copy the actual screenshot to the correct position
unsigned int texWidth = 256, texHeight = 128; unsigned int texWidth = 256, texHeight = 128;
unsigned int size = texWidth * texHeight; unsigned int size = texWidth * texHeight;
Graphics::PixelBuffer buffer = Graphics::PixelBuffer::createBuffer<565>(size, DisposeAfterUse::YES); Graphics::PixelBuffer buffer(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), size, DisposeAfterUse::YES);
buffer.clear(size); buffer.clear(size);
for (unsigned int j = 0; j < 120; j++) { for (unsigned int j = 0; j < 120; j++) {
buffer.copyBuffer(j * texWidth, j * width, width, screenshot->getData(0)); buffer.copyBuffer(j * texWidth, j * width, width, screenshot->getData(0));

View file

@ -507,7 +507,7 @@ void Lua_V2::ThumbnailFromFile() {
for (int l = 0; l < dataSize / 2; l++) { for (int l = 0; l < dataSize / 2; l++) {
data[l] = savedState->readLEUint16(); data[l] = savedState->readLEUint16();
} }
Graphics::PixelBuffer buf(Graphics::createPixelFormat<565>(), (byte *)data); Graphics::PixelBuffer buf(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), (byte *)data);
Bitmap *screenshot = new Bitmap(buf, width, height, "screenshot"); Bitmap *screenshot = new Bitmap(buf, width, height, "screenshot");
if (!screenshot) { if (!screenshot) {
lua_pushnil(); lua_pushnil();

View file

@ -176,7 +176,7 @@ void GfxBase::createSpecialtyTexture(uint id, const uint8 *data, int width, int
} }
Bitmap *GfxBase::createScreenshotBitmap(const Graphics::PixelBuffer src, int w, int h, bool flipOrientation) { Bitmap *GfxBase::createScreenshotBitmap(const Graphics::PixelBuffer src, int w, int h, bool flipOrientation) {
Graphics::PixelBuffer buffer = Graphics::PixelBuffer::createBuffer<565>(w * h, DisposeAfterUse::YES); Graphics::PixelBuffer buffer(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), w * h, DisposeAfterUse::YES);
int i1 = (_screenWidth * w - 1) / _screenWidth + 1; int i1 = (_screenWidth * w - 1) / _screenWidth + 1;
int j1 = (_screenHeight * h - 1) / _screenHeight + 1; int j1 = (_screenHeight * h - 1) / _screenHeight + 1;

View file

@ -25,7 +25,6 @@
#include "common/system.h" #include "common/system.h"
#include "graphics/surface.h" #include "graphics/surface.h"
#include "graphics/colormasks.h"
#include "math/glmath.h" #include "math/glmath.h"

View file

@ -27,7 +27,6 @@
#include "graphics/pixelbuffer.h" #include "graphics/pixelbuffer.h"
#include "graphics/renderer.h" #include "graphics/renderer.h"
#include "graphics/colormasks.h"
#include "math/matrix3.h" #include "math/matrix3.h"
@ -534,7 +533,7 @@ void Lua_V1::GetSaveGameImage() {
for (int l = 0; l < dataSize / 2; l++) { for (int l = 0; l < dataSize / 2; l++) {
data[l] = savedState->readLEUint16(); data[l] = savedState->readLEUint16();
} }
Graphics::PixelBuffer buf(Graphics::createPixelFormat<565>(), (byte *)data); Graphics::PixelBuffer buf(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), (byte *)data);
screenshot = new Bitmap(buf, width, height, "screenshot"); screenshot = new Bitmap(buf, width, height, "screenshot");
delete[] data; delete[] data;
if (screenshot) { if (screenshot) {

View file

@ -27,7 +27,6 @@
#include "common/endian.h" #include "common/endian.h"
#include "common/textconsole.h" #include "common/textconsole.h"
#include "graphics/colormasks.h"
#include "graphics/pixelformat.h" #include "graphics/pixelformat.h"
namespace Graphics { namespace Graphics {
@ -43,24 +42,6 @@ namespace Graphics {
class PixelBuffer { class PixelBuffer {
public: public:
/**
* Create a PixelBuffer.
* Convenience syntax for PixelBuffer(createPixelFormat<format>(), buffersize, dispose).
*/
template<int format>
inline static PixelBuffer createBuffer(int buffersize, DisposeAfterUse::Flag dispose) {
return PixelBuffer(createPixelFormat<format>(), buffersize, dispose);
}
/**
* Create a PixelBuffer.
* Convenience syntax for PixelBuffer(createPixelFormat<format>(), buffer).
*/
template<int format>
inline static PixelBuffer createBuffer(byte *buffer) {
return PixelBuffer(createPixelFormat<format>(), buffer);
}
/** /**
* Construct an empty PixelBuffer. * Construct an empty PixelBuffer.
*/ */