[Scummvm-git-logs] scummvm master -> 3b9f9804ee751f36aaff2d5d593c56f478f62425

aquadran noreply at scummvm.org
Wed Dec 8 13:52:27 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:
3b9f9804ee TINYGL: Rearrange access to TinyGL


Commit: 3b9f9804ee751f36aaff2d5d593c56f478f62425
    https://github.com/scummvm/scummvm/commit/3b9f9804ee751f36aaff2d5d593c56f478f62425
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2021-12-08T14:52:18+01:00

Commit Message:
TINYGL: Rearrange access to TinyGL

Changed paths:
  A graphics/tinygl/tinygl.h
  A graphics/tinygl/zblit_public.h
    engines/grim/gfx_tinygl.cpp
    engines/grim/gfx_tinygl.h
    engines/myst3/gfx_tinygl.cpp
    engines/myst3/gfx_tinygl.h
    engines/myst3/gfx_tinygl_texture.cpp
    engines/myst3/gfx_tinygl_texture.h
    engines/playground3d/gfx_tinygl.cpp
    engines/playground3d/gfx_tinygl.h
    engines/stark/gfx/tinygl.cpp
    engines/stark/gfx/tinygl.h
    engines/stark/gfx/tinyglactor.cpp
    engines/stark/gfx/tinyglactor.h
    engines/stark/gfx/tinyglbitmap.cpp
    engines/stark/gfx/tinyglbitmap.h
    engines/stark/gfx/tinyglfade.cpp
    engines/stark/gfx/tinyglfade.h
    engines/stark/gfx/tinyglprop.cpp
    engines/stark/gfx/tinyglprop.h
    engines/stark/gfx/tinyglsurface.cpp
    engines/stark/gfx/tinyglsurface.h
    engines/stark/gfx/tinygltexture.cpp
    engines/stark/gfx/tinygltexture.h
    graphics/tinygl/gl.h
    graphics/tinygl/zblit.cpp
    graphics/tinygl/zblit.h
    graphics/tinygl/zbuffer.h
    graphics/tinygl/zdirtyrect.cpp
    graphics/tinygl/zdirtyrect.h
    graphics/tinygl/zgl.h
    graphics/tinygl/ztriangle.cpp


