From: eihrul Date: Tue, 1 Feb 2011 14:14:04 +0000 (+0000) Subject: implemented Texture_UpdatePartial X-Git-Tag: xonotic-v0.5.0~438^2~51 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=811bbb08471d7df01fb6bab1055be69a5827d227;p=xonotic%2Fdarkplaces.git implemented Texture_UpdatePartial git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10790 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/dpsoftrast.c b/dpsoftrast.c index a6ef6f07..52376179 100644 --- a/dpsoftrast.c +++ b/dpsoftrast.c @@ -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) {