Hi,
I port SDL library onto my device,
but the screen can only show fragmented part.--------------------
| |
| |
| |
| NO DISPLAY |
| |
| |
DISPLAY |
| |
| NO DISPLAY |
Here is my environment
OMAP 3621 (ARMv7) with a display panel (resolution: 800x600 16bits)
and I modify the sample code:
#include <stdlib.h>
#include <stdio.h>
#include “SDL.h”
void ShowBMP(char *file, SDL_Surface *screen, int x, int y)
{
SDL_Surface *image;
SDL_Rect dest;
/* Load the BMP file into a surface */
image = SDL_LoadBMP(file);
if ( image == NULL ) {
fprintf(stderr, "Couldn't load %s: %s\n", file, SDL_GetError());
return;
}
/* Blit onto the screen surface.
The surfaces should not be locked at this point.
*/
dest.x = x;
dest.y = y;
dest.w = image->w;
dest.h = image->h;
SDL_BlitSurface(image, NULL, screen, &dest);
/* Update the changed portion of the screen */
SDL_UpdateRects(screen, 1, &dest);
}
int main(int argc, char *argv[])
{
SDL_Surface *screen;
printf("\n======>0\n");
if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError());
//exit(1);
}
printf("\n======>1\n");
screen = SDL_SetVideoMode(600, 800, 16, SDL_FULLSCREEN);
if ( screen == NULL ) {
fprintf(stderr, "Unable to set video: %s\n", SDL_GetError());
//exit(1);
}
printf("\n======>2\n");
ShowBMP("test2.bmp", screen, 0, 0);
printf("\n======>3\n");
atexit(SDL_Quit);
}
the picture test2.bmp is a 600x800 bmp file
does anyone know what is the possible problem?
THANKS
–
Yu-Sheng, Wang