diff --git a/engines/grim/gfx_tinygl.cpp b/engines/grim/gfx_tinygl.cpp
index e2fed2e7c4..8ddea296ca 100644
--- a/engines/grim/gfx_tinygl.cpp
+++ b/engines/grim/gfx_tinygl.cpp
@@ -829,7 +829,6 @@ void GfxTinyGL::disableLights() {
 }
 
 void GfxTinyGL::setupLight(Light *light, int lightId) {
-	assert(lightId < T_MAX_LIGHTS);
 	tglEnable(TGL_LIGHTING);
 	float lightColor[] = { 0.0f, 0.0f, 0.0f, 1.0f };
 	float lightPos[] = { 0.0f, 0.0f, 0.0f, 1.0f };
diff --git a/engines/grim/gfx_tinygl.h b/engines/grim/gfx_tinygl.h
index 9f2a10f9c0..9b3b98ff4b 100644
--- a/engines/grim/gfx_tinygl.h
+++ b/engines/grim/gfx_tinygl.h
@@ -25,7 +25,7 @@
 
 #include "engines/grim/gfx_base.h"
 
-#include "graphics/tinygl/zgl.h"
+#include "graphics/tinygl/tinygl.h"
 
 namespace Graphics {
 struct Surface;
diff --git a/engines/myst3/gfx_tinygl.cpp b/engines/myst3/gfx_tinygl.cpp
index b4ceaecdc2..dfa6e51d6a 100644
--- a/engines/myst3/gfx_tinygl.cpp
+++ b/engines/myst3/gfx_tinygl.cpp
@@ -25,6 +25,7 @@
 #include "common/textconsole.h"
 
 #include "graphics/surface.h"
+#include "graphics/tinygl/tinygl.h"
 
 #include "math/vector2d.h"
 #include "math/glmath.h"
@@ -32,7 +33,6 @@
 #include "engines/myst3/gfx.h"
 #include "engines/myst3/gfx_tinygl.h"
 #include "engines/myst3/gfx_tinygl_texture.h"
-#include "graphics/tinygl/zblit.h"
 
 namespace Myst3 {
 
diff --git a/engines/myst3/gfx_tinygl.h b/engines/myst3/gfx_tinygl.h
index 49edd131c2..299b001fb0 100644
--- a/engines/myst3/gfx_tinygl.h
+++ b/engines/myst3/gfx_tinygl.h
@@ -25,10 +25,12 @@
 
 #include "common/rect.h"
 #include "common/system.h"
+
 #include "math/vector3d.h"
 
 #include "engines/myst3/gfx.h"
-#include "graphics/tinygl/zgl.h"
+
+#include "graphics/tinygl/tinygl.h"
 
 namespace Myst3 {
 
diff --git a/engines/myst3/gfx_tinygl_texture.cpp b/engines/myst3/gfx_tinygl_texture.cpp
index 0d647c1047..8590e599fc 100644
--- a/engines/myst3/gfx_tinygl_texture.cpp
+++ b/engines/myst3/gfx_tinygl_texture.cpp
@@ -21,7 +21,8 @@
  */
 
 #include "engines/myst3/gfx_tinygl_texture.h"
-#include "graphics/tinygl/zblit.h"
+
+#include "graphics/tinygl/tinygl.h"
 
 namespace Myst3 {
 
diff --git a/engines/myst3/gfx_tinygl_texture.h b/engines/myst3/gfx_tinygl_texture.h
index 683e46b0fe..583d559647 100644
--- a/engines/myst3/gfx_tinygl_texture.h
+++ b/engines/myst3/gfx_tinygl_texture.h
@@ -23,12 +23,12 @@
 #ifndef GFX_TINYGL_TEXTURE_H
 #define GFX_TINYGL_TEXTURE_H
 
-#include "graphics/surface.h"
-#include "graphics/tinygl/zgl.h"
 #include "common/textconsole.h"
 
+#include "graphics/surface.h"
+#include "graphics/tinygl/tinygl.h"
+
 #include "engines/myst3/gfx.h"
-#include "graphics/tinygl/zblit.h"
 
 namespace Myst3 {
 
diff --git a/engines/playground3d/gfx_tinygl.cpp b/engines/playground3d/gfx_tinygl.cpp
index 3bf9a07b81..002231dd17 100644
--- a/engines/playground3d/gfx_tinygl.cpp
+++ b/engines/playground3d/gfx_tinygl.cpp
@@ -25,7 +25,7 @@
 #include "common/textconsole.h"
 
 #include "graphics/surface.h"
-#include "graphics/tinygl/zblit.h"
+#include "graphics/tinygl/tinygl.h"
 
 #include "math/vector2d.h"
 #include "math/glmath.h"
diff --git a/engines/playground3d/gfx_tinygl.h b/engines/playground3d/gfx_tinygl.h
index fbc19da41e..0959631b58 100644
--- a/engines/playground3d/gfx_tinygl.h
+++ b/engines/playground3d/gfx_tinygl.h
@@ -28,7 +28,7 @@
 
 #include "math/vector3d.h"
 
-#include "graphics/tinygl/zgl.h"
+#include "graphics/tinygl/tinygl.h"
 
 #include "engines/playground3d/gfx.h"
 
diff --git a/engines/stark/gfx/tinygl.cpp b/engines/stark/gfx/tinygl.cpp
index bdd9c1bdb1..242ed794e4 100644
--- a/engines/stark/gfx/tinygl.cpp
+++ b/engines/stark/gfx/tinygl.cpp
@@ -20,13 +20,13 @@
  *
  */
 
-#include "engines/stark/gfx/tinygl.h"
 
 #include "common/system.h"
 #include "common/config-manager.h"
 
 #include "math/matrix4.h"
 
+#include "engines/stark/gfx/tinygl.h"
 #include "engines/stark/gfx/tinyglactor.h"
 #include "engines/stark/gfx/tinyglprop.h"
 #include "engines/stark/gfx/tinyglsurface.h"
diff --git a/engines/stark/gfx/tinygl.h b/engines/stark/gfx/tinygl.h
index 731deb6a3c..6384c571aa 100644
--- a/engines/stark/gfx/tinygl.h
+++ b/engines/stark/gfx/tinygl.h
@@ -24,12 +24,13 @@
 #define STARK_GFX_TINYGL_H
 
 #include "common/system.h"
+
 #include "math/vector3d.h"
 
 #include "engines/stark/gfx/driver.h"
 #include "engines/stark/gfx/renderentry.h"
 
-#include "graphics/tinygl/zgl.h"
+#include "graphics/tinygl/tinygl.h"
 
 namespace Stark {
 namespace Gfx {
diff --git a/engines/stark/gfx/tinyglactor.cpp b/engines/stark/gfx/tinyglactor.cpp
index dae8900b20..9940214bdd 100644
--- a/engines/stark/gfx/tinyglactor.cpp
+++ b/engines/stark/gfx/tinyglactor.cpp
@@ -21,7 +21,6 @@
  */
 
 #include "engines/stark/gfx/tinyglactor.h"
-
 #include "engines/stark/model/model.h"
 #include "engines/stark/model/animhandler.h"
 #include "engines/stark/scene.h"
diff --git a/engines/stark/gfx/tinyglactor.h b/engines/stark/gfx/tinyglactor.h
index 1967a8c1fa..65bb819087 100644
--- a/engines/stark/gfx/tinyglactor.h
+++ b/engines/stark/gfx/tinyglactor.h
@@ -27,7 +27,7 @@
 #include "engines/stark/visual/actor.h"
 #include "engines/stark/gfx/tinygl.h"
 
-#include "graphics/tinygl/zgl.h"
+#include "graphics/tinygl/tinygl.h"
 
 #include "common/hashmap.h"
 #include "common/hash-ptr.h"
diff --git a/engines/stark/gfx/tinyglbitmap.cpp b/engines/stark/gfx/tinyglbitmap.cpp
index b68cc768fa..e1d98a79c1 100644
--- a/engines/stark/gfx/tinyglbitmap.cpp
+++ b/engines/stark/gfx/tinyglbitmap.cpp
@@ -21,7 +21,6 @@
  */
 
 #include "engines/stark/gfx/tinyglbitmap.h"
-
 #include "engines/stark/gfx/driver.h"
 
 #include "graphics/surface.h"
diff --git a/engines/stark/gfx/tinyglbitmap.h b/engines/stark/gfx/tinyglbitmap.h
index 754513ede2..1e02de6567 100644
--- a/engines/stark/gfx/tinyglbitmap.h
+++ b/engines/stark/gfx/tinyglbitmap.h
@@ -25,7 +25,7 @@
 
 #include "engines/stark/gfx/texture.h"
 
-#include "graphics/tinygl/zgl.h"
+#include "graphics/tinygl/tinygl.h"
 
 namespace Stark {
 namespace Gfx {
diff --git a/engines/stark/gfx/tinyglfade.cpp b/engines/stark/gfx/tinyglfade.cpp
index a4b827d43b..4972e75b5b 100644
--- a/engines/stark/gfx/tinyglfade.cpp
+++ b/engines/stark/gfx/tinyglfade.cpp
@@ -21,7 +21,6 @@
  */
 
 #include "engines/stark/gfx/tinyglfade.h"
-
 #include "engines/stark/gfx/tinygl.h"
 
 namespace Stark {
diff --git a/engines/stark/gfx/tinyglfade.h b/engines/stark/gfx/tinyglfade.h
index df3b6f21e9..ff9c9ea1bb 100644
--- a/engines/stark/gfx/tinyglfade.h
+++ b/engines/stark/gfx/tinyglfade.h
@@ -25,7 +25,7 @@
 
 #include "engines/stark/gfx/faderenderer.h"
 
-#include "graphics/tinygl/zgl.h"
+#include "graphics/tinygl/tinygl.h"
 
 namespace Stark {
 namespace Gfx {
diff --git a/engines/stark/gfx/tinyglprop.cpp b/engines/stark/gfx/tinyglprop.cpp
index 423df81ea3..7694a86eb7 100644
--- a/engines/stark/gfx/tinyglprop.cpp
+++ b/engines/stark/gfx/tinyglprop.cpp
@@ -21,7 +21,6 @@
  */
 
 #include "engines/stark/gfx/tinyglprop.h"
-
 #include "engines/stark/gfx/texture.h"
 #include "engines/stark/formats/biffmesh.h"
 #include "engines/stark/scene.h"
diff --git a/engines/stark/gfx/tinyglprop.h b/engines/stark/gfx/tinyglprop.h
index 2c3a973c4e..ca75bf6742 100644
--- a/engines/stark/gfx/tinyglprop.h
+++ b/engines/stark/gfx/tinyglprop.h
@@ -27,7 +27,7 @@
 #include "engines/stark/visual/prop.h"
 #include "engines/stark/gfx/tinygl.h"
 
-#include "graphics/tinygl/zgl.h"
+#include "graphics/tinygl/tinygl.h"
 
 #include "common/hashmap.h"
 #include "common/hash-ptr.h"
diff --git a/engines/stark/gfx/tinyglsurface.cpp b/engines/stark/gfx/tinyglsurface.cpp
index 5752862dea..487205f7ef 100644
--- a/engines/stark/gfx/tinyglsurface.cpp
+++ b/engines/stark/gfx/tinyglsurface.cpp
@@ -24,7 +24,7 @@
 #include "engines/stark/gfx/tinyglbitmap.h"
 #include "engines/stark/gfx/texture.h"
 
-#include "graphics/tinygl/zblit.h"
+#include "graphics/tinygl/tinygl.h"
 
 namespace Stark {
 namespace Gfx {
diff --git a/engines/stark/gfx/tinyglsurface.h b/engines/stark/gfx/tinyglsurface.h
index 38d9c0e26f..671be90ae5 100644
--- a/engines/stark/gfx/tinyglsurface.h
+++ b/engines/stark/gfx/tinyglsurface.h
@@ -26,8 +26,7 @@
 #include "engines/stark/gfx/surfacerenderer.h"
 #include "engines/stark/gfx/tinygl.h"
 
-#include "graphics/tinygl/zgl.h"
-#include "graphics/tinygl/zblit.h"
+#include "graphics/tinygl/tinygl.h"
 
 #include "math/vector2d.h"
 
diff --git a/engines/stark/gfx/tinygltexture.cpp b/engines/stark/gfx/tinygltexture.cpp
index e2b64c213d..571510a046 100644
--- a/engines/stark/gfx/tinygltexture.cpp
+++ b/engines/stark/gfx/tinygltexture.cpp
@@ -21,7 +21,6 @@
  */
 
 #include "engines/stark/gfx/tinygltexture.h"
-
 #include "engines/stark/gfx/driver.h"
 
 #include "graphics/surface.h"
diff --git a/engines/stark/gfx/tinygltexture.h b/engines/stark/gfx/tinygltexture.h
index 387c75339b..37156417b2 100644
--- a/engines/stark/gfx/tinygltexture.h
+++ b/engines/stark/gfx/tinygltexture.h
@@ -25,7 +25,7 @@
 
 #include "engines/stark/gfx/texture.h"
 
-#include "graphics/tinygl/zgl.h"
+#include "graphics/tinygl/tinygl.h"
 
 namespace Stark {
 namespace Gfx {
diff --git a/graphics/tinygl/gl.h b/graphics/tinygl/gl.h
index 9c5d221ff9..0c6214fc8f 100644
--- a/graphics/tinygl/gl.h
+++ b/graphics/tinygl/gl.h
@@ -849,16 +849,10 @@ void tglTexCoordPointer(TGLint size, TGLenum type, TGLsizei stride, const TGLvoi
 // polygon offset
 void tglPolygonOffset(TGLfloat factor, TGLfloat units);
 
-// custom extension
+// custom extensions
 void tglSetShadowMaskBuf(unsigned char *buf);
 void tglSetShadowColor(unsigned char r, unsigned char g, unsigned char b);
 void tglEnableDirtyRects(bool enable);
 void tglDebug(int mode);
 
-namespace TinyGL {
-
-void presentBuffer();
-
-} // end of namespace TinyGL
-
 #endif
diff --git a/graphics/tinygl/tinygl.h b/graphics/tinygl/tinygl.h
new file mode 100644
index 0000000000..b4103c883f
--- /dev/null
+++ b/graphics/tinygl/tinygl.h
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GRAPHICS_TINYGL_H
+#define GRAPHICS_TINYGL_H
+
+#include "graphics/pixelformat.h"
+#include "graphics/surface.h"
+#include "graphics/tinygl/gl.h"
+#include "graphics/tinygl/zblit_public.h"
+
+namespace TinyGL {
+
+void createContext(int screenW, int screenH, Graphics::PixelFormat pixelFormat, int textureSize, bool dirtyRectsEnable = true);
+void destroyContext();
+void presentBuffer();
+void getSurfaceRef(Graphics::Surface &surface);
+Graphics::Surface *copyToBuffer(const Graphics::PixelFormat &dstFormat);
+
+} // end of namespace TinyGL
+
+#endif
diff --git a/graphics/tinygl/zblit.cpp b/graphics/tinygl/zblit.cpp
index ca2d50801c..d29646679a 100644
--- a/graphics/tinygl/zblit.cpp
+++ b/graphics/tinygl/zblit.cpp
@@ -20,12 +20,6 @@
  *
  */
 
-/*
- * This file is based on, or a modified version of code from TinyGL (C) 1997-1998 Fabrice Bellard,
- * which is licensed under the zlib-license (see LICENSE).
- * It also has modifications by the ResidualVM-team, which are covered under the GPLv2 (or later).
- */
-
 #include "common/array.h"
 
 #include "graphics/tinygl/zblit.h"
@@ -33,6 +27,7 @@
 #include "graphics/tinygl/pixelbuffer.h"
 #include "graphics/tinygl/zdirtyrect.h"
 #include "graphics/tinygl/gl.h"
+
 #include <math.h>
 
 namespace TinyGL {
diff --git a/graphics/tinygl/zblit.h b/graphics/tinygl/zblit.h
index 7ffc4993d2..f5db4c64af 100644
--- a/graphics/tinygl/zblit.h
+++ b/graphics/tinygl/zblit.h
@@ -20,154 +20,18 @@
  *
  */
 
-/*
- * This file is based on, or a modified version of code from TinyGL (C) 1997-1998 Fabrice Bellard,
- * which is licensed under the zlib-license (see LICENSE).
- * It also has modifications by the ResidualVM-team, which are covered under the GPLv2 (or later).
- */
-
 #ifndef GRAPHICS_TINYGL_ZBLIT_H_
 #define GRAPHICS_TINYGL_ZBLIT_H_
 
-#include "graphics/surface.h"
 #include "common/rect.h"
 
-namespace TinyGL {
-
-struct BlitTransform {
-	BlitTransform(int dstX, int dstY) : _rotation(0), _originX(0), _originY(0), _aTint(1.0f),
-				_rTint(1.0f), _gTint(1.0f), _bTint(1.0), _flipHorizontally(false),
-				_flipVertically(false) {
-		_destinationRectangle.translate(dstX, dstY);
-	}
-
-	void sourceRectangle(int srcX, int srcY, int srcWidth, int srcHeight) {
-		_sourceRectangle.left = srcX;
-		_sourceRectangle.top = srcY;
-		_sourceRectangle.setWidth(srcWidth);
-		_sourceRectangle.setHeight(srcHeight);
-	}
-
-	void tint(float aTint, float rTint = 1.0f, float gTint = 1.0f, float bTint = 1.0f) {
-		_aTint = aTint;
-		_rTint = rTint;
-		_gTint = gTint;
-		_bTint = bTint;
-	}
-
-	void scale(int width, int height) {
-		_destinationRectangle.setWidth(width);
-		_destinationRectangle.setHeight(height);
-	}
-
-	void rotate(int rotation, int originX, int originY) {
-		_rotation = rotation;
-		_originX = originX;
-		_originY = originY;
-	}
-
-	void flip(bool verticalFlip, bool horizontalFlip) {
-		_flipVertically = verticalFlip;
-		_flipHorizontally = horizontalFlip;
-	}
-
-	bool operator==(const BlitTransform &other) const {
-		return _sourceRectangle == other._sourceRectangle && _destinationRectangle == other._destinationRectangle &&
-			_rotation == other._rotation && _originX == other._originX && _originY == other._originY &&
-			_aTint == other._aTint && _rTint == other._rTint && _gTint == other._gTint && _bTint == other._bTint &&
-			_flipHorizontally == other._flipHorizontally && _flipVertically == other._flipVertically;
-	}
+#include "graphics/surface.h"
+#include "graphics/tinygl/zblit_public.h"
 
-	Common::Rect _sourceRectangle;
-	Common::Rect _destinationRectangle;
-	int _rotation;
-	int _originX, _originY;
-	float _aTint, _rTint, _gTint, _bTint;
-	bool _flipHorizontally, _flipVertically;
-};
+namespace TinyGL {
 
 struct BlitImage;
 
-} // end of namespace TinyGL
-
-
-/**
- at brief Generates a new blit image.
- at return returns an opaque pointer to the blit image.
-*/
-TinyGL::BlitImage *tglGenBlitImage();
-
-/**
- at brief Copies a surface data into the provided blit image.
- at param pointer to the blit image.
- at param referece to the surface that's being copied
- at param color key value for alpha color keying
- at param boolean that enables alpha color keying
-*/
-void tglUploadBlitImage(TinyGL::BlitImage *blitImage, const Graphics::Surface &surface, uint32 colorKey, bool applyColorKey);
-
-/**
- at brief Destroys an instance of blit image.
- at param pointer to the blit image.
-*/
-void tglDeleteBlitImage(TinyGL::BlitImage *blitImage);
-
-/**
- at brief Getter for current blit image width and height
- at param pointer to the blit image.
- at param reference to the width variable
- at param reference to the height variable
-*/
-void tglGetBlitImageSize(TinyGL::BlitImage *blitImage, int &width, int &height);
-
-/**
- at brief Provides a way to check if the image has been updated.
- at param pointer to the blit image.
- at param boolean that enables alpha color keying
-*/
-int tglGetBlitImageVersion(TinyGL::BlitImage *blitImage);
-
-/**
- at brief Blits an image to the color buffer.
- at param pointer to the blit image.
- at param blit transform information.
-*/
-void tglBlit(TinyGL::BlitImage *blitImage, const TinyGL::BlitTransform &transform);
-
-/**
- at brief Blits an image to the color buffer.
- at param pointer to the blit image.
- at param x destination coordinate.
- at param y destination coordinate.
-*/
-void tglBlit(TinyGL::BlitImage *blitImage, int x, int y);
-
-/**
- at brief Blits an image to the color buffer without performing any type of blending.
- at param pointer to the blit image.
- at param blit transform information.
-*/
-void tglBlitNoBlend(TinyGL::BlitImage *blitImage, const TinyGL::BlitTransform &transform);
-
-/**
- at brief Blits an image to the color buffer without performinc any type of blending, image transformation or tinting.
- at param pointer to the blit image.
- at param x destination coordinate.
- at param y destination coordinate.
-*/
-void tglBlitFast(TinyGL::BlitImage *blitImage, int x, int y);
-
-/**
- at brief Blits an image to the depth buffer.
- at param pointer to the blit image.
- at param x destination coordinate.
- at param y destination coordinate.
-*/
-void tglBlitZBuffer(TinyGL::BlitImage *blitImage, int x, int y);
-
-void tglIncBlitImageRef(TinyGL::BlitImage *blitImage);
-
-namespace TinyGL {
 namespace Internal {
 	/**
 	@brief Performs a cleanup of disposed blit images.
diff --git a/graphics/tinygl/zblit_public.h b/graphics/tinygl/zblit_public.h
new file mode 100644
index 0000000000..cfbbaed0e6
--- /dev/null
+++ b/graphics/tinygl/zblit_public.h
@@ -0,0 +1,164 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GRAPHICS_TINYGL_ZBLIT_PUBLIC_H
+#define GRAPHICS_TINYGL_ZBLIT_PUBLIC_H
+
+#include "common/rect.h"
+
+#include "graphics/surface.h"
+
+namespace TinyGL {
+
+struct BlitTransform {
+	BlitTransform(int dstX, int dstY) : _rotation(0), _originX(0), _originY(0), _aTint(1.0f),
+				_rTint(1.0f), _gTint(1.0f), _bTint(1.0), _flipHorizontally(false),
+				_flipVertically(false) {
+		_destinationRectangle.translate(dstX, dstY);
+	}
+
+	void sourceRectangle(int srcX, int srcY, int srcWidth, int srcHeight) {
+		_sourceRectangle.left = srcX;
+		_sourceRectangle.top = srcY;
+		_sourceRectangle.setWidth(srcWidth);
+		_sourceRectangle.setHeight(srcHeight);
+	}
+
+	void tint(float aTint, float rTint = 1.0f, float gTint = 1.0f, float bTint = 1.0f) {
+		_aTint = aTint;
+		_rTint = rTint;
+		_gTint = gTint;
+		_bTint = bTint;
+	}
+
+	void scale(int width, int height) {
+		_destinationRectangle.setWidth(width);
+		_destinationRectangle.setHeight(height);
+	}
+
+	void rotate(int rotation, int originX, int originY) {
+		_rotation = rotation;
+		_originX = originX;
+		_originY = originY;
+	}
+
+	void flip(bool verticalFlip, bool horizontalFlip) {
+		_flipVertically = verticalFlip;
+		_flipHorizontally = horizontalFlip;
+	}
+
+	bool operator==(const BlitTransform &other) const {
+		return _sourceRectangle == other._sourceRectangle && _destinationRectangle == other._destinationRectangle &&
+			_rotation == other._rotation && _originX == other._originX && _originY == other._originY &&
+			_aTint == other._aTint && _rTint == other._rTint && _gTint == other._gTint && _bTint == other._bTint &&
+			_flipHorizontally == other._flipHorizontally && _flipVertically == other._flipVertically;
+	}
+
+	Common::Rect _sourceRectangle;
+	Common::Rect _destinationRectangle;
+	int _rotation;
+	int _originX, _originY;
+	float _aTint, _rTint, _gTint, _bTint;
+	bool _flipHorizontally, _flipVertically;
+};
+
+struct BlitImage;
+
+} // end of namespace TinyGL
+
+/**
+ at brief Generates a new blit image.
+ at return returns an opaque pointer to the blit image.
+*/
+TinyGL::BlitImage *tglGenBlitImage();
+
+/**
+ at brief Copies a surface data into the provided blit image.
+ at param pointer to the blit image.
+ at param referece to the surface that's being copied
+ at param color key value for alpha color keying
+ at param boolean that enables alpha color keying
+*/
+void tglUploadBlitImage(TinyGL::BlitImage *blitImage, const Graphics::Surface &surface, uint32 colorKey, bool applyColorKey);
+
+/**
+ at brief Destroys an instance of blit image.
+ at param pointer to the blit image.
+*/
+void tglDeleteBlitImage(TinyGL::BlitImage *blitImage);
+
+/**
+ at brief Getter for current blit image width and height
+ at param pointer to the blit image.
+ at param reference to the width variable
+ at param reference to the height variable
+*/
+void tglGetBlitImageSize(TinyGL::BlitImage *blitImage, int &width, int &height);
+
+/**
+ at brief Provides a way to check if the image has been updated.
+ at param pointer to the blit image.
+ at param boolean that enables alpha color keying
+*/
+int tglGetBlitImageVersion(TinyGL::BlitImage *blitImage);
+
+/**
+ at brief Blits an image to the color buffer.
+ at param pointer to the blit image.
+ at param blit transform information.
+*/
+void tglBlit(TinyGL::BlitImage *blitImage, const TinyGL::BlitTransform &transform);
+
+/**
+ at brief Blits an image to the color buffer.
+ at param pointer to the blit image.
+ at param x destination coordinate.
+ at param y destination coordinate.
+*/
+void tglBlit(TinyGL::BlitImage *blitImage, int x, int y);
+
+/**
+ at brief Blits an image to the color buffer without performing any type of blending.
+ at param pointer to the blit image.
+ at param blit transform information.
+*/
+void tglBlitNoBlend(TinyGL::BlitImage *blitImage, const TinyGL::BlitTransform &transform);
+
+/**
+ at brief Blits an image to the color buffer without performinc any type of blending, image transformation or tinting.
+ at param pointer to the blit image.
+ at param x destination coordinate.
+ at param y destination coordinate.
+*/
+void tglBlitFast(TinyGL::BlitImage *blitImage, int x, int y);
+
+/**
+ at brief Blits an image to the depth buffer.
+ at param pointer to the blit image.
+ at param x destination coordinate.
+ at param y destination coordinate.
+*/
+void tglBlitZBuffer(TinyGL::BlitImage *blitImage, int x, int y);
+
+void tglIncBlitImageRef(TinyGL::BlitImage *blitImage);
+
+#endif // GRAPHICS_TINYGL_ZBLIT_PUBLIC_H
diff --git a/graphics/tinygl/zbuffer.h b/graphics/tinygl/zbuffer.h
index 03d6a76acc..c2dd9cc63c 100644
--- a/graphics/tinygl/zbuffer.h
+++ b/graphics/tinygl/zbuffer.h
@@ -106,16 +106,6 @@ struct FrameBuffer {
 	FrameBuffer(int xsize, int ysize, const Graphics::PixelFormat &format);
 	~FrameBuffer();
 
-private:
-
-	Buffer *genOffscreenBuffer();
-	void delOffscreenBuffer(Buffer *buffer);
-
-public:
-
-	void clear(int clear_z, int z, int clear_color, int r, int g, int b);
-	void clearRegion(int x, int y, int w, int h,int clear_z, int z, int clear_color, int r, int g, int b);
-
 	Graphics::PixelFormat getPixelFormat() {
 		return _pbufFormat;
 	}
@@ -132,15 +122,23 @@ public:
 		return _pbufHeight;
 	}
 
-	unsigned int *getZBuffer() {
+	const uint *getZBuffer() {
 		return _zbuf;
 	}
 
-	FORCEINLINE void readPixelRGB(int pixel, byte &r, byte &g, byte &b) {
-		_pbuf.getRGBAt(pixel, r, g, b);
+	Graphics::Surface *copyToBuffer(const Graphics::PixelFormat &dstFormat) {
+		Graphics::Surface tmp;
+		tmp.init(_pbufWidth, _pbufHeight, _pbufPitch, _pbuf.getRawBuffer(), _pbufFormat);
+		return tmp.convertTo(dstFormat);
 	}
 
-	FORCEINLINE bool compareDepth(unsigned int &zSrc, unsigned int &zDst) {
+	void getSurfaceRef(Graphics::Surface &surface) {
+		surface.init(_pbufWidth, _pbufHeight, _pbufPitch, _pbuf.getRawBuffer(), _pbufFormat);
+	}
+
+private:
+
+	FORCEINLINE bool compareDepth(uint &zSrc, uint &zDst) {
 		if (!_depthTestEnabled)
 			return true;
 
@@ -177,8 +175,6 @@ public:
 		return false;
 	}
 
-private:
-
 	FORCEINLINE bool checkAlphaTest(byte aSrc) {
 		if (!_alphaTestEnabled)
 			return true;
@@ -216,15 +212,11 @@ private:
 		return false;
 	}
 
-public:
-
 	template <bool kEnableAlphaTest, bool kBlendingEnabled>
 	FORCEINLINE void writePixel(int pixel, int value) {
 		writePixel<kEnableAlphaTest, kBlendingEnabled, false>(pixel, value, 0);
 	}
 
-private:
-
 	template <bool kEnableAlphaTest, bool kBlendingEnabled, bool kDepthWrite>
 	FORCEINLINE void writePixel(int pixel, int value, unsigned int z) {
 		if (kBlendingEnabled == false) {
@@ -248,6 +240,29 @@ private:
 		}
 	}
 
+	template <bool kDepthWrite, bool kEnableAlphaTest, bool kEnableScissor, bool kEnableBlending>
+	FORCEINLINE void putPixelFlat(FrameBuffer *buffer, int buf, unsigned int *pz, int _a,
+								  int x, int y, unsigned int &z, unsigned int &r, unsigned int &g, unsigned int &b, unsigned int &a, int &dzdx);
+
+	template <bool kDepthWrite, bool kEnableAlphaTest, bool kEnableScissor, bool kEnableBlending>
+	FORCEINLINE void putPixelSmooth(FrameBuffer *buffer, int buf, unsigned int *pz, int _a,
+									int x, int y, unsigned int &z, unsigned int &r, unsigned int &g, unsigned int &b, unsigned int &a,
+									int &dzdx, int &drdx, int &dgdx, int &dbdx, unsigned int dadx);
+
+	template <bool kDepthWrite, bool kEnableScissor>
+	FORCEINLINE void putPixelDepth(FrameBuffer *buffer, int buf, unsigned int *pz, int _a, int x, int y, unsigned int &z, int &dzdx);
+
+	template <bool kDepthWrite, bool kAlphaTestEnabled, bool kEnableScissor, bool kBlendingEnabled>
+	FORCEINLINE void putPixelShadow(FrameBuffer *buffer, int buf, unsigned int *pz, int _a, int x, int y, unsigned int &z,
+									unsigned int &r, unsigned int &g, unsigned int &b, int &dzdx, unsigned char *pm);
+
+	template <bool kDepthWrite, bool kLightsMode, bool kSmoothMode, bool kEnableAlphaTest, bool kEnableScissor, bool kEnableBlending>
+	FORCEINLINE void putPixelTextureMappingPerspective(FrameBuffer *buffer, int buf, const Graphics::TexelBuffer *texture,
+													   unsigned int wrap_s, unsigned int wrap_t, unsigned int *pz, int _a,
+													   int x, int y, unsigned int &z, int &t, int &s,
+													   unsigned int &r, unsigned int &g, unsigned int &b, unsigned int &a,
+													   int &dzdx, int &dsdx, int &dtdx, int &drdx, int &dgdx, int &dbdx, unsigned int dadx);
+
 	template <bool kEnableAlphaTest>
 	FORCEINLINE void writePixel(int pixel, int value) {
 		if (_blendingEnabled) {
@@ -261,12 +276,12 @@ private:
 		writePixel(pixel, 255, rSrc, gSrc, bSrc);
 	}
 
-public:
-
 	FORCEINLINE bool scissorPixel(int x, int y) {
 		return !_clipRectangle.contains(x, y);
 	}
 
+public:
+
 	FORCEINLINE void writePixel(int pixel, byte aSrc, byte rSrc, byte gSrc, byte bSrc) {
 		if (_alphaTestEnabled) {
 			writePixel<true>(pixel, aSrc, rSrc, gSrc, bSrc);
@@ -275,6 +290,8 @@ public:
 		}
 	}
 
+private:
+
 	template <bool kEnableAlphaTest>
 	FORCEINLINE void writePixel(int pixel, byte aSrc, byte rSrc, byte gSrc, byte bSrc) {
 		if (_blendingEnabled) {
@@ -401,93 +418,92 @@ public:
 		}
 	}
 
-	Graphics::Surface *copyToBuffer(const Graphics::PixelFormat &dstFormat) {
-		Graphics::Surface tmp;
-		tmp.init(_pbufWidth, _pbufHeight, _pbufPitch, _pbuf.getRawBuffer(), _pbufFormat);
-		return tmp.convertTo(dstFormat);
-	}
+public:
 
-	void getSurfaceRef(Graphics::Surface &surface) {
-		surface.init(_pbufWidth, _pbufHeight, _pbufPitch, _pbuf.getRawBuffer(), _pbufFormat);
-	}
+	void clear(int clear_z, int z, int clear_color, int r, int g, int b);
+	void clearRegion(int x, int y, int w, int h,int clear_z, int z, int clear_color, int r, int g, int b);
 
-	void setScissorRectangle(const Common::Rect &rect) {
+	FORCEINLINE void setScissorRectangle(const Common::Rect &rect) {
 		_clipRectangle = rect;
 		_enableScissor = true;
 	}
 
-	void resetScissorRectangle() {
+	FORCEINLINE void resetScissorRectangle() {
 		_enableScissor = false;
 	}
 
-	void setShadowMaskBuf(byte *shadowBuffer) {
+	FORCEINLINE void setShadowMaskBuf(byte *shadowBuffer) {
 		_shadowMaskBuf = shadowBuffer;
 	}
 
-	void setShadowRGB(int r, int g, int b) {
+	FORCEINLINE void setShadowRGB(int r, int g, int b) {
 		_shadowColorR = r;
 		_shadowColorG = g;
 		_shadowColorB = b;
 	}
-	void enableBlending(bool enable) {
+
+	FORCEINLINE void enableBlending(bool enable) {
 		_blendingEnabled = enable;
 	}
 
-	void enableDepthTest(bool enable) {
-		_depthTestEnabled = enable;
+	FORCEINLINE void setBlendingFactors(int sFactor, int dFactor) {
+		_sourceBlendingFactor = sFactor;
+		_destinationBlendingFactor = dFactor;
 	}
 
-	void setOffsetStates(int offsetStates) {
-		_offsetStates = offsetStates;
+	FORCEINLINE void enableAlphaTest(bool enable) {
+		_alphaTestEnabled = enable;
 	}
 
-	void setOffsetFactor(float offsetFactor) {
-		_offsetFactor = offsetFactor;
+	FORCEINLINE void setAlphaTestFunc(int func, int ref) {
+		_alphaTestFunc = func;
+		_alphaTestRefVal = ref;
 	}
 
-	void setOffsetUnits(float offsetUnits) {
-		_offsetUnits = offsetUnits;
+	FORCEINLINE void enableDepthTest(bool enable) {
+		_depthTestEnabled = enable;
 	}
 
-	void setBlendingFactors(int sFactor, int dFactor) {
-		_sourceBlendingFactor = sFactor;
-		_destinationBlendingFactor = dFactor;
+	FORCEINLINE void setDepthFunc(int func) {
+		_depthFunc = func;
 	}
 
-	void enableAlphaTest(bool enable) {
-		_alphaTestEnabled = enable;
+	FORCEINLINE void enableDepthWrite(bool enable) {
+		_depthWrite = enable;
 	}
 
-	void setAlphaTestFunc(int func, int ref) {
-		_alphaTestFunc = func;
-		_alphaTestRefVal = ref;
+	FORCEINLINE void setOffsetStates(int offsetStates) {
+		_offsetStates = offsetStates;
 	}
 
-	void setDepthFunc(int func) {
-		_depthFunc = func;
+	FORCEINLINE void setOffsetFactor(float offsetFactor) {
+		_offsetFactor = offsetFactor;
 	}
 
-	void enableDepthWrite(bool enable) {
-		_depthWrite = enable;
+	FORCEINLINE void setOffsetUnits(float offsetUnits) {
+		_offsetUnits = offsetUnits;
 	}
 
-	void setTexture(const Graphics::TexelBuffer *texture, unsigned int wraps, unsigned int wrapt) {
+	FORCEINLINE void setTexture(const Graphics::TexelBuffer *texture, unsigned int wraps, unsigned int wrapt) {
 		_currentTexture = texture;
 		_wrapS = wraps;
 		_wrapT = wrapt;
 	}
 
-	void setTextureSizeAndMask(int textureSize, int textureSizeMask) {
+	FORCEINLINE void setTextureSizeAndMask(int textureSize, int textureSizeMask) {
 		_textureSize = textureSize;
 		_textureSizeMask = textureSizeMask;
 	}
 
 private:
+
 	/**
 	* Blit the buffer to the screen buffer, checking the depth of the pixels.
 	* Eack pixel is copied if and only if its depth value is bigger than the
 	* depth value of the screen pixel, so if it is 'above'.
 	*/
+	Buffer *genOffscreenBuffer();
+	void delOffscreenBuffer(Buffer *buffer);
 	void blitOffscreenBuffer(Buffer *buffer);
 	void selectOffscreenBuffer(Buffer *buffer);
 	void clearOffscreenBuffer(Buffer *buffer);
@@ -538,10 +554,10 @@ private:
 	FORCEINLINE void putPixel(unsigned int pixelOffset, int color, int x, int y);
 
 	template <bool kInterpRGB, bool kInterpZ, bool kDepthWrite>
-	void drawLine(const ZBufferPoint *p1, const ZBufferPoint *p2);
+	FORCEINLINE void drawLine(const ZBufferPoint *p1, const ZBufferPoint *p2);
 
 	template <bool kInterpRGB, bool kInterpZ, bool kDepthWrite, bool kEnableScissor>
-	void drawLine(const ZBufferPoint *p1, const ZBufferPoint *p2);
+	FORCEINLINE void drawLine(const ZBufferPoint *p1, const ZBufferPoint *p2);
 
 	Buffer _offscreenBuffer;
 
diff --git a/graphics/tinygl/zdirtyrect.cpp b/graphics/tinygl/zdirtyrect.cpp
index 7f2ef7b216..28248d1d0c 100644
--- a/graphics/tinygl/zdirtyrect.cpp
+++ b/graphics/tinygl/zdirtyrect.cpp
@@ -20,15 +20,10 @@
  *
  */
 
-/*
- * This file is based on, or a modified version of code from TinyGL (C) 1997-1998 Fabrice Bellard,
- * which is licensed under the zlib-license (see LICENSE).
- * It also has modifications by the ResidualVM-team, which are covered under the GPLv2 (or later).
- */
-
 #include "graphics/tinygl/zdirtyrect.h"
 #include "graphics/tinygl/zgl.h"
 #include "graphics/tinygl/gl.h"
+
 #include "common/debug.h"
 #include "common/math.h"
 
diff --git a/graphics/tinygl/zdirtyrect.h b/graphics/tinygl/zdirtyrect.h
index 489ee7cadf..92fd8b189d 100644
--- a/graphics/tinygl/zdirtyrect.h
+++ b/graphics/tinygl/zdirtyrect.h
@@ -20,19 +20,14 @@
  *
  */
 
-/*
- * This file is based on, or a modified version of code from TinyGL (C) 1997-1998 Fabrice Bellard,
- * which is licensed under the zlib-license (see LICENSE).
- * It also has modifications by the ResidualVM-team, which are covered under the GPLv2 (or later).
- */
-
-#ifndef GRAPHICS_TINYGL_ZRECT_H_
-#define GRAPHICS_TINYGL_ZRECT_H_
+#ifndef GRAPHICS_TINYGL_ZRECT_H
+#define GRAPHICS_TINYGL_ZRECT_H
 
 #include "common/rect.h"
-#include "graphics/tinygl/zblit.h"
 #include "common/array.h"
 
+#include "graphics/tinygl/zblit.h"
+
 namespace TinyGL {
 
 namespace Internal {
diff --git a/graphics/tinygl/zgl.h b/graphics/tinygl/zgl.h
index 50d82fe582..2fa60c502e 100644
--- a/graphics/tinygl/zgl.h
+++ b/graphics/tinygl/zgl.h
@@ -35,6 +35,8 @@
 #include "common/list.h"
 #include "common/scummsys.h"
 
+#include "graphics/pixelformat.h"
+#include "graphics/surface.h"
 #include "graphics/tinygl/gl.h"
 #include "graphics/tinygl/zbuffer.h"
 #include "graphics/tinygl/zmath.h"
@@ -486,13 +488,6 @@ GLContext *gl_get_context();
 // matrix.c
 void gl_print_matrix(const float *m);
 
-void getSurfaceRef(Graphics::Surface &surface);
-
-Graphics::Surface *copyToBuffer(const Graphics::PixelFormat &dstFormat);
-
-void createContext(int screenW, int screenH, Graphics::PixelFormat pixelFormat, int textureSize, bool dirtyRectsEnable = true);
-void destroyContext();
-
 #ifdef DEBUG
 #define dprintf fprintf
 #else
diff --git a/graphics/tinygl/ztriangle.cpp b/graphics/tinygl/ztriangle.cpp
index 2eea588893..d96634dda0 100644
--- a/graphics/tinygl/ztriangle.cpp
+++ b/graphics/tinygl/ztriangle.cpp
@@ -36,8 +36,8 @@ namespace TinyGL {
 static const int NB_INTERP = 8;
 
 template <bool kDepthWrite, bool kEnableAlphaTest, bool kEnableScissor, bool kEnableBlending>
-FORCEINLINE static void putPixelFlat(FrameBuffer *buffer, int buf, unsigned int *pz, int _a,
-									 int x, int y, unsigned int &z, unsigned int &r, unsigned int &g, unsigned int &b, unsigned int &a, int &dzdx) {
+FORCEINLINE void FrameBuffer::putPixelFlat(FrameBuffer *buffer, int buf, unsigned int *pz, int _a,
+	                             int x, int y, unsigned int &z, unsigned int &r, unsigned int &g, unsigned int &b, unsigned int &a, int &dzdx) {
 	if ((!kEnableScissor || !buffer->scissorPixel(x + _a, y)) && buffer->compareDepth(z, pz[_a])) {
 		buffer->writePixel<kEnableAlphaTest, kEnableBlending, kDepthWrite>(buf + _a, a >> (ZB_POINT_ALPHA_BITS - 8), r >> (ZB_POINT_RED_BITS - 8), g >> (ZB_POINT_GREEN_BITS - 8), b >> (ZB_POINT_BLUE_BITS - 8), z);
 	}
@@ -45,9 +45,9 @@ FORCEINLINE static void putPixelFlat(FrameBuffer *buffer, int buf, unsigned int
 }
 
 template <bool kDepthWrite, bool kEnableAlphaTest, bool kEnableScissor, bool kEnableBlending>
-FORCEINLINE static void putPixelSmooth(FrameBuffer *buffer, int buf, unsigned int *pz, int _a,
-									   int x, int y, unsigned int &z, unsigned int &r, unsigned int &g, unsigned int &b, unsigned int &a,
-									   int &dzdx, int &drdx, int &dgdx, int &dbdx, unsigned int dadx) {
+FORCEINLINE void FrameBuffer::putPixelSmooth(FrameBuffer *buffer, int buf, unsigned int *pz, int _a,
+	                               int x, int y, unsigned int &z, unsigned int &r, unsigned int &g, unsigned int &b, unsigned int &a,
+	                               int &dzdx, int &drdx, int &dgdx, int &dbdx, unsigned int dadx) {
 	if ((!kEnableScissor || !buffer->scissorPixel(x + _a, y)) && buffer->compareDepth(z, pz[_a])) {
 		buffer->writePixel<kEnableAlphaTest, kEnableBlending, kDepthWrite>(buf + _a, a >> (ZB_POINT_ALPHA_BITS - 8), r >> (ZB_POINT_RED_BITS - 8), g >> (ZB_POINT_GREEN_BITS - 8), b >> (ZB_POINT_BLUE_BITS - 8), z);
 	}
@@ -59,7 +59,7 @@ FORCEINLINE static void putPixelSmooth(FrameBuffer *buffer, int buf, unsigned in
 }
 
 template <bool kDepthWrite, bool kEnableScissor>
-FORCEINLINE static void putPixelDepth(FrameBuffer *buffer, int buf, unsigned int *pz, int _a, int x, int y, unsigned int &z, int &dzdx) {
+FORCEINLINE void FrameBuffer::putPixelDepth(FrameBuffer *buffer, int buf, unsigned int *pz, int _a, int x, int y, unsigned int &z, int &dzdx) {
 	if ((!kEnableScissor || !buffer->scissorPixel(x + _a, y)) && buffer->compareDepth(z, pz[_a])) {
 		if (kDepthWrite) {
 			pz[_a] = z;
@@ -69,7 +69,8 @@ FORCEINLINE static void putPixelDepth(FrameBuffer *buffer, int buf, unsigned int
 }
 
 template <bool kDepthWrite, bool kAlphaTestEnabled, bool kEnableScissor, bool kBlendingEnabled>
-FORCEINLINE static void putPixelShadow(FrameBuffer *buffer, int buf, unsigned int *pz, int _a, int x, int y, unsigned int &z, unsigned int &r, unsigned int &g, unsigned int &b, int &dzdx, unsigned char *pm) {
+FORCEINLINE void FrameBuffer::putPixelShadow(FrameBuffer *buffer, int buf, unsigned int *pz, int _a, int x, int y, unsigned int &z,
+								             unsigned int &r, unsigned int &g, unsigned int &b, int &dzdx, unsigned char *pm) {
 	if ((!kEnableScissor || !buffer->scissorPixel(x + _a, y)) && buffer->compareDepth(z, pz[_a]) && pm[_a]) {
 		buffer->writePixel<kAlphaTestEnabled, kBlendingEnabled, kDepthWrite>(buf + _a, 255, r >> (ZB_POINT_RED_BITS - 8), g >> (ZB_POINT_GREEN_BITS - 8), b >> (ZB_POINT_BLUE_BITS - 8), z);
 	}
@@ -77,10 +78,11 @@ FORCEINLINE static void putPixelShadow(FrameBuffer *buffer, int buf, unsigned in
 }
 
 template <bool kDepthWrite, bool kLightsMode, bool kSmoothMode, bool kEnableAlphaTest, bool kEnableScissor, bool kEnableBlending>
-FORCEINLINE static void putPixelTextureMappingPerspective(FrameBuffer *buffer, int buf,
-						const Graphics::TexelBuffer *texture, unsigned int wrap_s, unsigned int wrap_t, unsigned int *pz, int _a,
-						int x, int y, unsigned int &z, int &t, int &s, unsigned int &r, unsigned int &g, unsigned int &b, unsigned int &a,
-						int &dzdx, int &dsdx, int &dtdx, int &drdx, int &dgdx, int &dbdx, unsigned int dadx) {
+FORCEINLINE void FrameBuffer::putPixelTextureMappingPerspective(FrameBuffer *buffer, int buf, const Graphics::TexelBuffer *texture,
+	                                                            unsigned int wrap_s, unsigned int wrap_t, unsigned int *pz, int _a,
+	                                                            int x, int y, unsigned int &z, int &t, int &s,
+																unsigned int &r, unsigned int &g, unsigned int &b, unsigned int &a,
+	                                                            int &dzdx, int &dsdx, int &dtdx, int &drdx, int &dgdx, int &dbdx, unsigned int dadx) {
 	if ((!kEnableScissor || !buffer->scissorPixel(x + _a, y)) && buffer->compareDepth(z, pz[_a])) {
 		uint8 c_a, c_r, c_g, c_b;
 		texture->getARGBAt(wrap_s, wrap_t, s, t, c_a, c_r, c_g, c_b);




More information about the Scummvm-git-logs mailing list