Jelajahi Sumber

Remove texel offset from render interface

Michael Ragazzon 6 tahun lalu
induk
melakukan
eba48a4494

+ 0 - 1
Include/RmlUi/Core/Geometry.h

@@ -91,7 +91,6 @@ private:
 
 	CompiledGeometryHandle compiled_geometry;
 	bool compile_attempted;
-	bool fixed_texcoords;
 };
 
 typedef std::vector< Geometry > GeometryList;

+ 0 - 7
Include/RmlUi/Core/RenderInterface.h

@@ -107,13 +107,6 @@ public:
 	/// @param texture The texture handle to release.
 	virtual void ReleaseTexture(TextureHandle texture);
 
-	/// Returns the native horizontal texel offset for the renderer.
-	/// @return The renderer's horizontal texel offset. The default implementation returns 0.
-	virtual float GetHorizontalTexelOffset();
-	/// Returns the native vertical texel offset for the renderer.
-	/// @return The renderer's vertical texel offset. The default implementation returns 0.
-	virtual float GetVerticalTexelOffset();
-
 	/// Called by RmlUi when it wants to set the current transform matrix to a new matrix.
 	/// @param[in] transform The new transform to apply.
 	virtual void PushTransform(const Matrix4f& transform);

+ 0 - 26
Source/Core/Geometry.cpp

@@ -33,9 +33,6 @@
 namespace Rml {
 namespace Core {
 
-static bool read_texel_offset = false;
-static Vector2f texel_offset;
-
 Geometry::Geometry(Element* _host_element)
 {
 	host_element = _host_element;
@@ -43,7 +40,6 @@ Geometry::Geometry(Element* _host_element)
 
 	texture = nullptr;
 
-	fixed_texcoords = false;
 	compile_attempted = false;
 	compiled_geometry = 0;
 }
@@ -55,7 +51,6 @@ Geometry::Geometry(Context* _host_context)
 
 	texture = nullptr;
 
-	fixed_texcoords = false;
 	compile_attempted = false;
 	compiled_geometry = 0;
 }
@@ -103,26 +98,6 @@ void Geometry::Render(const Vector2f& translation)
 
 		if (!compile_attempted)
 		{
-			if (!fixed_texcoords)
-			{
-				fixed_texcoords = true;
-
-				if (!read_texel_offset)
-				{
-					read_texel_offset = true;
-					texel_offset.x = render_interface->GetHorizontalTexelOffset();
-					texel_offset.y = render_interface->GetVerticalTexelOffset();
-				}
-
-				// Add a half-texel offset if required.
-				if (texel_offset.x != 0 ||
-					texel_offset.y != 0)
-				{
-					for (size_t i = 0; i < vertices.size(); ++i)
-						vertices[i].position += texel_offset;
-				}
-			}
-
 			compile_attempted = true;
 			compiled_geometry = render_interface->CompileGeometry(&vertices[0], (int) vertices.size(), &indices[0], (int) indices.size(), texture != nullptr ? texture->GetHandle(GetRenderInterface()) : 0);
 
@@ -180,7 +155,6 @@ void Geometry::Release(bool clear_buffers)
 	{
 		vertices.clear();
 		indices.clear();
-		fixed_texcoords = false;
 	}
 }
 

+ 0 - 12
Source/Core/RenderInterface.cpp

@@ -94,18 +94,6 @@ void RenderInterface::ReleaseTexture(TextureHandle RMLUI_UNUSED_PARAMETER(textur
 	RMLUI_UNUSED(texture);
 }
 
-// Returns the native horizontal texel offset for the renderer.
-float RenderInterface::GetHorizontalTexelOffset()
-{
-	return 0;
-}
-
-// Returns the native vertical texel offset for the renderer.
-float RenderInterface::GetVerticalTexelOffset()
-{
-	return 0;
-}
-
 // Called by RmlUi when it wants to change the current transform matrix to a new matrix.
 void RenderInterface::PushTransform(const Matrix4f& transform)
 {