Fixed some bugs in the Nano-X video driver
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40700
This commit is contained in:
parent
72cad5a32c
commit
33c3ee82b0
2 changed files with 66 additions and 47 deletions
|
@ -49,55 +49,73 @@ void NX_NormalUpdate (_THIS, int numrects, SDL_Rect * rects)
|
||||||
w = rects [i].w, h = rects [i].h ;
|
w = rects [i].w, h = rects [i].h ;
|
||||||
src = SDL_Image + y * yinc + x * xinc ;
|
src = SDL_Image + y * yinc + x * xinc ;
|
||||||
#ifdef ENABLE_NANOX_DIRECT_FB
|
#ifdef ENABLE_NANOX_DIRECT_FB
|
||||||
if (Clientfb) {
|
if (Clientfb) {
|
||||||
if (currently_fullscreen)
|
if (currently_fullscreen)
|
||||||
dest = fbinfo.winpixels + (((y+OffsetY) * fbinfo.pitch) +
|
dest = fbinfo.winpixels + (((y+OffsetY) * fbinfo.pitch) +
|
||||||
((x+OffsetX) * fbinfo.bytespp));
|
((x+OffsetX) * fbinfo.bytespp));
|
||||||
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
|
}
|
||||||
}
|
rowinc = w * xinc;
|
||||||
#endif
|
|
||||||
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)
|
for (j = h; j > 0; -- j, src += yinc, dest += destinc) {
|
||||||
memcpy (dest, src, rowinc) ;
|
ptrsrc = src ;
|
||||||
if (!Clientfb) {
|
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) {
|
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,
|
||||||
pixel_type) ;
|
pixel_type) ;
|
||||||
} else {
|
} else {
|
||||||
GrArea (SDL_Window, SDL_GC, x, y, w, h, Image_buff, pixel_type) ;
|
GrArea (SDL_Window, SDL_GC, x, y, w, h, Image_buff, pixel_type) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GrFlush();
|
GrFlush();
|
||||||
|
|
||||||
|
@ -183,33 +201,33 @@ void NX_RefreshDisplay (_THIS)
|
||||||
char *src, *dest = NULL;
|
char *src, *dest = NULL;
|
||||||
int xinc, yinc, rowinc;
|
int xinc, yinc, rowinc;
|
||||||
|
|
||||||
GrGetWindowFBInfo(SDL_Window, &fbinfo);
|
GrGetWindowFBInfo(SDL_Window, &fbinfo);
|
||||||
|
|
||||||
xinc = this -> screen -> format -> BytesPerPixel ;
|
xinc = this -> screen -> format -> BytesPerPixel ;
|
||||||
yinc = this -> screen -> pitch ;
|
yinc = this -> screen -> pitch ;
|
||||||
|
|
||||||
src = SDL_Image;
|
src = SDL_Image;
|
||||||
if (currently_fullscreen)
|
if (currently_fullscreen)
|
||||||
dest = fbinfo.winpixels + ((OffsetY * fbinfo.pitch) +
|
dest = fbinfo.winpixels + ((OffsetY * fbinfo.pitch) +
|
||||||
(OffsetX * fbinfo.bytespp));
|
(OffsetX * fbinfo.bytespp));
|
||||||
else
|
else
|
||||||
dest = fbinfo.winpixels;
|
dest = fbinfo.winpixels;
|
||||||
rowinc = xinc * this -> screen -> w;
|
rowinc = xinc * this -> screen -> w;
|
||||||
|
|
||||||
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) ;
|
||||||
} else {
|
} else {
|
||||||
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)
|
||||||
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 ;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue