[Scummvm-git-logs] scummvm master -> 4f6afce3ea5f5d2692886d68c8136345d9d2948a

aquadran noreply at scummvm.org
Sat Dec 18 08:04:14 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4f6afce3ea STARK: W/A for 1x1 dimension textures to be scaled later


Commit: 4f6afce3ea5f5d2692886d68c8136345d9d2948a
    https://github.com/scummvm/scummvm/commit/4f6afce3ea5f5d2692886d68c8136345d9d2948a
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2021-12-18T09:04:10+01:00

Commit Message:
STARK: W/A for 1x1 dimension textures to be scaled later

Changed paths:
    engines/stark/gfx/tinyglbitmap.cpp
    engines/stark/gfx/tinyglbitmap.h
    engines/stark/gfx/tinyglsurface.cpp


diff --git a/engines/stark/gfx/tinyglbitmap.cpp b/engines/stark/gfx/tinyglbitmap.cpp
index e1d98a79c1..f033d579e5 100644
--- a/engines/stark/gfx/tinyglbitmap.cpp
+++ b/engines/stark/gfx/tinyglbitmap.cpp
@@ -52,6 +52,11 @@ void TinyGlBitmap::updateLevel(uint32 level, const Graphics::Surface *surface, c
 		delete convertedSurface;
 	} else {
 		assert(surface->format == Driver::getRGBAPixelFormat());
+		// W/A for 1x1 size texture
+		// store pixel color used later fo creating scalled texture
+		if (_width == 1 && _height == 1) {
+			_texture1x1Color = surface->getPixel(0, 0);
+		}
 		tglUploadBlitImage(_blitImage, *surface, 0, false);
 	}
 }
diff --git a/engines/stark/gfx/tinyglbitmap.h b/engines/stark/gfx/tinyglbitmap.h
index 1e02de6567..bf16e7ac5f 100644
--- a/engines/stark/gfx/tinyglbitmap.h
+++ b/engines/stark/gfx/tinyglbitmap.h
@@ -45,11 +45,13 @@ public:
 	void setSamplingFilter(SamplingFilter filter) override;
 	void setLevelCount(uint32 count) override;
 	void addLevel(uint32 level, const Graphics::Surface *surface, const byte *palette = nullptr) override;
+	uint32 getTexture1x1Color() { return _texture1x1Color; }
 
 protected:
 	void updateLevel(uint32 level, const Graphics::Surface *surface, const byte *palette = nullptr);
 
 	TinyGL::BlitImage *_blitImage;
+	uint32 _texture1x1Color;
 };
 
 } // End of namespace Gfx
diff --git a/engines/stark/gfx/tinyglsurface.cpp b/engines/stark/gfx/tinyglsurface.cpp
index 487205f7ef..5cd0b9b73e 100644
--- a/engines/stark/gfx/tinyglsurface.cpp
+++ b/engines/stark/gfx/tinyglsurface.cpp
@@ -62,13 +62,25 @@ void TinyGLSurfaceRenderer::render(const Texture *texture, const Common::Point &
 	int posY = viewport.getY() * verOffsetXY.getY() + nativeViewport.top;
 	TinyGL::BlitTransform transform(posX, posY);
 
-	// WA for not clipped textues in prompt dialog
+	// W/A for not clipped textures in prompt dialog
 	if (width == 256 && height == 256) {
 		blitTextureHeight = viewport.getY() - dest.y;
 		blitTextureWidth = viewport.getX() - dest.x;
 	}
 
 	transform.sourceRectangle(0, 0, blitTextureWidth, blitTextureHeight);
+
+	// W/A for 1x1 dimension texture
+	// it needs new filled and scalled texture based on one pixel color
+	if (blitTextureWidth == 1 && blitTextureHeight == 1) {
+		auto pixelColor = ((TinyGlBitmap *)const_cast<Texture *>(texture))->getTexture1x1Color();
+		Graphics::Surface surface;
+		surface.create(width, height, Driver::getRGBAPixelFormat());
+		surface.fillRect(Common::Rect(0, 0, width, height), pixelColor);
+		tglUploadBlitImage(blitImage, surface, 0, false);
+		surface.free();
+	}
+
 	transform.tint(1.0, 1.0 - _fadeLevel, 1.0 - _fadeLevel, 1.0 - _fadeLevel);
 	tglBlit(blitImage, transform);
 




More information about the Scummvm-git-logs mailing list