From 811bbb08471d7df01fb6bab1055be69a5827d227 Mon Sep 17 00:00:00 2001 From: eihrul Date: Tue, 1 Feb 2011 14:14:04 +0000 Subject: [PATCH] implemented Texture_UpdatePartial git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10790 d7cf8633-e32d-0410-b094-e92efae38249 --- dpsoftrast.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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) { -- 2.39.2