summaryrefslogtreecommitdiff
path: root/apps/plugins/lib/bmp_smooth_scale.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-06-18 07:15:00 +0200
committerThomas Martitz <kugel@rockbox.org>2014-06-21 00:15:53 +0200
commita1842c04f9cb73210d4cacde61a9e4b115050765 (patch)
treea37af61ef9285b763a42cd33797e2f3d634fbf9f /apps/plugins/lib/bmp_smooth_scale.c
parent0250be1d6799db7b5ddc99cb33f31bf9cff01ed2 (diff)
lcd-24bit: Introduce a 24-bit mid-level LCD driver
With LCD driver all calculation will be performed on RGB888 and the hardware/OS can display from our 24bit framebuffer. It is not yet as performance optimized as the existing drivers but should be good enough.The vast number of small changes is due to the fact that fb_data can be a struct type now, while most of the code expected a scalar type. lcd-as-memframe ASM code does not work with 24bit currently so the with 24bit it enforces the generic C code. All plugins are ported over. Except for rockpaint. It uses so much memory that it wouldnt fit into the 512k plugin buffer anymore (patches welcome). Change-Id: Ibb1964545028ce0d8ff9833ccc3ab66be3ee0754
Diffstat (limited to 'apps/plugins/lib/bmp_smooth_scale.c')
-rw-r--r--apps/plugins/lib/bmp_smooth_scale.c186
1 files changed, 93 insertions, 93 deletions
diff --git a/apps/plugins/lib/bmp_smooth_scale.c b/apps/plugins/lib/bmp_smooth_scale.c
index e99ff33d71..c5f258cdbf 100644
--- a/apps/plugins/lib/bmp_smooth_scale.c
+++ b/apps/plugins/lib/bmp_smooth_scale.c
@@ -130,38 +130,38 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
if (XAP > 0) {
pix = ypoint + xpoint;
- r = RGB_UNPACK_RED(*pix) * INV_XAP;
- g = RGB_UNPACK_GREEN(*pix) * INV_XAP;
- b = RGB_UNPACK_BLUE(*pix) * INV_XAP;
+ r = FB_UNPACK_RED(*pix) * INV_XAP;
+ g = FB_UNPACK_GREEN(*pix) * INV_XAP;
+ b = FB_UNPACK_BLUE(*pix) * INV_XAP;
pix++;
- r += RGB_UNPACK_RED(*pix) * XAP;
- g += RGB_UNPACK_GREEN(*pix) * XAP;
- b += RGB_UNPACK_BLUE(*pix) * XAP;
+ r += FB_UNPACK_RED(*pix) * XAP;
+ g += FB_UNPACK_GREEN(*pix) * XAP;
+ b += FB_UNPACK_BLUE(*pix) * XAP;
pix += sow;
- rr = RGB_UNPACK_RED(*pix) * XAP;
- gg = RGB_UNPACK_GREEN(*pix) * XAP;
- bb = RGB_UNPACK_BLUE(*pix) * XAP;
+ rr = FB_UNPACK_RED(*pix) * XAP;
+ gg = FB_UNPACK_GREEN(*pix) * XAP;
+ bb = FB_UNPACK_BLUE(*pix) * XAP;
pix--;
- rr += RGB_UNPACK_RED(*pix) * INV_XAP;
- gg += RGB_UNPACK_GREEN(*pix) * INV_XAP;
- bb += RGB_UNPACK_BLUE(*pix) * INV_XAP;
+ rr += FB_UNPACK_RED(*pix) * INV_XAP;
+ gg += FB_UNPACK_GREEN(*pix) * INV_XAP;
+ bb += FB_UNPACK_BLUE(*pix) * INV_XAP;
r = ((rr * YAP) + (r * INV_YAP)) >> 16;
g = ((gg * YAP) + (g * INV_YAP)) >> 16;
b = ((bb * YAP) + (b * INV_YAP)) >> 16;
- *dptr++ = LCD_RGBPACK(r, g, b);
+ *dptr++ = FB_RGBPACK(r, g, b);
} else {
pix = ypoint + xpoint;
- r = RGB_UNPACK_RED(*pix) * INV_YAP;
- g = RGB_UNPACK_GREEN(*pix) * INV_YAP;
- b = RGB_UNPACK_BLUE(*pix) * INV_YAP;
+ r = FB_UNPACK_RED(*pix) * INV_YAP;
+ g = FB_UNPACK_GREEN(*pix) * INV_YAP;
+ b = FB_UNPACK_BLUE(*pix) * INV_YAP;
pix += sow;
- r += RGB_UNPACK_RED(*pix) * YAP;
- g += RGB_UNPACK_GREEN(*pix) * YAP;
- b += RGB_UNPACK_BLUE(*pix) * YAP;
+ r += FB_UNPACK_RED(*pix) * YAP;
+ g += FB_UNPACK_GREEN(*pix) * YAP;
+ b += FB_UNPACK_BLUE(*pix) * YAP;
r >>= 8;
g >>= 8;
b >>= 8;
- *dptr++ = LCD_RGBPACK(r, g, b);
+ *dptr++ = FB_RGBPACK(r, g, b);
}
}
} else {
@@ -176,17 +176,17 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
if (XAP > 0) {
pix = ypoint + xpoint;
- r = RGB_UNPACK_RED(*pix) * INV_XAP;
- g = RGB_UNPACK_GREEN(*pix) * INV_XAP;
- b = RGB_UNPACK_BLUE(*pix) * INV_XAP;
+ r = FB_UNPACK_RED(*pix) * INV_XAP;
+ g = FB_UNPACK_GREEN(*pix) * INV_XAP;
+ b = FB_UNPACK_BLUE(*pix) * INV_XAP;
pix++;
- r += RGB_UNPACK_RED(*pix) * XAP;
- g += RGB_UNPACK_GREEN(*pix) * XAP;
- b += RGB_UNPACK_BLUE(*pix) * XAP;
+ r += FB_UNPACK_RED(*pix) * XAP;
+ g += FB_UNPACK_GREEN(*pix) * XAP;
+ b += FB_UNPACK_BLUE(*pix) * XAP;
r >>= 8;
g >>= 8;
b >>= 8;
- *dptr++ = LCD_RGBPACK(r, g, b);
+ *dptr++ = FB_RGBPACK(r, g, b);
} else
*dptr++ = sptr[xpoint];
}
@@ -221,37 +221,37 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
val_x += inc_x;
pix = ypoint + xpoint;
- r = (RGB_UNPACK_RED(*pix) * yap) >> 10;
- g = (RGB_UNPACK_GREEN(*pix) * yap) >> 10;
- b = (RGB_UNPACK_BLUE(*pix) * yap) >> 10;
+ r = (FB_UNPACK_RED(*pix) * yap) >> 10;
+ g = (FB_UNPACK_GREEN(*pix) * yap) >> 10;
+ b = (FB_UNPACK_BLUE(*pix) * yap) >> 10;
pix += sow;
for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
- r += (RGB_UNPACK_RED(*pix) * Cy) >> 10;
- g += (RGB_UNPACK_GREEN(*pix) * Cy) >> 10;
- b += (RGB_UNPACK_BLUE(*pix) * Cy) >> 10;
+ r += (FB_UNPACK_RED(*pix) * Cy) >> 10;
+ g += (FB_UNPACK_GREEN(*pix) * Cy) >> 10;
+ b += (FB_UNPACK_BLUE(*pix) * Cy) >> 10;
pix += sow;
}
if (j > 0) {
- r += (RGB_UNPACK_RED(*pix) * j) >> 10;
- g += (RGB_UNPACK_GREEN(*pix) * j) >> 10;
- b += (RGB_UNPACK_BLUE(*pix) * j) >> 10;
+ r += (FB_UNPACK_RED(*pix) * j) >> 10;
+ g += (FB_UNPACK_GREEN(*pix) * j) >> 10;
+ b += (FB_UNPACK_BLUE(*pix) * j) >> 10;
}
if (XAP > 0) {
pix = ypoint + xpoint + 1;
- rr = (RGB_UNPACK_RED(*pix) * yap) >> 10;
- gg = (RGB_UNPACK_GREEN(*pix) * yap) >> 10;
- bb = (RGB_UNPACK_BLUE(*pix) * yap) >> 10;
+ rr = (FB_UNPACK_RED(*pix) * yap) >> 10;
+ gg = (FB_UNPACK_GREEN(*pix) * yap) >> 10;
+ bb = (FB_UNPACK_BLUE(*pix) * yap) >> 10;
pix += sow;
for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
- rr += (RGB_UNPACK_RED(*pix) * Cy) >> 10;
- gg += (RGB_UNPACK_GREEN(*pix) * Cy) >> 10;
- bb += (RGB_UNPACK_BLUE(*pix) * Cy) >> 10;
+ rr += (FB_UNPACK_RED(*pix) * Cy) >> 10;
+ gg += (FB_UNPACK_GREEN(*pix) * Cy) >> 10;
+ bb += (FB_UNPACK_BLUE(*pix) * Cy) >> 10;
pix += sow;
}
if (j > 0) {
- rr += (RGB_UNPACK_RED(*pix) * j) >> 10;
- gg += (RGB_UNPACK_GREEN(*pix) * j) >> 10;
- bb += (RGB_UNPACK_BLUE(*pix) * j) >> 10;
+ rr += (FB_UNPACK_RED(*pix) * j) >> 10;
+ gg += (FB_UNPACK_GREEN(*pix) * j) >> 10;
+ bb += (FB_UNPACK_BLUE(*pix) * j) >> 10;
}
r = r * INV_XAP;
g = g * INV_XAP;
@@ -264,7 +264,7 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
g >>= 4;
b >>= 4;
}
- *dptr = LCD_RGBPACK(r, g, b);
+ *dptr = FB_RGBPACK(r, g, b);
dptr++;
}
}
@@ -297,37 +297,37 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
xap = XAP & 0xffff;
pix = ypoint + xpoint;
- r = (RGB_UNPACK_RED(*pix) * xap) >> 10;
- g = (RGB_UNPACK_GREEN(*pix) * xap) >> 10;
- b = (RGB_UNPACK_BLUE(*pix) * xap) >> 10;
+ r = (FB_UNPACK_RED(*pix) * xap) >> 10;
+ g = (FB_UNPACK_GREEN(*pix) * xap) >> 10;
+ b = (FB_UNPACK_BLUE(*pix) * xap) >> 10;
pix++;
for (j = (1 << 14) - xap; j > Cx; j -= Cx) {
- r += (RGB_UNPACK_RED(*pix) * Cx) >> 10;
- g += (RGB_UNPACK_GREEN(*pix) * Cx) >> 10;
- b += (RGB_UNPACK_BLUE(*pix) * Cx) >> 10;
+ r += (FB_UNPACK_RED(*pix) * Cx) >> 10;
+ g += (FB_UNPACK_GREEN(*pix) * Cx) >> 10;
+ b += (FB_UNPACK_BLUE(*pix) * Cx) >> 10;
pix++;
}
if (j > 0) {
- r += (RGB_UNPACK_RED(*pix) * j) >> 10;
- g += (RGB_UNPACK_GREEN(*pix) * j) >> 10;
- b += (RGB_UNPACK_BLUE(*pix) * j) >> 10;
+ r += (FB_UNPACK_RED(*pix) * j) >> 10;
+ g += (FB_UNPACK_GREEN(*pix) * j) >> 10;
+ b += (FB_UNPACK_BLUE(*pix) * j) >> 10;
}
if (YAP > 0) {
pix = ypoint + xpoint + sow;
- rr = (RGB_UNPACK_RED(*pix) * xap) >> 10;
- gg = (RGB_UNPACK_GREEN(*pix) * xap) >> 10;
- bb = (RGB_UNPACK_BLUE(*pix) * xap) >> 10;
+ rr = (FB_UNPACK_RED(*pix) * xap) >> 10;
+ gg = (FB_UNPACK_GREEN(*pix) * xap) >> 10;
+ bb = (FB_UNPACK_BLUE(*pix) * xap) >> 10;
pix++;
for (j = (1 << 14) - xap; j > Cx; j -= Cx) {
- rr += (RGB_UNPACK_RED(*pix) * Cx) >> 10;
- gg += (RGB_UNPACK_GREEN(*pix) * Cx) >> 10;
- bb += (RGB_UNPACK_BLUE(*pix) * Cx) >> 10;
+ rr += (FB_UNPACK_RED(*pix) * Cx) >> 10;
+ gg += (FB_UNPACK_GREEN(*pix) * Cx) >> 10;
+ bb += (FB_UNPACK_BLUE(*pix) * Cx) >> 10;
pix++;
}
if (j > 0) {
- rr += (RGB_UNPACK_RED(*pix) * j) >> 10;
- gg += (RGB_UNPACK_GREEN(*pix) * j) >> 10;
- bb += (RGB_UNPACK_BLUE(*pix) * j) >> 10;
+ rr += (FB_UNPACK_RED(*pix) * j) >> 10;
+ gg += (FB_UNPACK_GREEN(*pix) * j) >> 10;
+ bb += (FB_UNPACK_BLUE(*pix) * j) >> 10;
}
r = r * INV_YAP;
g = g * INV_YAP;
@@ -340,7 +340,7 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
g >>= 4;
b >>= 4;
}
- *dptr = LCD_RGBPACK(r, g, b);
+ *dptr = FB_RGBPACK(r, g, b);
dptr++;
}
}
@@ -378,20 +378,20 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
pix = sptr;
sptr += sow;
- rx = (RGB_UNPACK_RED(*pix) * xap) >> 9;
- gx = (RGB_UNPACK_GREEN(*pix) * xap) >> 9;
- bx = (RGB_UNPACK_BLUE(*pix) * xap) >> 9;
+ rx = (FB_UNPACK_RED(*pix) * xap) >> 9;
+ gx = (FB_UNPACK_GREEN(*pix) * xap) >> 9;
+ bx = (FB_UNPACK_BLUE(*pix) * xap) >> 9;
pix++;
for (i = (1 << 14) - xap; i > Cx; i -= Cx) {
- rx += (RGB_UNPACK_RED(*pix) * Cx) >> 9;
- gx += (RGB_UNPACK_GREEN(*pix) * Cx) >> 9;
- bx += (RGB_UNPACK_BLUE(*pix) * Cx) >> 9;
+ rx += (FB_UNPACK_RED(*pix) * Cx) >> 9;
+ gx += (FB_UNPACK_GREEN(*pix) * Cx) >> 9;
+ bx += (FB_UNPACK_BLUE(*pix) * Cx) >> 9;
pix++;
}
if (i > 0) {
- rx += (RGB_UNPACK_RED(*pix) * i) >> 9;
- gx += (RGB_UNPACK_GREEN(*pix) * i) >> 9;
- bx += (RGB_UNPACK_BLUE(*pix) * i) >> 9;
+ rx += (FB_UNPACK_RED(*pix) * i) >> 9;
+ gx += (FB_UNPACK_GREEN(*pix) * i) >> 9;
+ bx += (FB_UNPACK_BLUE(*pix) * i) >> 9;
}
r = (rx * yap) >> 14;
@@ -401,20 +401,20 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
pix = sptr;
sptr += sow;
- rx = (RGB_UNPACK_RED(*pix) * xap) >> 9;
- gx = (RGB_UNPACK_GREEN(*pix) * xap) >> 9;
- bx = (RGB_UNPACK_BLUE(*pix) * xap) >> 9;
+ rx = (FB_UNPACK_RED(*pix) * xap) >> 9;
+ gx = (FB_UNPACK_GREEN(*pix) * xap) >> 9;
+ bx = (FB_UNPACK_BLUE(*pix) * xap) >> 9;
pix++;
for (i = (1 << 14) - xap; i > Cx; i -= Cx) {
- rx += (RGB_UNPACK_RED(*pix) * Cx) >> 9;
- gx += (RGB_UNPACK_GREEN(*pix) * Cx) >> 9;
- bx += (RGB_UNPACK_BLUE(*pix) * Cx) >> 9;
+ rx += (FB_UNPACK_RED(*pix) * Cx) >> 9;
+ gx += (FB_UNPACK_GREEN(*pix) * Cx) >> 9;
+ bx += (FB_UNPACK_BLUE(*pix) * Cx) >> 9;
pix++;
}
if (i > 0) {
- rx += (RGB_UNPACK_RED(*pix) * i) >> 9;
- gx += (RGB_UNPACK_GREEN(*pix) * i) >> 9;
- bx += (RGB_UNPACK_BLUE(*pix) * i) >> 9;
+ rx += (FB_UNPACK_RED(*pix) * i) >> 9;
+ gx += (FB_UNPACK_GREEN(*pix) * i) >> 9;
+ bx += (FB_UNPACK_BLUE(*pix) * i) >> 9;
}
r += (rx * Cy) >> 14;
@@ -424,20 +424,20 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
if (j > 0) {
pix = sptr;
sptr += sow;
- rx = (RGB_UNPACK_RED(*pix) * xap) >> 9;
- gx = (RGB_UNPACK_GREEN(*pix) * xap) >> 9;
- bx = (RGB_UNPACK_BLUE(*pix) * xap) >> 9;
+ rx = (FB_UNPACK_RED(*pix) * xap) >> 9;
+ gx = (FB_UNPACK_GREEN(*pix) * xap) >> 9;
+ bx = (FB_UNPACK_BLUE(*pix) * xap) >> 9;
pix++;
for (i = (1 << 14) - xap; i > Cx; i -= Cx) {
- rx += (RGB_UNPACK_RED(*pix) * Cx) >> 9;
- gx += (RGB_UNPACK_GREEN(*pix) * Cx) >> 9;
- bx += (RGB_UNPACK_BLUE(*pix) * Cx) >> 9;
+ rx += (FB_UNPACK_RED(*pix) * Cx) >> 9;
+ gx += (FB_UNPACK_GREEN(*pix) * Cx) >> 9;
+ bx += (FB_UNPACK_BLUE(*pix) * Cx) >> 9;
pix++;
}
if (i > 0) {
- rx += (RGB_UNPACK_RED(*pix) * i) >> 9;
- gx += (RGB_UNPACK_GREEN(*pix) * i) >> 9;
- bx += (RGB_UNPACK_BLUE(*pix) * i) >> 9;
+ rx += (FB_UNPACK_RED(*pix) * i) >> 9;
+ gx += (FB_UNPACK_GREEN(*pix) * i) >> 9;
+ bx += (FB_UNPACK_BLUE(*pix) * i) >> 9;
}
r += (rx * j) >> 14;
@@ -445,7 +445,7 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
b += (bx * j) >> 14;
}
- *dptr = LCD_RGBPACK(r >> 5, g >> 5, b >> 5);
+ *dptr = FB_RGBPACK(r >> 5, g >> 5, b >> 5);
dptr++;
}
}