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) ...@@ -56,40 +56,58 @@ void NX_NormalUpdate (_THIS, int numrects, SDL_Rect * rects)
else else
dest = fbinfo.winpixels + ((y * fbinfo.pitch) + (x * fbinfo.bytespp)); dest = fbinfo.winpixels + ((y * fbinfo.pitch) + (x * fbinfo.bytespp));
destinc = fbinfo.pitch; destinc = fbinfo.pitch;
} else { }
else
#endif #endif
{
dest = Image_buff ; dest = Image_buff ;
destinc = w * xinc ; destinc = w * xinc ;
#ifdef ENABLE_NANOX_DIRECT_FB
} }
#endif
rowinc = w * xinc; rowinc = w * xinc;
// apply GammaRamp table // apply GammaRamp table
if ((pixel_type == MWPF_TRUECOLOR0888 || pixel_type == MWPF_TRUECOLOR888) if ((pixel_type == MWPF_TRUECOLOR0888 || pixel_type == MWPF_TRUECOLOR888)
&& GammaRamp_R && GammaRamp_G && GammaRamp_B) { && GammaRamp_R && GammaRamp_G && GammaRamp_B) {
Uint8 * ptr ; Uint8 * ptrsrc ;
Uint8 * ptrdst ;
int k ; int k ;
for (j = h; j > 0; -- j, src += yinc) { for (j = h; j > 0; -- j, src += yinc, dest += destinc) {
ptr = src - 1 ; ptrsrc = src ;
ptrdst = dest ;
for (k = w; k > 0; -- k) { for (k = w; k > 0; -- k) {
if (pixel_type == MWPF_TRUECOLOR0888) *ptrdst++ = GammaRamp_B [*ptrsrc++] >> 8;
ptr += 2 ; *ptrdst++ = GammaRamp_G [*ptrsrc++] >> 8;
else *ptrdst++ = GammaRamp_R [*ptrsrc++] >> 8;
++ ptr ; *ptrdst++ = 0;
(* ptr) = GammaRamp_B [(* ptr)] ; ++ptrsrc;
++ ptr ;
(* ptr) = GammaRamp_G [(* ptr)] ;
++ ptr ;
(* ptr) = GammaRamp_R [(* ptr)] ;
} }
} }
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) for (j = h; j > 0; -- j, src += yinc, dest += destinc)
memcpy (dest, src, rowinc) ; memcpy (dest, src, rowinc) ;
}
if (!Clientfb) { if (!Clientfb) {
if (currently_fullscreen) { if (currently_fullscreen) {
GrArea (FSwindow, SDL_GC, x + OffsetX, y + OffsetY, w, h, Image_buff, GrArea (FSwindow, SDL_GC, x + OffsetX, y + OffsetY, w, h, Image_buff,
...@@ -198,8 +216,10 @@ void NX_RefreshDisplay (_THIS) ...@@ -198,8 +216,10 @@ void NX_RefreshDisplay (_THIS)
for (j = this -> screen -> h; j > 0; -- j, src += yinc, dest += fbinfo.pitch) for (j = this -> screen -> h; j > 0; -- j, src += yinc, dest += fbinfo.pitch)
memcpy (dest, src, rowinc) ; memcpy (dest, src, rowinc) ;
} else { }
else
#endif #endif
{
if (currently_fullscreen) { if (currently_fullscreen) {
GrArea (FSwindow, SDL_GC, OffsetX, OffsetY, this -> screen -> w, GrArea (FSwindow, SDL_GC, OffsetX, OffsetY, this -> screen -> w,
this -> screen -> h, SDL_Image, pixel_type) ; this -> screen -> h, SDL_Image, pixel_type) ;
...@@ -207,9 +227,7 @@ void NX_RefreshDisplay (_THIS) ...@@ -207,9 +227,7 @@ void NX_RefreshDisplay (_THIS)
GrArea (SDL_Window, SDL_GC, 0, 0, this -> screen -> w, GrArea (SDL_Window, SDL_GC, 0, 0, this -> screen -> w,
this -> screen -> h, SDL_Image, pixel_type) ; this -> screen -> h, SDL_Image, pixel_type) ;
} }
#ifdef ENABLE_NANOX_DIRECT_FB
} }
#endif
GrFlush(); GrFlush();
Dprintf ("leave NX_RefreshDisplay\n") ; Dprintf ("leave NX_RefreshDisplay\n") ;
......
...@@ -506,6 +506,7 @@ static int NX_SetGammaRamp (_THIS, Uint16 * ramp) ...@@ -506,6 +506,7 @@ static int NX_SetGammaRamp (_THIS, Uint16 * ramp)
GammaRamp_G [i] = green [i] ; GammaRamp_G [i] = green [i] ;
GammaRamp_B [i] = blue [i] ; GammaRamp_B [i] = blue [i] ;
} }
SDL_UpdateRect(this->screen, 0, 0, 0, 0);
Dprintf ("leave NX_SetGammaRamp\n") ; Dprintf ("leave NX_SetGammaRamp\n") ;
return 0 ; 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