Commit 33c3ee82 authored by Sam Lantinga's avatar Sam Lantinga

Fixed some bugs in the Nano-X video driver

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40700
parent 72cad5a3
......@@ -56,40 +56,58 @@ void NX_NormalUpdate (_THIS, int numrects, SDL_Rect * rects)
else
dest = fbinfo.winpixels + ((y * fbinfo.pitch) + (x * fbinfo.bytespp));
destinc = fbinfo.pitch;
} else {
}
else
#endif
{
dest = Image_buff ;
destinc = w * xinc ;
#ifdef ENABLE_NANOX_DIRECT_FB
}
#endif
rowinc = w * xinc;
// apply GammaRamp table
if ((pixel_type == MWPF_TRUECOLOR0888 || pixel_type == MWPF_TRUECOLOR888)
&& GammaRamp_R && GammaRamp_G && GammaRamp_B) {
Uint8 * ptr ;
Uint8 * ptrsrc ;
Uint8 * ptrdst ;
int k ;
for (j = h; j > 0; -- j, src += yinc) {
ptr = src - 1 ;
for (j = h; j > 0; -- j, src += yinc, dest += destinc) {
ptrsrc = src ;
ptrdst = dest ;
for (k = w; k > 0; -- k) {
if (pixel_type == MWPF_TRUECOLOR0888)
ptr += 2 ;
else
++ ptr ;
(* ptr) = GammaRamp_B [(* ptr)] ;
++ ptr ;
(* ptr) = GammaRamp_G [(* ptr)] ;
++ ptr ;
(* ptr) = GammaRamp_R [(* ptr)] ;
*ptrdst++ = GammaRamp_B [*ptrsrc++] >> 8;
*ptrdst++ = GammaRamp_G [*ptrsrc++] >> 8;
*ptrdst++ = GammaRamp_R [*ptrsrc++] >> 8;
*ptrdst++ = 0;
++ptrsrc;
}
}
src = SDL_Image + y * yinc + x * xinc ;
}
#if 0 /* This is needed for microwindows 0.90 or older */
else if (pixel_type == MWPF_TRUECOLOR0888 || pixel_type == MWPF_TRUECOLOR888) {
Uint8 * ptrsrc ;
Uint8 * ptrdst ;
int k ;
for (j = h; j > 0; -- j, src += yinc, dest += destinc) {
ptrsrc = src ;
ptrdst = dest ;
for (k = w; k > 0; -- k) {
*ptrdst++ = *ptrsrc++;
*ptrdst++ = *ptrsrc++;
*ptrdst++ = *ptrsrc++;
*ptrdst++ = 0;
++ptrsrc;
}
}
}
#endif
else
{
for (j = h; j > 0; -- j, src += yinc, dest += destinc)
memcpy (dest, src, rowinc) ;
}
if (!Clientfb) {
if (currently_fullscreen) {
GrArea (FSwindow, SDL_GC, x + OffsetX, y + OffsetY, w, h, Image_buff,
......@@ -198,8 +216,10 @@ void NX_RefreshDisplay (_THIS)
for (j = this -> screen -> h; j > 0; -- j, src += yinc, dest += fbinfo.pitch)
memcpy (dest, src, rowinc) ;
} else {
}
else
#endif
{
if (currently_fullscreen) {
GrArea (FSwindow, SDL_GC, OffsetX, OffsetY, this -> screen -> w,
this -> screen -> h, SDL_Image, pixel_type) ;
......@@ -207,9 +227,7 @@ void NX_RefreshDisplay (_THIS)
GrArea (SDL_Window, SDL_GC, 0, 0, this -> screen -> w,
this -> screen -> h, SDL_Image, pixel_type) ;
}
#ifdef ENABLE_NANOX_DIRECT_FB
}
#endif
GrFlush();
Dprintf ("leave NX_RefreshDisplay\n") ;
......
......@@ -506,6 +506,7 @@ static int NX_SetGammaRamp (_THIS, Uint16 * ramp)
GammaRamp_G [i] = green [i] ;
GammaRamp_B [i] = blue [i] ;
}
SDL_UpdateRect(this->screen, 0, 0, 0, 0);
Dprintf ("leave NX_SetGammaRamp\n") ;
return 0 ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment