Browse Source

alpha values for ImageData:mapPixel default to 255 (issue #603)

Alex Szpakowski 12 years ago
parent
commit
e9ff803c42
2 changed files with 3 additions and 3 deletions
  1. 1 1
      src/modules/image/CompressedData.cpp
  2. 2 2
      src/modules/image/wrap_ImageData.cpp

+ 1 - 1
src/modules/image/CompressedData.cpp

@@ -49,7 +49,7 @@ void *CompressedData::getData() const
 {
 	// Data for different mipmap levels is not stored contiguously in memory, so
 	// getData() won't work properly for CompressedData.
-	if (dataImages.size() > 0)
+	if (dataImages.size() > 0 && dataImages[0].size > 0)
 		return (void *) &(dataImages[0].data[0]);
 	else
 		return 0;

+ 2 - 2
src/modules/image/wrap_ImageData.cpp

@@ -85,7 +85,7 @@ int w_ImageData_setPixel(lua_State *L)
 	c.r = luaL_checkint(L, 4);
 	c.g = luaL_checkint(L, 5);
 	c.b = luaL_checkint(L, 6);
-	c.a = luaL_optint(L,7,255);
+	c.a = luaL_optint(L, 7, 255);
 	try
 	{
 		t->setPixel(x, y, c);
@@ -123,7 +123,7 @@ int w_ImageData_mapPixel(lua_State *L)
 			c.r = luaL_optint(L, -4, 0);
 			c.g = luaL_optint(L, -3, 0);
 			c.b = luaL_optint(L, -2, 0);
-			c.a = luaL_optint(L, -1, 0);
+			c.a = luaL_optint(L, -1, 255);
 			t->setPixel(i, j, c);
 			lua_pop(L, 4);
 		}