Fix selection menu painting

The new behavior matches System 3.9.

- Use sel.WinFrameColor to draw selection cursor in EncloseType=0
- Implement EncloseType=1 (thick selection cursor)
  - It always uses color 255, not WinFrameColor (System 3.9 bug?)
- EncloseType=2 uses MsgFontColor for background, WinBackgroundColor for
  text
This commit is contained in:
kichikuou
2020-10-04 09:14:19 +09:00
parent f1b4c2550b
commit b892189f8b
5 changed files with 11 additions and 40 deletions
-6
View File
@@ -847,12 +847,6 @@ agsurface_t *ags_getDIB() {
return nact->ags.dib;
}
void ags_fillRectangleNeg(int x, int y, int w, int h, int col) {
if (!check_param(&x, &y, &w, &h)) return;
image_fillRectangleNeg(nact->ags.dib, x, y, w, h, col);
}
void ags_autorepeat(boolean bool) {
sdl_setAutoRepeat(bool);
}
-1
View File
@@ -165,7 +165,6 @@ extern void ags_setPaletteToSystem(int src, int cnt);
/* 描画関係 */
extern void ags_drawRectangle(int x, int y, int w, int h, int col);
extern void ags_fillRectangle(int x, int y, int w, int h, int col);
extern void ags_fillRectangleNeg(int x, int y, int w, int h, int col);
extern void ags_drawLine(int x0, int y0, int x1, int y1, int col);
extern void ags_copyArea(int sx, int sy, int w, int h, int dx, int dy);
extern void ags_scaledCopyArea(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int mirror_sw);
-23
View File
@@ -887,10 +887,6 @@ void image_fillRectangle(agsurface_t *dib, int x, int y, int w, int h, int col)
fill_rectangle(dib, x, y, w, h, col);
}
void image_fillRectangleNeg(agsurface_t *dib, int x, int y, int w, int h, int col) {
fill_rectangle(dib, x, y, w, h, -1 ^ image_index2pixel(dib->depth, col));
}
void image_copy_from_alpha(agsurface_t *dib, int sx, int sy, int w, int h, int dx, int dy, ALPHA_DIB_COPY_TYPE flag) {
BYTE *sdata = GETOFFSET_ALPHA(dib, sx, sy);
BYTE *ddata = GETOFFSET_PIXEL(dib, dx, dy);
@@ -905,25 +901,6 @@ void image_copy_to_alpha(agsurface_t *dib, int sx, int sy, int w, int h, int dx,
copy_to_alpha(dib, sdata, ddata, w, h, flag);
}
int image_index2pixel(int depth, int i) {
Palette256 *pal = nact->sys_pal;
switch(depth) {
case 8:
return i;
case 15:
return PIX15(pal->red[i], pal->green[i], pal->blue[i]);
case 16:
return PIX16(pal->red[i], pal->green[i], pal->blue[i]);
case 24:
case 32:
return PIX24(pal->red[i], pal->green[i], pal->blue[i]);
default:
WARNING("Unknown depth\n");
return i;
}
}
/* モザイク */
void image_Mosaic(agsurface_t *dib, int sx, int sy, int w, int h, int dx, int dy, int slice) {
-2
View File
@@ -32,10 +32,8 @@ extern void image_fadeOut(agsurface_t *img, int lv, int col);
extern void image_fadeIn(agsurface_t *src, agsurface_t *dst, int lv);
extern void image_drawLine(agsurface_t *dib, int x0, int y0, int x1, int y1, int col);
extern void image_fillRectangle(agsurface_t *dib, int x, int y, int w, int h, int col);
extern void image_fillRectangleNeg(agsurface_t *dib, int x, int y, int w, int h, int col);
extern void image_copy_from_alpha(agsurface_t *dib, int sx, int sy, int w, int h, int dx, int dy, ALPHA_DIB_COPY_TYPE flag);
extern void image_copy_to_alpha(agsurface_t *dib, int sx, int sy, int w, int h, int dx, int dy, ALPHA_DIB_COPY_TYPE flag);
extern int image_index2pixel(int depth, int pal);
extern void image_Mosaic(agsurface_t *dib, int sx, int sy, int w, int h, int dx, int dy, int slice);
extern BYTE *changeImage16AlphaLevel(cgdata *cg);
+11 -8
View File
@@ -340,10 +340,11 @@ static int whereElement(void) {
return -1;
}
static void lineEncloseElement(MyRectangle *r, int col) {
ags_drawRectangle(r->x , r->y , r->width +2, r->height +2, col);
ags_drawRectangle(r->x +1, r->y+1, r->width , r->height , col);
ags_updateArea (r->x , r->y , r->width +2, r->height +2);
static void lineEncloseElement(MyRectangle *r, int col, boolean thick) {
ags_drawRectangle(r->x, r->y, r->width + 2, r->height + 2, col);
if (thick)
ags_drawRectangle(r->x + 1, r->y + 1, r->width, r->height, col);
ags_updateArea(r->x, r->y, r->width + 2, r->height + 2);
}
static void encloseElement(int sw, int no) {
@@ -357,8 +358,9 @@ static void encloseElement(int sw, int no) {
} else {
switch(sel.EncloseType) {
case 0:
lineEncloseElement(r, sel.WinBackgroundColor); break;
lineEncloseElement(r, sel.WinBackgroundColor, TRUE); break;
case 1:
lineEncloseElement(r, sel.WinBackgroundColor, FALSE); break;
case 2:
ags_fillRectangle(r->x, r->y, r->width +2, r->height +2, sel.WinBackgroundColor);
ags_drawString(r->x +2, r->y +2, elm[no], sel.MsgFontColor);
@@ -375,11 +377,12 @@ static void encloseElement(int sw, int no) {
}
switch(sel.EncloseType) {
case 0:
lineEncloseElement(r, sel.MsgFontColor); break;
lineEncloseElement(r, sel.WinFrameColor, TRUE); break;
case 1:
lineEncloseElement(r, 255, FALSE); break;
case 2:
ags_fillRectangleNeg(r->x, r->y, r->width +2, r->height +2, sel.SelectedElementColor);
ags_drawString(r->x +2, r->y +2, elm[no], sel.SelectedElementColor);
ags_fillRectangle(r->x, r->y, r->width +2, r->height +2, sel.MsgFontColor);
ags_drawString(r->x +2, r->y +2, elm[no], sel.WinBackgroundColor);
ags_updateArea(r->x, r->y, r->width +2, r->height +2);
break;
default: