Skip to content

Commit

Permalink
Update source to beta4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
NuVanDibe committed Apr 6, 2022
1 parent 039855a commit fa49829
Show file tree
Hide file tree
Showing 14 changed files with 124 additions and 16 deletions.
14 changes: 14 additions & 0 deletions shell2/backdrop.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,20 @@ void backdrop_set_border(BackDrop *bd, int border)
bd->border = border;
}

void backdrop_subrender(BackDrop *bd, Rect *r, Rect *subr, BitMap *bm)
{
// Draw inner

if (bm) {
if(bd->style & STYLE_BITMAP)
bitmap_blit(bm, subr->x, subr->y, bd->bitmap, subr->x - r->x, subr->y - r->y, subr->w, subr->h);
else if(bd->style & STYLE_HVRANGE)
bitmap_fillsubrange(bm, r, subr, &bd->color[2], &bd->color[3], bd->style);
else
bitmap_fillbox(bm, subr, TO_RGB16(bd->color[2]));
}
}

void backdrop_render(BackDrop *bd, Rect *r, BitMap *bm)
{
Rect org = *r, *orgr = &org;
Expand Down
Binary file modified shell2/backdrop.o
Binary file not shown.
102 changes: 94 additions & 8 deletions shell2/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ void bitmap_addbox(BitMap *dst, Rect *r, uint16 col)
int dmod = (dst->width - r->w);
int dh = r->h;
int high, low;
//int over;

while(dh--)
{
Expand All @@ -177,9 +178,19 @@ void bitmap_addbox(BitMap *dst, Rect *r, uint16 col)
{
high = *d & 0x739c;
low = *d & 0x0c63;
// high += (col & 0x739c)<<1;
// low += (col & 0x0c63)<<1;
high += (col & 0x739c);
low += (col & 0x0c63);
/* over = (high&0x8420);
over >>= 1;
over |= (over>>1);
over |= (over>>2);
over |= (over>>1);
*d = ((high&0x7bde)+(low&0x318c))|over;
*/
*d = (high+(low&0x318c))>>1;
// *d = (high+(low&0x318c))>>2;
d++;
}

Expand All @@ -193,7 +204,7 @@ enum
STYLE_VRANGE = 2,
};

void bitmap_fillrange(BitMap *bm, Rect *r, Color *color0, Color *color1, uint16 style)
void bitmap_fillsubrange(BitMap *bm, Rect *r, Rect *subr, Color *color0, Color *color1, uint16 style)
{
uint16 *d;
int x,y,w,h,bmw;
Expand All @@ -203,15 +214,93 @@ void bitmap_fillrange(BitMap *bm, Rect *r, Color *color0, Color *color1, uint16
c1 = (color0->g << 2);
c2 = (color0->r << 2);

bmw = bm->width;

d = (uint16 *)bm->pixels + r->x + r->y * bmw;

if(style & STYLE_HRANGE)
{
d0 = ( (color1->b - color0->b) << 7) / (r->w);
d1 = ( (color1->g - color0->g) << 2) / (r->w);
d2 = ( (color1->r - color0->r) << 2) / (r->w);

bmw = bm->width;
for(x=0; x<r->w; x++)
{
col16 = (c0 & 0x7C00) | (c1 & 0x03E0) | ((c2 >> 5) & 0x1F);

c0 += d0;
c1 += d1;
c2 += d2;

if (r->x + x >= subr->x &&
r->x + x < subr->x + subr->w)
{
for (h = 0; h < r->h; h++)
{
if (r->y + h >= subr->y &&
r->y + h < subr->y + subr->h)
*d = col16;
d += bmw;
}

d -= (bmw * r->h - 1);
} else
d++;
}
}
else
{
d0 = ( (color1->b - color0->b) << 7) / (r->h);
d1 = ( (color1->g - color0->g) << 2) / (r->h);
d2 = ( (color1->r - color0->r) << 2) / (r->h);

for(y=0; y<r->h; y++)
{
col16 = (c0 & 0x7C00) | (c1 & 0x03E0) | ((c2 >> 5) & 0x1F);

c0 += d0;
c1 += d1;
c2 += d2;

if (r->y + y >= subr->y &&
r->y + y < subr->y + subr->h)
{
for (w = 0; w < r->w; w++)
{
if (r->x + w >= subr->x &&
r->x + w < subr->x + subr->w)
*d = col16;
d++;
}
d += (bmw - r->w);
} else
d += bmw;
}

}

}

void bitmap_fillrange(BitMap *bm, Rect *r, Color *color0, Color *color1, uint16 style)
{
bitmap_fillsubrange(bm, r, r, color0, color1, style);
#if 0
uint16 *d;
int x,y,w,h,bmw;
uint16 c0, c1, c2, d0, d1, d2, col16;

c0 = (color0->b << 7);
c1 = (color0->g << 2);
c2 = (color0->r << 2);

d = (uint16 *)bm->pixels + r->x + r->y * bmw;
bmw = bm->width;
d = (uint16 *)bm->pixels + r->x + r->y * bmw;

if(style & STYLE_HRANGE)
{
d0 = ( (color1->b - color0->b) << 7) / (r->w);
d1 = ( (color1->g - color0->g) << 2) / (r->w);
d2 = ( (color1->r - color0->r) << 2) / (r->w);

for(x=0; x<r->w; x++)
{
Expand Down Expand Up @@ -239,9 +328,6 @@ void bitmap_fillrange(BitMap *bm, Rect *r, Color *color0, Color *color1, uint16
d1 = ( (color1->g - color0->g) << 2) / (r->h);
d2 = ( (color1->r - color0->r) << 2) / (r->h);


d = (uint16 *)bm->pixels + r->x + r->y * bm->width;

for(y=0; y<r->h; y++)
{
col16 = (c0 & 0x7C00) | (c1 & 0x03E0) | ((c2 >> 5) & 0x1F);
Expand All @@ -255,11 +341,11 @@ void bitmap_fillrange(BitMap *bm, Rect *r, Color *color0, Color *color1, uint16
while(w--)
*d++ = col16;

d += (bm->width - r->w);
d += (bmw - r->w);
}

}

#endif
}


Expand Down
Binary file modified shell2/bitmap.o
Binary file not shown.
10 changes: 7 additions & 3 deletions shell2/msgbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,14 @@ int msgbox_list(char *title, char **lines, int num)

listview_set_attribute(MessageList, WATR_COLOR, &MessageTxt->textcolor);

MessageWin->height = MessageList->w.height + 8;
//MessageWin->height = MessageList->w.height + 8;
i = MessageList->w.height;
i += w->height;
i += 4;
MessageWin->height = i;
i = MessageList->w.width;
if(w->height > i)
i = w->height;
if(w->width > i)
i = w->width;
i += 4;
MessageWin->width = i;
MessageWin->x = (240 - MessageWin->width) / 2;
Expand Down
Binary file modified shell2/msgbox.o
Binary file not shown.
Binary file modified shell2/pogo_visoly_xg1.elf
Binary file not shown.
Binary file modified shell2/pogo_visoly_xg1.gba
Binary file not shown.
Binary file modified shell2/pogo_xrom.elf
Binary file not shown.
Binary file modified shell2/pogo_xrom.gba
Binary file not shown.
11 changes: 7 additions & 4 deletions shell2/widgets/listview.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,10 @@ int listview_render(ListView *lv, Rect *org_r, BitMap *bm)
//fprintf(stderr, "Redrawing %d\n", i);

if (lv->dirty != 0xFF) {
if(sbm)
bitmap_blit(bm, r2.x, r2.y, sbm, 0, (y+lv->marginy) % sbm->height, r2.w, lineh);
if (lv->backdrop)
backdrop_subrender(lv->backdrop, r, &r2, bm);
else
{
bitmap_fillbox(bm, &r2, bdcol);
}
}

d = dst;
Expand Down Expand Up @@ -413,6 +411,11 @@ void listview_setline(ListView *lv, int index, BitMap *bm, ...)
lv->w.height = lv->lineh * lv->lines + lv->marginy * 2;
lv->w.width = lv->iconw + lv->linew + lv->marginx * 2;

if (lv->backdrop) {
lv->w.height += lv->backdrop->border*2;
lv->w.width += lv->backdrop->border*2;
}

va_end(vl);
}

Expand Down
Binary file modified shell2/widgets/listview.o
Binary file not shown.
3 changes: 2 additions & 1 deletion shell2/widgets/textflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ void textflow_set_attribute(TextFlow *tb, int attr, void *val)
break;
case WATR_RGB:
l = (int)val;
tb->textcolor[n].r = l>>16;
tb->textcolor[n].a = (l>>24) & 0xff;
tb->textcolor[n].r = (l>>16) & 0xff;
tb->textcolor[n].g = (l>>8) & 0xff;
tb->textcolor[n].b = l & 0xff;
tb->w.flags |= WFLG_REDRAW;
Expand Down
Binary file modified shell2/widgets/textflow.o
Binary file not shown.

0 comments on commit fa49829

Please sign in to comment.