Fix XDisplay_DrawLCDWindow (). I put useless calculations out of the loop.
Fix WWDisplay_DrawScreen (). I put useless calculations out of the loop. After examining the hotspot, the drawing part of X (XDisplay_DrawLCDWindow () in XDisplay.c Loop part) became a hot spot, so arrange the array for each pixel I made it and raised drawing speed. Version 0.0.5 alpha - from wonx-a05.tar.gz
This commit is contained in:
15
HISTORY
15
HISTORY
@@ -1,3 +1,18 @@
|
||||
2000/10/3(<28><>)
|
||||
|
||||
wonx-a05 <20><><EFBFBD><EFBFBD>
|
||||
|
||||
XDisplay_DrawLCDWindow() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵<EFBFBD>̤ʷ<CAB7><D7BB><EFBFBD><EFBFBD>롼<EFBFBD>׳<EFBFBD><D7B3>˽Ф<CBBD><D0A4><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
WWDisplay_DrawScreen() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵<EFBFBD>̤ʷ<CAB7><D7BB><EFBFBD><EFBFBD>롼<EFBFBD>׳<EFBFBD><D7B3>˽Ф<CBBD><D0A4><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
<EFBFBD>ۥåȥ<EFBFBD><EFBFBD>ݥåȤ<EFBFBD>Ĵ<EFBFBD>٤<EFBFBD><EFBFBD>顤X<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʬ(XDisplay.c <20><> XDisplay_DrawLCDWindow()<29><>
|
||||
<EFBFBD>롼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʬ)<29><><EFBFBD>ۥåȥ<C3A5><C8A5>ݥåȤˤʤäƤ<C3A4><C6A4><EFBFBD><EFBFBD>Τǡ<CEA4><C7A1>ԥ<EFBFBD><D4A5><EFBFBD><EFBFBD>뤴<EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
<EFBFBD><EFBFBD><EFBFBD>äơ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>®<EFBFBD>٤<EFBFBD><EFBFBD>夲<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
|
||||
|
||||
2000/9/30(<28><>)
|
||||
|
||||
wonx-a04 <20><><EFBFBD><EFBFBD>
|
||||
|
||||
4
Makefile
4
Makefile
@@ -2,8 +2,8 @@ XINCLUDEDIR = /usr/X11R6/include
|
||||
INCLUDEDIR = .
|
||||
XLIBDIR = /usr/X11R6/lib
|
||||
|
||||
VERSION = Wonx-a04
|
||||
PKGNAME = wonx-a04
|
||||
VERSION = Wonx-a05
|
||||
PKGNAME = wonx-a05
|
||||
|
||||
OBJS = WWCharacter.o WWColorMap.o WWDisplay.o WWLCDPanel.o WWPalette.o WWScreen.o WWSprite.o WonxDisplay.o XDisplay.o bank.o comm.o disp.o text.o key.o sound.o system.o timer.o etc.o wonx.o
|
||||
|
||||
|
||||
18
WWDisplay.c
18
WWDisplay.c
@@ -243,15 +243,17 @@ static int WWDisplay_DrawScreen(WWDisplay display, WWScreen screen)
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD>ۤ<EFBFBD><DBA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
|
||||
for (y = 0; y < lcd_panel_height; y++) {
|
||||
|
||||
if (mode == WWSCREEN_INSIDE_ONLY) {
|
||||
if (y > ey) { break; }
|
||||
if (y < sy) { y = sy - 1; continue; }
|
||||
}
|
||||
|
||||
py = y + WWScreen_GetRollY(screen);
|
||||
|
||||
for (x = 0; x < lcd_panel_width; x++) {
|
||||
px = x + WWScreen_GetRollX(screen);
|
||||
py = y + WWScreen_GetRollY(screen);
|
||||
|
||||
if (mode == WWSCREEN_INSIDE_ONLY) {
|
||||
if (y > ey) {
|
||||
x = lcd_panel_width - 1; y = lcd_panel_height - 1; continue;
|
||||
}
|
||||
if (y < sy) { x = lcd_panel_width - 1; y = sy - 1; continue; }
|
||||
if (x > ex) { x = lcd_panel_width - 1; continue; }
|
||||
if (x < sx) { x = sx - 1; continue; }
|
||||
} else if (mode == WWSCREEN_OUTSIDE_ONLY) {
|
||||
@@ -261,6 +263,8 @@ static int WWDisplay_DrawScreen(WWDisplay display, WWScreen screen)
|
||||
}
|
||||
}
|
||||
|
||||
px = x + WWScreen_GetRollX(screen);
|
||||
|
||||
pixel = WWScreen_GetPixel(screen, px, py);
|
||||
|
||||
/* Ʃ<><C6A9><EFBFBD><EFBFBD><EFBFBD>ξ<EFBFBD><CEBE><EFBFBD> */
|
||||
@@ -335,7 +339,7 @@ int WWDisplay_DrawLCDPanel(WWDisplay display)
|
||||
WWSprite sprite;
|
||||
|
||||
lcd_panel = WWDisplay_GetLCDPanel(display);
|
||||
lcd_panel_width = WWLCDPanel_GetWidth(lcd_panel);
|
||||
lcd_panel_width = WWLCDPanel_GetWidth( lcd_panel);
|
||||
lcd_panel_height = WWLCDPanel_GetHeight(lcd_panel);
|
||||
color_map = WWDisplay_GetColorMap(display);
|
||||
border = WWDisplay_GetBorder(display);
|
||||
|
||||
72
XDisplay.c
72
XDisplay.c
@@ -358,16 +358,23 @@ int XDisplay_Sync(XDisplay x_display)
|
||||
|
||||
int XDisplay_DrawLCDWindow(XDisplay x_display, WWLCDPanel ww_lcd_panel)
|
||||
{
|
||||
int x, y, n;
|
||||
int px, py;
|
||||
int x, y;
|
||||
int px, py, ph;
|
||||
int num;
|
||||
XRectangle * rectangles;
|
||||
int n[16];
|
||||
XRectangle * rectangles[16];
|
||||
int pixel;
|
||||
int ww_lcd_width, ww_lcd_height;
|
||||
|
||||
/* <20><><EFBFBD>ܤ<EFBFBD><DCA4>Ƥ<EFBFBD><C6A4><EFBFBD><EFBFBD>ԥ<EFBFBD><D4A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϤޤȤ<DEA4><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>褹<EFBFBD><E8A4B9><EFBFBD>Τǡ<CEA4><C7A1>ԥ<EFBFBD><D4A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><CEBA><EFBFBD><EFBFBD>ͤ<EFBFBD> */
|
||||
/* <20>ǰ<EFBFBD><C7B0>ξ<EFBFBD><CEBE><EFBFBD>(<28>ʡ<EFBFBD><CAA1><EFBFBD><EFBFBD>ͤΤȤ<CEA4>)<29>ǡ<EFBFBD>width * height / 2 <20>ˤʤ롥 */
|
||||
num =
|
||||
WWLCDPanel_GetHeight(ww_lcd_panel) * WWLCDPanel_GetWidth(ww_lcd_panel);
|
||||
rectangles = (XRectangle *)malloc(sizeof(XRectangle) * num);
|
||||
WWLCDPanel_GetHeight(ww_lcd_panel) * WWLCDPanel_GetWidth(ww_lcd_panel) / 2;
|
||||
|
||||
for (pixel = 0; pixel < 16; pixel++) {
|
||||
n[pixel] = 0;
|
||||
rectangles[pixel] = (XRectangle *)malloc(sizeof(XRectangle) * num);
|
||||
}
|
||||
if (rectangles == NULL)
|
||||
Error("XDisplay_DrawLCDWindow", "Cannot allocate memory.");
|
||||
|
||||
@@ -376,37 +383,38 @@ int XDisplay_DrawLCDWindow(XDisplay x_display, WWLCDPanel ww_lcd_panel)
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD>ν<EFBFBD><CEBD><EFBFBD><EFBFBD>ϥۥåȥ<C3A5><C8A5>ݥåȤˤʤ<CBA4><CAA4>Τǡ<CEA4><C7A1>Τ<EFBFBD><CEA4>Τ<EFBFBD><CEA4>˥<EFBFBD><CBA5>塼<EFBFBD>˥<CBA5><F3A5B0A4>뤳<EFBFBD><EBA4B3> */
|
||||
|
||||
for (pixel = 0; pixel < 16; pixel++) {
|
||||
n = 0;
|
||||
for (y = 0; y < ww_lcd_height; y++) {
|
||||
for (x = 0; x < ww_lcd_width; x++) {
|
||||
if (pixel == WWLCDPanel_GetPixel(ww_lcd_panel, x, y)) {
|
||||
px = (x * x_display->width ) / ww_lcd_width;
|
||||
py = (y * x_display->height) / ww_lcd_height;
|
||||
rectangles[n].x = px;
|
||||
rectangles[n].y = py;
|
||||
rectangles[n].width = (x+1) * x_display->width / ww_lcd_width - px;
|
||||
rectangles[n].height = (y+1) * x_display->height / ww_lcd_height- py;
|
||||
for (y = 0; y < ww_lcd_height; y++) {
|
||||
py = (y * x_display->height) / ww_lcd_height;
|
||||
ph = (y+1) * x_display->height / ww_lcd_height- py;
|
||||
for (x = 0; x < ww_lcd_width; x++) {
|
||||
pixel = WWLCDPanel_GetPixel(ww_lcd_panel, x, y);
|
||||
px = (x * x_display->width ) / ww_lcd_width;
|
||||
rectangles[pixel][n[pixel]].x = px;
|
||||
rectangles[pixel][n[pixel]].y = py;
|
||||
rectangles[pixel][n[pixel]].width =
|
||||
(x+1) * x_display->width / ww_lcd_width - px;
|
||||
rectangles[pixel][n[pixel]].height = ph;
|
||||
|
||||
/* <20><><EFBFBD>ܤ<EFBFBD><DCA4>Ƥ<EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD>Υԥ<CEA5><D4A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϡ<EFBFBD><CFA1><EFBFBD><EFBFBD>Ϥ<EFBFBD><CFA4>ä<EFBFBD><C3A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>褹<EFBFBD><E8A4B9> */
|
||||
x++;
|
||||
while ( (x < ww_lcd_width) &&
|
||||
(pixel == WWLCDPanel_GetPixel(ww_lcd_panel, x, y)) ) {
|
||||
rectangles[n].width = (x+1) * x_display->width / ww_lcd_width - px;
|
||||
x++;
|
||||
}
|
||||
x--;
|
||||
|
||||
n++;
|
||||
}
|
||||
/* <20><><EFBFBD>ܤ<EFBFBD><DCA4>Ƥ<EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD>Υԥ<CEA5><D4A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϡ<EFBFBD><CFA1><EFBFBD><EFBFBD>Ϥ<EFBFBD><CFA4>ä<EFBFBD><C3A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>褹<EFBFBD><E8A4B9> */
|
||||
x++;
|
||||
while ( (x < ww_lcd_width) &&
|
||||
(pixel == WWLCDPanel_GetPixel(ww_lcd_panel, x, y)) ) {
|
||||
rectangles[pixel][n[pixel]].width =
|
||||
(x+1) * x_display->width / ww_lcd_width - px;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
x--;
|
||||
|
||||
if (n > 0) {
|
||||
n[pixel]++;
|
||||
}
|
||||
}
|
||||
|
||||
for (pixel = 0; pixel < 16; pixel++) {
|
||||
if (n[pixel] > 0) {
|
||||
XFillRectangles(x_display->display,
|
||||
x_display->lcd_pixmap,
|
||||
x_display->color_gc[pixel],
|
||||
rectangles, n);
|
||||
rectangles[pixel], n[pixel]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,7 +424,9 @@ int XDisplay_DrawLCDWindow(XDisplay x_display, WWLCDPanel ww_lcd_panel)
|
||||
|
||||
XDisplay_Sync(x_display);
|
||||
|
||||
free(rectangles);
|
||||
for (pixel = 0; pixel < 16; pixel++) {
|
||||
free(rectangles[pixel]);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user