]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
implemented Texture_UpdatePartial
authoreihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 1 Feb 2011 14:14:04 +0000 (14:14 +0000)
committereihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 1 Feb 2011 14:14:04 +0000 (14:14 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10790 d7cf8633-e32d-0410-b094-e92efae38249

dpsoftrast.c

index a6ef6f07aa8d40519fbd853abea4cc6f1ff45c19..52376179de44c69ea08cc84181325b6cb1f90f44 100644 (file)
@@ -546,11 +546,18 @@ void DPSOFTRAST_Texture_CalculateMipmaps(int index)
 void DPSOFTRAST_Texture_UpdatePartial(int index, int mip, const unsigned char *pixels, int blockx, int blocky, int blockwidth, int blockheight)
 {
        DPSOFTRAST_Texture *texture;
+       unsigned char *dst;
        texture = DPSOFTRAST_Texture_GetByIndex(index);if (!texture) return;
-
-       // FIXME IMPLEMENT
-
-       dpsoftrast.errorstring = "DPSOFTRAST_Texture_UpdatePartial: Not implemented.";
+    
+       dst = texture->bytes + (blocky * texture->mipmap[0][2] + blockx) * 4;
+       while (blockheight > 0)
+       {
+               memcpy(dst, pixels, blockwidth * 4);
+               pixels += blockwidth * 4;
+               dst += texture->mipmap[0][2] * 4;
+               blockheight--;
+       }
+       DPSOFTRAST_Texture_CalculateMipmaps(index);
 }
 void DPSOFTRAST_Texture_UpdateFull(int index, const unsigned char *pixels)
 {