Added optional xoffset/yoffset/width/height arguments to Image:refresh, to specify a sub-rectangle. Specifying a small sub-rectangle can improve the performance of Image:refresh.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2014-08-26 09:40:24 -03:00
parent 760304e023
commit 8a7481eaa3
3 changed files with 90 additions and 67 deletions
+11 -11
View File
@@ -133,7 +133,7 @@ public:
* Re-uploads the ImageData or CompressedData associated with this Image to
* the GPU.
**/
bool refresh();
bool refresh(int xoffset, int yoffset, int w, int h);
const Flags &getFlags() const;
@@ -153,10 +153,18 @@ public:
private:
void uploadDefaultTexture();
void drawv(const Matrix &t, const Vertex *v);
void preload();
void generateMipmaps();
void loadDefaultTexture();
void loadTextureFromCompressedData();
void loadTextureFromImageData();
void uploadImageData(int xoffset, int yoffset, int w, int h);
GLenum getCompressedFormat(image::CompressedData::Format cformat) const;
// The ImageData from which the texture is created. May be null if
// Compressed image data was used to create the texture.
Object::StrongRef<love::image::ImageData> data;
@@ -183,19 +191,11 @@ private:
size_t textureMemorySize;
void preload();
void uploadCompressedData();
void uploadImageData();
void uploadTexture();
static float maxMipmapSharpness;
static FilterMode defaultMipmapFilter;
static float defaultMipmapSharpness;
GLenum getCompressedFormat(image::CompressedData::Format cformat) const;
static StringMap<FlagType, FLAG_TYPE_MAX_ENUM>::Entry flagNameEntries[];
static StringMap<FlagType, FLAG_TYPE_MAX_ENUM> flagNames;