Commits

Alex Szpakowski committed 1ddca65

Removed now-unnecessary optional filter parameters from love.graphics.newImageFont

  • Participants
  • Parent commits f655bcf

Comments (0)

Files changed (5)

src/modules/graphics/opengl/Font.cpp

 	, mSpacing(1)
 	, filter(filter)
 {
+	this->filter.mipmap = Image::FILTER_NONE;
+
 	// Try to find the best texture size match for the font size. default to the
 	// largest texture size if no rough match is found.
 	textureSizeIndex = NUM_TEXTURE_SIZES - 1;

src/modules/graphics/opengl/Graphics.cpp

 	currentWindow->setWindowTitle(title);
 }
 
-int Graphics::getCaption(lua_State *L) const
+std::string Graphics::getCaption() const
 {
-	std::string title = currentWindow->getWindowTitle();
-	lua_pushstring(L, title.c_str());
-	return 1;
+	return currentWindow->getWindowTitle();
 }
 
 int Graphics::getWidth() const

src/modules/graphics/opengl/Graphics.h

 	// Color mask.
 	bool colorMask[4];
 
-	// Window info.
-	std::string caption;
-	bool mouseVisible;
-
 	// Default values.
 	DisplayState()
 	{
 		alphaTest = false;
 		scissor = false;
 		colorMask[0] = colorMask[1] = colorMask[2] = colorMask[3] = true;
-		caption = "";
-		mouseVisible = true;
 	}
 
 };
 	 **/
 	void setCaption(const char *caption);
 
-	int getCaption(lua_State *L) const;
+	/**
+	 * Gets the window's caption.
+	 **/
+	std::string getCaption() const;
 
 	/**
 	 * Gets the width of the current display mode.

src/modules/graphics/opengl/wrap_Graphics.cpp

 
 int w_getCaption(lua_State *L)
 {
-	return instance->getCaption(L);
+	std::string caption = instance->getCaption();
+	lua_pushstring(L, caption.c_str());
+	return 1;
 }
 
 int w_getWidth(lua_State *L)
 
 int w_newImageFont(lua_State *L)
 {
-	// filter for glyphs, defaults to linear/linear
-	Image::Filter img_filter;
-	bool setFilter = false;
-
-	// For the filter modes..
-	int startIndex = 2;
+	// filter for glyphs
+	Image::Filter filter = instance->getDefaultFilter();
 
 	// Convert to ImageData if necessary.
 	if (lua_isstring(L, 1) || luax_istype(L, 1, FILESYSTEM_FILE_T) || luax_istype(L, 1, FILESYSTEM_FILE_DATA_T))
 	else if (luax_istype(L, 1, GRAPHICS_IMAGE_T))
 	{
 		Image *i = luax_checktype<Image>(L, 1, "Image", GRAPHICS_IMAGE_T);
-		img_filter = i->getFilter();
-		setFilter = true;
+		filter = i->getFilter();
 		love::image::ImageData *id = i->getData();
 		if (!id)
-			return luaL_argerror(L, 1, "image cannot be compressed");
+			return luaL_argerror(L, 1, "Image cannot be compressed.");
 		luax_newtype(L, "ImageData", IMAGE_IMAGE_DATA_T, (void *)id, false);
 		lua_replace(L, 1);
 	}
 	{
 		int idxs[] = {1, 2};
 		luax_convobj(L, idxs, 2, "font", "newRasterizer");
-		startIndex = 3; // There's a glyphs args in there, move up
 	}
 
 	love::font::Rasterizer *rasterizer = luax_checktype<love::font::Rasterizer>(L, 1, "Rasterizer", FONT_RASTERIZER_T);
 
-	if (lua_isstring(L, startIndex) && lua_isstring(L, startIndex+1))
-	{
-		Image::FilterMode min;
-		Image::FilterMode mag;
-		const char *minstr = luaL_checkstring(L, startIndex);
-		const char *magstr = luaL_checkstring(L, startIndex+1);
-		if (!Image::getConstant(minstr, min))
-			return luaL_error(L, "Invalid filter mode: %s", minstr);
-		if (!Image::getConstant(magstr, mag))
-			return luaL_error(L, "Invalid filter mode: %s", magstr);
-
-		img_filter.min = min;
-		img_filter.mag = mag;
-		setFilter = true;
-	}
-
-	if (!setFilter)
-		img_filter = instance->getDefaultFilter();
-
 	// Create the font.
-	Font *font = instance->newFont(rasterizer, img_filter);
+	Font *font = instance->newFont(rasterizer, filter);
 
 	if (font == 0)
 		return luaL_error(L, "Could not load font.");

src/modules/graphics/opengl/wrap_Shader.cpp

 		delete[] values;
 		return luaL_error(L, "%s", e.what());
 	}
-	
+
 	delete[] values;
-	
+
 	return 0;
 }