netsurf: branch master updated. release/3.0-698-g401d1fd
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/401d1fd1a68fa802247da...
...commit http://git.netsurf-browser.org/netsurf.git/commit/401d1fd1a68fa802247da36...
...tree http://git.netsurf-browser.org/netsurf.git/tree/401d1fd1a68fa802247da36b2...
The branch, master has been updated
via 401d1fd1a68fa802247da36b220985ccc58fad94 (commit)
via 9c707c8df0803353aed4ee3ac980ed44775bcb40 (commit)
from 6ca908a192427f2269b778d6f2b4be72656378e3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=401d1fd1a68fa802247...
commit 401d1fd1a68fa802247da36b220985ccc58fad94
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
fix coverity 1109883
diff --git a/gtk/dialogs/source.c b/gtk/dialogs/source.c
index fe9005c..5306bdc 100644
--- a/gtk/dialogs/source.c
+++ b/gtk/dialogs/source.c
@@ -302,6 +302,7 @@ void nsgtk_source_tab_init(GtkWindow *parent, struct browser_window *bw)
if (f == NULL) {
warn_user(messages_get("gtkSourceTabError"), 0);
g_free(filename);
+ free(ndata);
return;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=9c707c8df0803353aed...
commit 9c707c8df0803353aed4ee3ac980ed44775bcb40
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
fix coverity 1109891
diff --git a/gtk/gui.c b/gtk/gui.c
index 0968021..45e32c8 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -764,7 +764,7 @@ void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
static struct nsgtk_treeview *ssl_window;
struct sslcert_session_data *data;
GtkButton *accept, *reject;
- void **session = calloc(sizeof(void *), 3);
+ void **session;
GtkWindow *window;
GtkScrolledWindow *scrolled;
GtkDrawingArea *drawing_area;
@@ -778,19 +778,26 @@ void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
return;
}
- sslcert_viewer_create_session_data(num, url, cb, cbpw, certs,
- &data);
+ sslcert_viewer_create_session_data(num, url, cb, cbpw, certs, &data);
ssl_current_session = data;
window = GTK_WINDOW(gtk_builder_get_object(builder, "wndSSLProblem"));
scrolled = GTK_SCROLLED_WINDOW(gtk_builder_get_object(builder, "SSLScrolled"));
drawing_area = GTK_DRAWING_AREA(gtk_builder_get_object(builder, "SSLDrawingArea"));
+ session = calloc(sizeof(void *), 3);
+
+ if (session == NULL) {
+ return;
+ }
+
ssl_window = nsgtk_treeview_create(TREE_SSLCERT, window, scrolled,
drawing_area);
- if (ssl_window == NULL)
+ if (ssl_window == NULL) {
+ free(session);
return;
+ }
accept = GTK_BUTTON(gtk_builder_get_object(builder, "sslaccept"));
reject = GTK_BUTTON(gtk_builder_get_object(builder, "sslreject"));
-----------------------------------------------------------------------
Summary of changes:
gtk/dialogs/source.c | 1 +
gtk/gui.c | 15 +++++++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/gtk/dialogs/source.c b/gtk/dialogs/source.c
index fe9005c..5306bdc 100644
--- a/gtk/dialogs/source.c
+++ b/gtk/dialogs/source.c
@@ -302,6 +302,7 @@ void nsgtk_source_tab_init(GtkWindow *parent, struct browser_window *bw)
if (f == NULL) {
warn_user(messages_get("gtkSourceTabError"), 0);
g_free(filename);
+ free(ndata);
return;
}
diff --git a/gtk/gui.c b/gtk/gui.c
index 0968021..45e32c8 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -764,7 +764,7 @@ void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
static struct nsgtk_treeview *ssl_window;
struct sslcert_session_data *data;
GtkButton *accept, *reject;
- void **session = calloc(sizeof(void *), 3);
+ void **session;
GtkWindow *window;
GtkScrolledWindow *scrolled;
GtkDrawingArea *drawing_area;
@@ -778,19 +778,26 @@ void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
return;
}
- sslcert_viewer_create_session_data(num, url, cb, cbpw, certs,
- &data);
+ sslcert_viewer_create_session_data(num, url, cb, cbpw, certs, &data);
ssl_current_session = data;
window = GTK_WINDOW(gtk_builder_get_object(builder, "wndSSLProblem"));
scrolled = GTK_SCROLLED_WINDOW(gtk_builder_get_object(builder, "SSLScrolled"));
drawing_area = GTK_DRAWING_AREA(gtk_builder_get_object(builder, "SSLDrawingArea"));
+ session = calloc(sizeof(void *), 3);
+
+ if (session == NULL) {
+ return;
+ }
+
ssl_window = nsgtk_treeview_create(TREE_SSLCERT, window, scrolled,
drawing_area);
- if (ssl_window == NULL)
+ if (ssl_window == NULL) {
+ free(session);
return;
+ }
accept = GTK_BUTTON(gtk_builder_get_object(builder, "sslaccept"));
reject = GTK_BUTTON(gtk_builder_get_object(builder, "sslreject"));
--
NetSurf Browser
9 years, 10 months
libnsfb: branch master updated. release/0.1.0-14-g1a1da46
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libnsfb.git/shortlog/1a1da46f6bc8bbb35afd2...
...commit http://git.netsurf-browser.org/libnsfb.git/commit/1a1da46f6bc8bbb35afd29b...
...tree http://git.netsurf-browser.org/libnsfb.git/tree/1a1da46f6bc8bbb35afd29b49...
The branch, master has been updated
via 1a1da46f6bc8bbb35afd29b49361107e954bfafa (commit)
from 599c4eca7ced6d3dcb08c95c743b411a61bed289 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libnsfb.git/commit/?id=1a1da46f6bc8bbb35af...
commit 1a1da46f6bc8bbb35afd29b49361107e954bfafa
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
A few tidyups.
diff --git a/include/palette.h b/include/palette.h
index 04bdd4f..a853254 100644
--- a/include/palette.h
+++ b/include/palette.h
@@ -145,6 +145,7 @@ static inline uint8_t nsfb_palette_best_match_dither(
int current;
int error;
int width = palette->dither_ctx.width;
+ int *data = palette->dither_ctx.data;
uint8_t best_col_index;
if (palette == NULL)
@@ -156,9 +157,9 @@ static inline uint8_t nsfb_palette_best_match_dither(
current = palette->dither_ctx.current;
/* Get RGB components of colour, and apply error */
- r = ( c & 0xFF) + palette->dither_ctx.data[current ];
- g = ((c >> 8) & 0xFF) + palette->dither_ctx.data[current + 1];
- b = ((c >> 16) & 0xFF) + palette->dither_ctx.data[current + 2];
+ r = ( c & 0xFF) + data[current ];
+ g = ((c >> 8) & 0xFF) + data[current + 1];
+ b = ((c >> 16) & 0xFF) + data[current + 2];
/* Clamp new RGB components to range */
if (r < 0) r = 0;
@@ -169,9 +170,9 @@ static inline uint8_t nsfb_palette_best_match_dither(
if (b > 255) b = 255;
/* Reset error diffusion slots to 0 */
- palette->dither_ctx.data[current ] = 0;
- palette->dither_ctx.data[current + 1] = 0;
- palette->dither_ctx.data[current + 2] = 0;
+ data[current ] = 0;
+ data[current + 1] = 0;
+ data[current + 2] = 0;
/* Rebuild colour from modified components */
c = r + (g << 8) + (b << 16);
@@ -196,9 +197,9 @@ static inline uint8_t nsfb_palette_best_match_dither(
/* Error for [N] (next) */
if (error != 0) {
/* The pixel exists */
- palette->dither_ctx.data[error ] += r * 7 / 16;
- palette->dither_ctx.data[error + 1] += g * 7 / 16;
- palette->dither_ctx.data[error + 2] += b * 7 / 16;
+ data[error ] += r * 7 / 16;
+ data[error + 1] += g * 7 / 16;
+ data[error + 2] += b * 7 / 16;
}
error += width - 2 * 3;
@@ -207,18 +208,18 @@ static inline uint8_t nsfb_palette_best_match_dither(
/* Error for [l] (below, left) */
if (error >= 0 && error != 3) {
/* The pixel exists */
- palette->dither_ctx.data[error ] += r * 3 / 16;
- palette->dither_ctx.data[error + 1] += g * 3 / 16;
- palette->dither_ctx.data[error + 2] += b * 3 / 16;
+ data[error ] += r * 3 / 16;
+ data[error + 1] += g * 3 / 16;
+ data[error + 2] += b * 3 / 16;
}
error += 3;
if (error >= width)
error -= width;
/* Error for [m] (below, middle) */
- palette->dither_ctx.data[error ] += r * 5 / 16;
- palette->dither_ctx.data[error + 1] += g * 5 / 16;
- palette->dither_ctx.data[error + 2] += b * 5 / 16;
+ data[error ] += r * 5 / 16;
+ data[error + 1] += g * 5 / 16;
+ data[error + 2] += b * 5 / 16;
error += 3;
if (error >= width)
@@ -226,9 +227,9 @@ static inline uint8_t nsfb_palette_best_match_dither(
/* Error for [r] (below, right) */
if (error != 0) {
/* The pixel exists */
- palette->dither_ctx.data[error ] += r / 16;
- palette->dither_ctx.data[error + 1] += g / 16;
- palette->dither_ctx.data[error + 2] += b / 16;
+ data[error ] += r / 16;
+ data[error + 1] += g / 16;
+ data[error + 2] += b / 16;
}
return best_col_index;
diff --git a/src/plot/common.c b/src/plot/common.c
index 3aa36cd..063f68d 100644
--- a/src/plot/common.c
+++ b/src/plot/common.c
@@ -496,8 +496,6 @@ bitmap_tiles_x(nsfb_t *nsfb,
const nsfb_bbox_t *loc,
int tiles_x,
const nsfb_colour_t *pixel,
- int bmp_width,
- int bmp_height,
int bmp_stride,
bool alpha)
{
@@ -733,15 +731,7 @@ bitmap_tiles(nsfb_t *nsfb,
}
} else {
/* Unscaled */
- if (tiles_x != 1) {
- for (ty = 0; ty < tiles_y; ty++) {
- ok &= bitmap_tiles_x(nsfb, &tloc, tiles_x,
- pixel, bmp_width, bmp_height,
- bmp_stride, alpha);
- tloc.y0 += height;
- tloc.y1 += height;
- }
- } else if (tiles_x == 1) {
+ if (tiles_x == 1 || !set_dither) {
for (ty = 0; ty < tiles_y; ty++) {
for (tx = 0; tx < tiles_x; tx++) {
ok &= bitmap(nsfb, &tloc, pixel,
@@ -755,6 +745,13 @@ bitmap_tiles(nsfb_t *nsfb,
tloc.x1 = loc->x1 + skip;
tloc.y1 += height;
}
+ } else if (tiles_x > 1) {
+ for (ty = 0; ty < tiles_y; ty++) {
+ ok &= bitmap_tiles_x(nsfb, &tloc, tiles_x,
+ pixel, bmp_stride, alpha);
+ tloc.y0 += height;
+ tloc.y1 += height;
+ }
}
}
-----------------------------------------------------------------------
Summary of changes:
include/palette.h | 37 +++++++++++++++++++------------------
src/plot/common.c | 19 ++++++++-----------
2 files changed, 27 insertions(+), 29 deletions(-)
diff --git a/include/palette.h b/include/palette.h
index 04bdd4f..a853254 100644
--- a/include/palette.h
+++ b/include/palette.h
@@ -145,6 +145,7 @@ static inline uint8_t nsfb_palette_best_match_dither(
int current;
int error;
int width = palette->dither_ctx.width;
+ int *data = palette->dither_ctx.data;
uint8_t best_col_index;
if (palette == NULL)
@@ -156,9 +157,9 @@ static inline uint8_t nsfb_palette_best_match_dither(
current = palette->dither_ctx.current;
/* Get RGB components of colour, and apply error */
- r = ( c & 0xFF) + palette->dither_ctx.data[current ];
- g = ((c >> 8) & 0xFF) + palette->dither_ctx.data[current + 1];
- b = ((c >> 16) & 0xFF) + palette->dither_ctx.data[current + 2];
+ r = ( c & 0xFF) + data[current ];
+ g = ((c >> 8) & 0xFF) + data[current + 1];
+ b = ((c >> 16) & 0xFF) + data[current + 2];
/* Clamp new RGB components to range */
if (r < 0) r = 0;
@@ -169,9 +170,9 @@ static inline uint8_t nsfb_palette_best_match_dither(
if (b > 255) b = 255;
/* Reset error diffusion slots to 0 */
- palette->dither_ctx.data[current ] = 0;
- palette->dither_ctx.data[current + 1] = 0;
- palette->dither_ctx.data[current + 2] = 0;
+ data[current ] = 0;
+ data[current + 1] = 0;
+ data[current + 2] = 0;
/* Rebuild colour from modified components */
c = r + (g << 8) + (b << 16);
@@ -196,9 +197,9 @@ static inline uint8_t nsfb_palette_best_match_dither(
/* Error for [N] (next) */
if (error != 0) {
/* The pixel exists */
- palette->dither_ctx.data[error ] += r * 7 / 16;
- palette->dither_ctx.data[error + 1] += g * 7 / 16;
- palette->dither_ctx.data[error + 2] += b * 7 / 16;
+ data[error ] += r * 7 / 16;
+ data[error + 1] += g * 7 / 16;
+ data[error + 2] += b * 7 / 16;
}
error += width - 2 * 3;
@@ -207,18 +208,18 @@ static inline uint8_t nsfb_palette_best_match_dither(
/* Error for [l] (below, left) */
if (error >= 0 && error != 3) {
/* The pixel exists */
- palette->dither_ctx.data[error ] += r * 3 / 16;
- palette->dither_ctx.data[error + 1] += g * 3 / 16;
- palette->dither_ctx.data[error + 2] += b * 3 / 16;
+ data[error ] += r * 3 / 16;
+ data[error + 1] += g * 3 / 16;
+ data[error + 2] += b * 3 / 16;
}
error += 3;
if (error >= width)
error -= width;
/* Error for [m] (below, middle) */
- palette->dither_ctx.data[error ] += r * 5 / 16;
- palette->dither_ctx.data[error + 1] += g * 5 / 16;
- palette->dither_ctx.data[error + 2] += b * 5 / 16;
+ data[error ] += r * 5 / 16;
+ data[error + 1] += g * 5 / 16;
+ data[error + 2] += b * 5 / 16;
error += 3;
if (error >= width)
@@ -226,9 +227,9 @@ static inline uint8_t nsfb_palette_best_match_dither(
/* Error for [r] (below, right) */
if (error != 0) {
/* The pixel exists */
- palette->dither_ctx.data[error ] += r / 16;
- palette->dither_ctx.data[error + 1] += g / 16;
- palette->dither_ctx.data[error + 2] += b / 16;
+ data[error ] += r / 16;
+ data[error + 1] += g / 16;
+ data[error + 2] += b / 16;
}
return best_col_index;
diff --git a/src/plot/common.c b/src/plot/common.c
index 3aa36cd..063f68d 100644
--- a/src/plot/common.c
+++ b/src/plot/common.c
@@ -496,8 +496,6 @@ bitmap_tiles_x(nsfb_t *nsfb,
const nsfb_bbox_t *loc,
int tiles_x,
const nsfb_colour_t *pixel,
- int bmp_width,
- int bmp_height,
int bmp_stride,
bool alpha)
{
@@ -733,15 +731,7 @@ bitmap_tiles(nsfb_t *nsfb,
}
} else {
/* Unscaled */
- if (tiles_x != 1) {
- for (ty = 0; ty < tiles_y; ty++) {
- ok &= bitmap_tiles_x(nsfb, &tloc, tiles_x,
- pixel, bmp_width, bmp_height,
- bmp_stride, alpha);
- tloc.y0 += height;
- tloc.y1 += height;
- }
- } else if (tiles_x == 1) {
+ if (tiles_x == 1 || !set_dither) {
for (ty = 0; ty < tiles_y; ty++) {
for (tx = 0; tx < tiles_x; tx++) {
ok &= bitmap(nsfb, &tloc, pixel,
@@ -755,6 +745,13 @@ bitmap_tiles(nsfb_t *nsfb,
tloc.x1 = loc->x1 + skip;
tloc.y1 += height;
}
+ } else if (tiles_x > 1) {
+ for (ty = 0; ty < tiles_y; ty++) {
+ ok &= bitmap_tiles_x(nsfb, &tloc, tiles_x,
+ pixel, bmp_stride, alpha);
+ tloc.y0 += height;
+ tloc.y1 += height;
+ }
}
}
--
NetSurf Framebuffer library
9 years, 10 months
libnsfb: branch master updated. release/0.1.0-13-g599c4ec
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libnsfb.git/shortlog/599c4eca7ced6d3dcb08c...
...commit http://git.netsurf-browser.org/libnsfb.git/commit/599c4eca7ced6d3dcb08c95...
...tree http://git.netsurf-browser.org/libnsfb.git/tree/599c4eca7ced6d3dcb08c95c7...
The branch, master has been updated
via 599c4eca7ced6d3dcb08c95c743b411a61bed289 (commit)
from 394336f6112468bf106ef2885bf528e25ded41ef (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libnsfb.git/commit/?id=599c4eca7ced6d3dcb0...
commit 599c4eca7ced6d3dcb08c95c743b411a61bed289
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Do tiled rendering by scanline, rather than by tile. Error diffusion now works across tile boundaries.
diff --git a/src/plot/common.c b/src/plot/common.c
index e1f4a7a..3aa36cd 100644
--- a/src/plot/common.c
+++ b/src/plot/common.c
@@ -408,7 +408,7 @@ bitmap(nsfb_t *nsfb,
int width = loc->x1 - loc->x0;
int height = loc->y1 - loc->y0;
nsfb_bbox_t clipped; /* clipped display */
- bool set_dither = false; /* true iff we enabled dithering here */
+ bool set_dither = false; /* true iff we enabled dithering here */
if (width == 0 || height == 0)
return true;
@@ -491,6 +491,174 @@ bitmap(nsfb_t *nsfb,
return true;
}
+static inline bool
+bitmap_tiles_x(nsfb_t *nsfb,
+ const nsfb_bbox_t *loc,
+ int tiles_x,
+ const nsfb_colour_t *pixel,
+ int bmp_width,
+ int bmp_height,
+ int bmp_stride,
+ bool alpha)
+{
+ PLOT_TYPE *pvideo;
+ PLOT_TYPE *pvideo_pos;
+ PLOT_TYPE *pvideo_limit;
+ nsfb_colour_t abpixel; /* alphablended pixel */
+ int xloop;
+ int xoff, yoff; /* x and y offset into image */
+ int xlim;
+ int t;
+ int x = loc->x0;
+ int y = loc->y0;
+ int width = loc->x1 - loc->x0;
+ int height = loc->y1 - loc->y0;
+ nsfb_bbox_t clipped; /* clipped display */
+
+ if (width == 0 || height == 0)
+ return true;
+
+ /* The part of the image actually displayed is cropped to the
+ * current context. */
+ clipped.x0 = x;
+ clipped.y0 = y;
+ clipped.x1 = x + width * tiles_x;
+ clipped.y1 = y + height;
+
+ if (!nsfb_plot_clip_ctx(nsfb, &clipped))
+ return true;
+
+ if (height > (clipped.y1 - clipped.y0))
+ height = (clipped.y1 - clipped.y0);
+
+ pvideo = get_xy_loc(nsfb, clipped.x0, clipped.y0);
+ pvideo_limit = pvideo + PLOT_LINELEN(nsfb->linelen) * height;
+
+ xoff = clipped.x0 - x;
+ xlim = width - (x + width * tiles_x - clipped.x1);
+ yoff = (clipped.y0 - y) * bmp_stride;
+
+ /* plot the image */
+ if (alpha) {
+ for (; pvideo < pvideo_limit;
+ pvideo += PLOT_LINELEN(nsfb->linelen)) {
+ pvideo_pos = pvideo;
+ for (t = 0; t < 1; t++) {
+ for (xloop = xoff; xloop < width; xloop++) {
+ abpixel = pixel[yoff + xloop];
+ if ((abpixel & 0xFF000000) != 0) {
+ /* pixel is not transparent;
+ * have to plot something */
+ if ((abpixel & 0xFF000000) !=
+ 0xFF000000) {
+ /* pixel is not opaque;
+ * need to blend */
+ abpixel =
+ nsfb_plot_ablend(
+ abpixel,
+ pixel_to_colour(
+ nsfb,
+ *(pvideo +
+ xloop - xoff)));
+ }
+ *(pvideo + xloop - xoff) =
+ colour_to_pixel(
+ nsfb, abpixel);
+ }
+ }
+ }
+ pvideo_pos += width - xoff;
+ for (; t < tiles_x - 1; t++) {
+ for (xloop = 0; xloop < width; xloop++) {
+ abpixel = pixel[yoff + xloop];
+ if ((abpixel & 0xFF000000) != 0) {
+ /* pixel is not transparent;
+ * have to plot something */
+ if ((abpixel & 0xFF000000) !=
+ 0xFF000000) {
+ /* pixel is not opaque;
+ * need to blend */
+ abpixel =
+ nsfb_plot_ablend(
+ abpixel,
+ pixel_to_colour(
+ nsfb,
+ *(pvideo_pos +
+ xloop)));
+ }
+ *(pvideo_pos + xloop) =
+ colour_to_pixel(
+ nsfb, abpixel);
+ }
+ }
+ pvideo_pos += width;
+ }
+ for (; t < tiles_x; t++) {
+ for (xloop = 0; xloop < xlim; xloop++) {
+ abpixel = pixel[yoff + xloop];
+ if ((abpixel & 0xFF000000) != 0) {
+ /* pixel is not transparent;
+ * have to plot something */
+ if ((abpixel & 0xFF000000) !=
+ 0xFF000000) {
+ /* pixel is not opaque;
+ * need to blend */
+ abpixel =
+ nsfb_plot_ablend(
+ abpixel,
+ pixel_to_colour(
+ nsfb,
+ *(pvideo_pos +
+ xloop)));
+ }
+ *(pvideo_pos + xloop) =
+ colour_to_pixel(
+ nsfb, abpixel);
+ }
+ }
+ }
+ yoff += bmp_stride;
+ }
+ } else {
+ for (; pvideo < pvideo_limit;
+ pvideo += PLOT_LINELEN(nsfb->linelen)) {
+ pvideo_pos = pvideo;
+ for (t = 0; t < 1; t++) {
+ for (xloop = xoff; xloop < width; xloop++) {
+ abpixel = pixel[yoff + xloop];
+ *(pvideo + xloop - xoff) =
+ colour_to_pixel(
+ nsfb,
+ abpixel);
+ }
+ }
+ pvideo_pos += width - xoff;
+ for (; t < tiles_x - 1; t++) {
+ for (xloop = 0; xloop < width; xloop++) {
+ abpixel = pixel[yoff + xloop];
+ *(pvideo_pos + xloop) =
+ colour_to_pixel(
+ nsfb,
+ abpixel);
+ }
+ pvideo_pos += width;
+ }
+ for (; t < tiles_x; t++) {
+ for (xloop = 0; xloop < xlim; xloop++) {
+ abpixel = pixel[yoff + xloop];
+ *(pvideo_pos + xloop) =
+ colour_to_pixel(
+ nsfb,
+ abpixel);
+ }
+ }
+ yoff += bmp_stride;
+ }
+ }
+
+ return true;
+}
+
static bool
bitmap_tiles(nsfb_t *nsfb,
const nsfb_bbox_t *loc,
@@ -507,7 +675,9 @@ bitmap_tiles(nsfb_t *nsfb,
int tx, ty;
int width = loc->x1 - loc->x0;
int height = loc->y1 - loc->y0;
+ int skip = 0;
bool ok = true;
+ bool scaled = (width != bmp_width) || (height != bmp_height);
bool set_dither = false; /* true iff we enabled dithering here */
/* Avoid pointless rendering */
@@ -523,8 +693,8 @@ bitmap_tiles(nsfb_t *nsfb,
return true;
/* Enable error diffusion for paletted screens, if not already on,
- * if not repeating in x direction */
- if (tiles_x == 1 && nsfb->palette != NULL &&
+ * if not scaled or if not repeating in x direction */
+ if ((!scaled || tiles_x == 1) && nsfb->palette != NULL &&
nsfb_palette_dithering_on(nsfb->palette) == false) {
nsfb_palette_dither_init(nsfb->palette,
render_area.x1 - render_area.x0);
@@ -534,7 +704,19 @@ bitmap_tiles(nsfb_t *nsfb,
/* Given tile location is top left; start with that one. */
tloc = *loc;
- if (width != bmp_width || height != bmp_height) {
+ if (render_area.x0 - tloc.x0 > width) {
+ skip = (render_area.x0 - tloc.x0) / width;
+ tiles_x -= skip;
+ skip *= width;
+ tloc.x0 += skip;
+ tloc.x1 += skip;
+ }
+
+ if (tloc.x1 - render_area.x1 > width) {
+ tiles_x -= (tloc.x1 - render_area.x1) / width;
+ }
+
+ if (scaled) {
/* Scaled */
for (ty = 0; ty < tiles_y; ty++) {
for (tx = 0; tx < tiles_x; tx++) {
@@ -551,18 +733,28 @@ bitmap_tiles(nsfb_t *nsfb,
}
} else {
/* Unscaled */
- for (ty = 0; ty < tiles_y; ty++) {
- for (tx = 0; tx < tiles_x; tx++) {
- ok &= bitmap(nsfb, &tloc, pixel,
- bmp_width, bmp_height,
+ if (tiles_x != 1) {
+ for (ty = 0; ty < tiles_y; ty++) {
+ ok &= bitmap_tiles_x(nsfb, &tloc, tiles_x,
+ pixel, bmp_width, bmp_height,
bmp_stride, alpha);
- tloc.x0 += width;
- tloc.x1 += width;
+ tloc.y0 += height;
+ tloc.y1 += height;
+ }
+ } else if (tiles_x == 1) {
+ for (ty = 0; ty < tiles_y; ty++) {
+ for (tx = 0; tx < tiles_x; tx++) {
+ ok &= bitmap(nsfb, &tloc, pixel,
+ bmp_width, bmp_height,
+ bmp_stride, alpha);
+ tloc.x0 += width;
+ tloc.x1 += width;
+ }
+ tloc.x0 = loc->x0 + skip;
+ tloc.y0 += height;
+ tloc.x1 = loc->x1 + skip;
+ tloc.y1 += height;
}
- tloc.x0 = loc->x0;
- tloc.y0 += height;
- tloc.x1 = loc->x1;
- tloc.y1 += height;
}
}
-----------------------------------------------------------------------
Summary of changes:
src/plot/common.c | 220 +++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 206 insertions(+), 14 deletions(-)
diff --git a/src/plot/common.c b/src/plot/common.c
index e1f4a7a..3aa36cd 100644
--- a/src/plot/common.c
+++ b/src/plot/common.c
@@ -408,7 +408,7 @@ bitmap(nsfb_t *nsfb,
int width = loc->x1 - loc->x0;
int height = loc->y1 - loc->y0;
nsfb_bbox_t clipped; /* clipped display */
- bool set_dither = false; /* true iff we enabled dithering here */
+ bool set_dither = false; /* true iff we enabled dithering here */
if (width == 0 || height == 0)
return true;
@@ -491,6 +491,174 @@ bitmap(nsfb_t *nsfb,
return true;
}
+static inline bool
+bitmap_tiles_x(nsfb_t *nsfb,
+ const nsfb_bbox_t *loc,
+ int tiles_x,
+ const nsfb_colour_t *pixel,
+ int bmp_width,
+ int bmp_height,
+ int bmp_stride,
+ bool alpha)
+{
+ PLOT_TYPE *pvideo;
+ PLOT_TYPE *pvideo_pos;
+ PLOT_TYPE *pvideo_limit;
+ nsfb_colour_t abpixel; /* alphablended pixel */
+ int xloop;
+ int xoff, yoff; /* x and y offset into image */
+ int xlim;
+ int t;
+ int x = loc->x0;
+ int y = loc->y0;
+ int width = loc->x1 - loc->x0;
+ int height = loc->y1 - loc->y0;
+ nsfb_bbox_t clipped; /* clipped display */
+
+ if (width == 0 || height == 0)
+ return true;
+
+ /* The part of the image actually displayed is cropped to the
+ * current context. */
+ clipped.x0 = x;
+ clipped.y0 = y;
+ clipped.x1 = x + width * tiles_x;
+ clipped.y1 = y + height;
+
+ if (!nsfb_plot_clip_ctx(nsfb, &clipped))
+ return true;
+
+ if (height > (clipped.y1 - clipped.y0))
+ height = (clipped.y1 - clipped.y0);
+
+ pvideo = get_xy_loc(nsfb, clipped.x0, clipped.y0);
+ pvideo_limit = pvideo + PLOT_LINELEN(nsfb->linelen) * height;
+
+ xoff = clipped.x0 - x;
+ xlim = width - (x + width * tiles_x - clipped.x1);
+ yoff = (clipped.y0 - y) * bmp_stride;
+
+ /* plot the image */
+ if (alpha) {
+ for (; pvideo < pvideo_limit;
+ pvideo += PLOT_LINELEN(nsfb->linelen)) {
+ pvideo_pos = pvideo;
+ for (t = 0; t < 1; t++) {
+ for (xloop = xoff; xloop < width; xloop++) {
+ abpixel = pixel[yoff + xloop];
+ if ((abpixel & 0xFF000000) != 0) {
+ /* pixel is not transparent;
+ * have to plot something */
+ if ((abpixel & 0xFF000000) !=
+ 0xFF000000) {
+ /* pixel is not opaque;
+ * need to blend */
+ abpixel =
+ nsfb_plot_ablend(
+ abpixel,
+ pixel_to_colour(
+ nsfb,
+ *(pvideo +
+ xloop - xoff)));
+ }
+ *(pvideo + xloop - xoff) =
+ colour_to_pixel(
+ nsfb, abpixel);
+ }
+ }
+ }
+ pvideo_pos += width - xoff;
+ for (; t < tiles_x - 1; t++) {
+ for (xloop = 0; xloop < width; xloop++) {
+ abpixel = pixel[yoff + xloop];
+ if ((abpixel & 0xFF000000) != 0) {
+ /* pixel is not transparent;
+ * have to plot something */
+ if ((abpixel & 0xFF000000) !=
+ 0xFF000000) {
+ /* pixel is not opaque;
+ * need to blend */
+ abpixel =
+ nsfb_plot_ablend(
+ abpixel,
+ pixel_to_colour(
+ nsfb,
+ *(pvideo_pos +
+ xloop)));
+ }
+ *(pvideo_pos + xloop) =
+ colour_to_pixel(
+ nsfb, abpixel);
+ }
+ }
+ pvideo_pos += width;
+ }
+ for (; t < tiles_x; t++) {
+ for (xloop = 0; xloop < xlim; xloop++) {
+ abpixel = pixel[yoff + xloop];
+ if ((abpixel & 0xFF000000) != 0) {
+ /* pixel is not transparent;
+ * have to plot something */
+ if ((abpixel & 0xFF000000) !=
+ 0xFF000000) {
+ /* pixel is not opaque;
+ * need to blend */
+ abpixel =
+ nsfb_plot_ablend(
+ abpixel,
+ pixel_to_colour(
+ nsfb,
+ *(pvideo_pos +
+ xloop)));
+ }
+ *(pvideo_pos + xloop) =
+ colour_to_pixel(
+ nsfb, abpixel);
+ }
+ }
+ }
+ yoff += bmp_stride;
+ }
+ } else {
+ for (; pvideo < pvideo_limit;
+ pvideo += PLOT_LINELEN(nsfb->linelen)) {
+ pvideo_pos = pvideo;
+ for (t = 0; t < 1; t++) {
+ for (xloop = xoff; xloop < width; xloop++) {
+ abpixel = pixel[yoff + xloop];
+ *(pvideo + xloop - xoff) =
+ colour_to_pixel(
+ nsfb,
+ abpixel);
+ }
+ }
+ pvideo_pos += width - xoff;
+ for (; t < tiles_x - 1; t++) {
+ for (xloop = 0; xloop < width; xloop++) {
+ abpixel = pixel[yoff + xloop];
+ *(pvideo_pos + xloop) =
+ colour_to_pixel(
+ nsfb,
+ abpixel);
+ }
+ pvideo_pos += width;
+ }
+ for (; t < tiles_x; t++) {
+ for (xloop = 0; xloop < xlim; xloop++) {
+ abpixel = pixel[yoff + xloop];
+ *(pvideo_pos + xloop) =
+ colour_to_pixel(
+ nsfb,
+ abpixel);
+ }
+ }
+ yoff += bmp_stride;
+ }
+ }
+
+ return true;
+}
+
static bool
bitmap_tiles(nsfb_t *nsfb,
const nsfb_bbox_t *loc,
@@ -507,7 +675,9 @@ bitmap_tiles(nsfb_t *nsfb,
int tx, ty;
int width = loc->x1 - loc->x0;
int height = loc->y1 - loc->y0;
+ int skip = 0;
bool ok = true;
+ bool scaled = (width != bmp_width) || (height != bmp_height);
bool set_dither = false; /* true iff we enabled dithering here */
/* Avoid pointless rendering */
@@ -523,8 +693,8 @@ bitmap_tiles(nsfb_t *nsfb,
return true;
/* Enable error diffusion for paletted screens, if not already on,
- * if not repeating in x direction */
- if (tiles_x == 1 && nsfb->palette != NULL &&
+ * if not scaled or if not repeating in x direction */
+ if ((!scaled || tiles_x == 1) && nsfb->palette != NULL &&
nsfb_palette_dithering_on(nsfb->palette) == false) {
nsfb_palette_dither_init(nsfb->palette,
render_area.x1 - render_area.x0);
@@ -534,7 +704,19 @@ bitmap_tiles(nsfb_t *nsfb,
/* Given tile location is top left; start with that one. */
tloc = *loc;
- if (width != bmp_width || height != bmp_height) {
+ if (render_area.x0 - tloc.x0 > width) {
+ skip = (render_area.x0 - tloc.x0) / width;
+ tiles_x -= skip;
+ skip *= width;
+ tloc.x0 += skip;
+ tloc.x1 += skip;
+ }
+
+ if (tloc.x1 - render_area.x1 > width) {
+ tiles_x -= (tloc.x1 - render_area.x1) / width;
+ }
+
+ if (scaled) {
/* Scaled */
for (ty = 0; ty < tiles_y; ty++) {
for (tx = 0; tx < tiles_x; tx++) {
@@ -551,18 +733,28 @@ bitmap_tiles(nsfb_t *nsfb,
}
} else {
/* Unscaled */
- for (ty = 0; ty < tiles_y; ty++) {
- for (tx = 0; tx < tiles_x; tx++) {
- ok &= bitmap(nsfb, &tloc, pixel,
- bmp_width, bmp_height,
+ if (tiles_x != 1) {
+ for (ty = 0; ty < tiles_y; ty++) {
+ ok &= bitmap_tiles_x(nsfb, &tloc, tiles_x,
+ pixel, bmp_width, bmp_height,
bmp_stride, alpha);
- tloc.x0 += width;
- tloc.x1 += width;
+ tloc.y0 += height;
+ tloc.y1 += height;
+ }
+ } else if (tiles_x == 1) {
+ for (ty = 0; ty < tiles_y; ty++) {
+ for (tx = 0; tx < tiles_x; tx++) {
+ ok &= bitmap(nsfb, &tloc, pixel,
+ bmp_width, bmp_height,
+ bmp_stride, alpha);
+ tloc.x0 += width;
+ tloc.x1 += width;
+ }
+ tloc.x0 = loc->x0 + skip;
+ tloc.y0 += height;
+ tloc.x1 = loc->x1 + skip;
+ tloc.y1 += height;
}
- tloc.x0 = loc->x0;
- tloc.y0 += height;
- tloc.x1 = loc->x1;
- tloc.y1 += height;
}
}
--
NetSurf Framebuffer library
9 years, 10 months
libnsfb: branch master updated. release/0.1.0-12-g394336f
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libnsfb.git/shortlog/394336f6112468bf106ef...
...commit http://git.netsurf-browser.org/libnsfb.git/commit/394336f6112468bf106ef28...
...tree http://git.netsurf-browser.org/libnsfb.git/tree/394336f6112468bf106ef2885...
The branch, master has been updated
via 394336f6112468bf106ef2885bf528e25ded41ef (commit)
via 4694cd4f5c1dc6d3cac3eee8c13c35f6394f6036 (commit)
via 06881b9f188aad6b2e928ac284fd5d0ac33d9b0d (commit)
from 5c62d4740b6691ad0cd05863da47ec92e5f0cd7f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libnsfb.git/commit/?id=394336f6112468bf106...
commit 394336f6112468bf106ef2885bf528e25ded41ef
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Only memset as much of the error diffusion buffer as is required.
diff --git a/src/palette.c b/src/palette.c
index 1a24127..558ba28 100644
--- a/src/palette.c
+++ b/src/palette.c
@@ -54,10 +54,11 @@ void nsfb_palette_free(struct nsfb_palette_s *palette)
/** Init error diffusion for a plot. */
void nsfb_palette_dither_init(struct nsfb_palette_s *palette, int width)
{
+ width *= 3;
palette->dither = true;
- memset(palette->dither_ctx.data, 0, palette->dither_ctx.data_len);
- palette->dither_ctx.width = width * 3;
palette->dither_ctx.current = 0;
+ palette->dither_ctx.width = width;
+ memset(palette->dither_ctx.data, 0, width * sizeof(int));
}
/** Finalise error diffusion after a plot. */
commitdiff http://git.netsurf-browser.org/libnsfb.git/commit/?id=4694cd4f5c1dc6d3cac...
commit 4694cd4f5c1dc6d3cac3eee8c13c35f6394f6036
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Set unused param in SDL_Color struct, to avoid valgrind uninitialised values from within SDL_BlitSurface.
diff --git a/src/surface/sdl.c b/src/surface/sdl.c
index 48052a8..82e36f8 100644
--- a/src/surface/sdl.c
+++ b/src/surface/sdl.c
@@ -363,6 +363,7 @@ set_palette(nsfb_t *nsfb)
palette[loop].r = (nsfb->palette->data[loop] ) & 0xFF;
palette[loop].g = (nsfb->palette->data[loop] >> 8) & 0xFF;
palette[loop].b = (nsfb->palette->data[loop] >> 16) & 0xFF;
+ palette[loop].unused = 0; /* Suppress valgrind uninitialised values */
}
/* Set SDL palette */
commitdiff http://git.netsurf-browser.org/libnsfb.git/commit/?id=06881b9f188aad6b2e9...
commit 06881b9f188aad6b2e928ac284fd5d0ac33d9b0d
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Fix 1x1 area scaled plot optimisation.
diff --git a/src/plot/api.c b/src/plot/api.c
index ba6afc8..1746d2e 100644
--- a/src/plot/api.c
+++ b/src/plot/api.c
@@ -155,7 +155,7 @@ nsfb_plot_copy(nsfb_t *srcfb,
return true;
/* completely opaque pixels can be replaced with fill */
- if ((srccol & 0xff000000) == 0xff)
+ if ((srccol & 0xff000000) == 0xff000000)
return dstfb->plotter_fns->fill(dstfb, dstbox, srccol);
}
-----------------------------------------------------------------------
Summary of changes:
src/palette.c | 5 +++--
src/plot/api.c | 2 +-
src/surface/sdl.c | 1 +
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/palette.c b/src/palette.c
index 1a24127..558ba28 100644
--- a/src/palette.c
+++ b/src/palette.c
@@ -54,10 +54,11 @@ void nsfb_palette_free(struct nsfb_palette_s *palette)
/** Init error diffusion for a plot. */
void nsfb_palette_dither_init(struct nsfb_palette_s *palette, int width)
{
+ width *= 3;
palette->dither = true;
- memset(palette->dither_ctx.data, 0, palette->dither_ctx.data_len);
- palette->dither_ctx.width = width * 3;
palette->dither_ctx.current = 0;
+ palette->dither_ctx.width = width;
+ memset(palette->dither_ctx.data, 0, width * sizeof(int));
}
/** Finalise error diffusion after a plot. */
diff --git a/src/plot/api.c b/src/plot/api.c
index ba6afc8..1746d2e 100644
--- a/src/plot/api.c
+++ b/src/plot/api.c
@@ -155,7 +155,7 @@ nsfb_plot_copy(nsfb_t *srcfb,
return true;
/* completely opaque pixels can be replaced with fill */
- if ((srccol & 0xff000000) == 0xff)
+ if ((srccol & 0xff000000) == 0xff000000)
return dstfb->plotter_fns->fill(dstfb, dstbox, srccol);
}
diff --git a/src/surface/sdl.c b/src/surface/sdl.c
index 48052a8..82e36f8 100644
--- a/src/surface/sdl.c
+++ b/src/surface/sdl.c
@@ -363,6 +363,7 @@ set_palette(nsfb_t *nsfb)
palette[loop].r = (nsfb->palette->data[loop] ) & 0xFF;
palette[loop].g = (nsfb->palette->data[loop] >> 8) & 0xFF;
palette[loop].b = (nsfb->palette->data[loop] >> 16) & 0xFF;
+ palette[loop].unused = 0; /* Suppress valgrind uninitialised values */
}
/* Set SDL palette */
--
NetSurf Framebuffer library
9 years, 10 months
netsurf: branch master updated. release/3.0-696-g6ca908a
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/6ca908a192427f2269b77...
...commit http://git.netsurf-browser.org/netsurf.git/commit/6ca908a192427f2269b778d...
...tree http://git.netsurf-browser.org/netsurf.git/tree/6ca908a192427f2269b778d6f...
The branch, master has been updated
via 6ca908a192427f2269b778d6f2b4be72656378e3 (commit)
from b50743a2538b95c172999796d9b6ebae0538673c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=6ca908a192427f2269b...
commit 6ca908a192427f2269b778d6f2b4be72656378e3
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Use libnsfb's tiled bitmap function, instead of tiling ourselves.
diff --git a/framebuffer/framebuffer.c b/framebuffer/framebuffer.c
index da80a13..c2d73ac 100644
--- a/framebuffer/framebuffer.c
+++ b/framebuffer/framebuffer.c
@@ -172,13 +172,14 @@ framebuffer_plot_bitmap(int x, int y,
struct bitmap *bitmap, colour bg,
bitmap_flags_t flags)
{
- int xf,yf;
nsfb_bbox_t loc;
nsfb_bbox_t clipbox;
bool repeat_x = (flags & BITMAPF_REPEAT_X);
bool repeat_y = (flags & BITMAPF_REPEAT_Y);
int bmwidth;
int bmheight;
+ int bmstride;
+ enum nsfb_format_e bmformat;
unsigned char *bmptr;
nsfb_t *bm = (nsfb_t *)bitmap;
@@ -199,8 +200,8 @@ framebuffer_plot_bitmap(int x, int y,
}
nsfb_plot_get_clip(nsfb, &clipbox);
- nsfb_get_geometry(bm, &bmwidth, &bmheight, NULL);
- nsfb_get_buffer(bm, &bmptr, NULL);
+ nsfb_get_geometry(bm, &bmwidth, &bmheight, &bmformat);
+ nsfb_get_buffer(bm, &bmptr, &bmstride);
/* Optimise tiled plots of 1x1 bitmaps by replacing with a flat fill
* of the area. Can only be done when image is fully opaque. */
@@ -231,23 +232,19 @@ framebuffer_plot_bitmap(int x, int y,
if (repeat_y)
for (; y > clipbox.y0; y -= height);
- /* tile down and across to extents */
- for (xf = x; xf < clipbox.x1; xf += width) {
- for (yf = y; yf < clipbox.y1; yf += height) {
-
- loc.x0 = xf;
- loc.y0 = yf;
- loc.x1 = loc.x0 + width;
- loc.y1 = loc.y0 + height;
+ /* set up top left tile location */
+ loc.x0 = x;
+ loc.y0 = y;
+ loc.x1 = loc.x0 + width;
+ loc.y1 = loc.y0 + height;
- nsfb_plot_copy(bm, NULL, nsfb, &loc);
+ /* plot tiling across and down to extents */
+ nsfb_plot_bitmap_tiles(nsfb, &loc,
+ repeat_x ? ((clipbox.x1 - x) + width - 1) / width : 1,
+ repeat_y ? ((clipbox.y1 - y) + height - 1) / height : 1,
+ (nsfb_colour_t *)bmptr, bmwidth, bmheight,
+ bmstride * 8 / 32, bmformat == NSFB_FMT_ABGR8888);
- if (!repeat_y)
- break;
- }
- if (!repeat_x)
- break;
- }
return true;
}
-----------------------------------------------------------------------
Summary of changes:
framebuffer/framebuffer.c | 33 +++++++++++++++------------------
1 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/framebuffer/framebuffer.c b/framebuffer/framebuffer.c
index da80a13..c2d73ac 100644
--- a/framebuffer/framebuffer.c
+++ b/framebuffer/framebuffer.c
@@ -172,13 +172,14 @@ framebuffer_plot_bitmap(int x, int y,
struct bitmap *bitmap, colour bg,
bitmap_flags_t flags)
{
- int xf,yf;
nsfb_bbox_t loc;
nsfb_bbox_t clipbox;
bool repeat_x = (flags & BITMAPF_REPEAT_X);
bool repeat_y = (flags & BITMAPF_REPEAT_Y);
int bmwidth;
int bmheight;
+ int bmstride;
+ enum nsfb_format_e bmformat;
unsigned char *bmptr;
nsfb_t *bm = (nsfb_t *)bitmap;
@@ -199,8 +200,8 @@ framebuffer_plot_bitmap(int x, int y,
}
nsfb_plot_get_clip(nsfb, &clipbox);
- nsfb_get_geometry(bm, &bmwidth, &bmheight, NULL);
- nsfb_get_buffer(bm, &bmptr, NULL);
+ nsfb_get_geometry(bm, &bmwidth, &bmheight, &bmformat);
+ nsfb_get_buffer(bm, &bmptr, &bmstride);
/* Optimise tiled plots of 1x1 bitmaps by replacing with a flat fill
* of the area. Can only be done when image is fully opaque. */
@@ -231,23 +232,19 @@ framebuffer_plot_bitmap(int x, int y,
if (repeat_y)
for (; y > clipbox.y0; y -= height);
- /* tile down and across to extents */
- for (xf = x; xf < clipbox.x1; xf += width) {
- for (yf = y; yf < clipbox.y1; yf += height) {
-
- loc.x0 = xf;
- loc.y0 = yf;
- loc.x1 = loc.x0 + width;
- loc.y1 = loc.y0 + height;
+ /* set up top left tile location */
+ loc.x0 = x;
+ loc.y0 = y;
+ loc.x1 = loc.x0 + width;
+ loc.y1 = loc.y0 + height;
- nsfb_plot_copy(bm, NULL, nsfb, &loc);
+ /* plot tiling across and down to extents */
+ nsfb_plot_bitmap_tiles(nsfb, &loc,
+ repeat_x ? ((clipbox.x1 - x) + width - 1) / width : 1,
+ repeat_y ? ((clipbox.y1 - y) + height - 1) / height : 1,
+ (nsfb_colour_t *)bmptr, bmwidth, bmheight,
+ bmstride * 8 / 32, bmformat == NSFB_FMT_ABGR8888);
- if (!repeat_y)
- break;
- }
- if (!repeat_x)
- break;
- }
return true;
}
--
NetSurf Browser
9 years, 11 months
libnsfb: branch master updated. release/0.1.0-9-g5c62d47
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libnsfb.git/shortlog/5c62d4740b6691ad0cd05...
...commit http://git.netsurf-browser.org/libnsfb.git/commit/5c62d4740b6691ad0cd0586...
...tree http://git.netsurf-browser.org/libnsfb.git/tree/5c62d4740b6691ad0cd05863d...
The branch, master has been updated
via 5c62d4740b6691ad0cd05863da47ec92e5f0cd7f (commit)
via 35df6a39826009e8dd7ec9d2724afcdca5789e10 (commit)
from 23ec9ceb5bb32a5348f8491243d41a14564c71f5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libnsfb.git/commit/?id=5c62d4740b6691ad0cd...
commit 5c62d4740b6691ad0cd05863da47ec92e5f0cd7f
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Add tiled bitmap plotting function.
diff --git a/include/libnsfb_plot.h b/include/libnsfb_plot.h
index b3f86d1..a563e2c 100644
--- a/include/libnsfb_plot.h
+++ b/include/libnsfb_plot.h
@@ -154,6 +154,10 @@ bool nsfb_plot_copy(nsfb_t *srcfb, nsfb_bbox_t *srcbox, nsfb_t *dstfb, nsfb_bbox
*/
bool nsfb_plot_bitmap(nsfb_t *nsfb, const nsfb_bbox_t *loc, const nsfb_colour_t *pixel, int bmp_width, int bmp_height, int bmp_stride, bool alpha);
+/** Plot bitmap.
+ */
+bool nsfb_plot_bitmap_tiles(nsfb_t *nsfb, const nsfb_bbox_t *loc, int tiles_x, int tiles_y, const nsfb_colour_t *pixel, int bmp_width, int bmp_height, int bmp_stride, bool alpha);
+
/** Plot an 8 bit glyph.
*/
bool nsfb_plot_glyph8(nsfb_t *nsfb, nsfb_bbox_t *loc, const uint8_t *pixel, int pitch, nsfb_colour_t c);
diff --git a/include/plot.h b/include/plot.h
index 38bed61..4b1545d 100644
--- a/include/plot.h
+++ b/include/plot.h
@@ -61,6 +61,10 @@ typedef bool (nsfb_plotfn_ellipse_fill_t)(nsfb_t *nsfb, nsfb_bbox_t *ellipse, ns
*/
typedef bool (nsfb_plotfn_bitmap_t)(nsfb_t *nsfb, const nsfb_bbox_t *loc, const nsfb_colour_t *pixel, int bmp_width, int bmp_height, int bmp_stride, bool alpha);
+/** Plot tiled bitmap
+ */
+typedef bool (nsfb_plotfn_bitmap_tiles_t)(nsfb_t *nsfb, const nsfb_bbox_t *loc, int tiles_x, int tiles_y, const nsfb_colour_t *pixel, int bmp_width, int bmp_height, int bmp_stride, bool alpha);
+
/** Copy an area of screen
*
@@ -108,6 +112,7 @@ typedef struct nsfb_plotter_fns_s {
nsfb_plotfn_ellipse_fill_t *ellipse_fill;
nsfb_plotfn_arc_t *arc;
nsfb_plotfn_bitmap_t *bitmap;
+ nsfb_plotfn_bitmap_tiles_t *bitmap_tiles;
nsfb_plotfn_point_t *point;
nsfb_plotfn_copy_t *copy;
nsfb_plotfn_glyph8_t *glyph8;
diff --git a/src/plot/16bpp.c b/src/plot/16bpp.c
index d629944..4f9134f 100644
--- a/src/plot/16bpp.c
+++ b/src/plot/16bpp.c
@@ -114,6 +114,7 @@ const nsfb_plotter_fns_t _nsfb_16bpp_plotters = {
.fill = fill,
.point = point,
.bitmap = bitmap,
+ .bitmap_tiles = bitmap_tiles,
.glyph8 = glyph8,
.glyph1 = glyph1,
.readrect = readrect,
diff --git a/src/plot/24bpp.c b/src/plot/24bpp.c
index 0fa53e9..dc67f04 100644
--- a/src/plot/24bpp.c
+++ b/src/plot/24bpp.c
@@ -430,6 +430,7 @@ const nsfb_plotter_fns_t _nsfb_24bpp_plotters = {
.fill = fill,
.point = point,
.bitmap = bitmap,
+ .bitmap_tiles = bitmap_tiles,
.glyph8 = glyph8,
.glyph1 = glyph1,
.readrect = readrect,
diff --git a/src/plot/32bpp-xbgr8888.c b/src/plot/32bpp-xbgr8888.c
index 9050903..4c19688 100644
--- a/src/plot/32bpp-xbgr8888.c
+++ b/src/plot/32bpp-xbgr8888.c
@@ -62,6 +62,7 @@ const nsfb_plotter_fns_t _nsfb_32bpp_xbgr8888_plotters = {
.fill = fill,
.point = point,
.bitmap = bitmap,
+ .bitmap_tiles = bitmap_tiles,
.glyph8 = glyph8,
.glyph1 = glyph1,
.readrect = readrect,
diff --git a/src/plot/32bpp-xrgb8888.c b/src/plot/32bpp-xrgb8888.c
index 548c970..9b3d551 100644
--- a/src/plot/32bpp-xrgb8888.c
+++ b/src/plot/32bpp-xrgb8888.c
@@ -62,6 +62,7 @@ const nsfb_plotter_fns_t _nsfb_32bpp_xrgb8888_plotters = {
.fill = fill,
.point = point,
.bitmap = bitmap,
+ .bitmap_tiles = bitmap_tiles,
.glyph8 = glyph8,
.glyph1 = glyph1,
.readrect = readrect,
diff --git a/src/plot/8bpp.c b/src/plot/8bpp.c
index 0245542..4fef119 100644
--- a/src/plot/8bpp.c
+++ b/src/plot/8bpp.c
@@ -73,6 +73,7 @@ const nsfb_plotter_fns_t _nsfb_8bpp_plotters = {
.fill = fill,
.point = point,
.bitmap = bitmap,
+ .bitmap_tiles = bitmap_tiles,
.glyph8 = glyph8,
.glyph1 = glyph1,
.readrect = readrect,
diff --git a/src/plot/api.c b/src/plot/api.c
index 2b5b974..ba6afc8 100644
--- a/src/plot/api.c
+++ b/src/plot/api.c
@@ -165,7 +165,12 @@ nsfb_plot_copy(nsfb_t *srcfb,
bool nsfb_plot_bitmap(nsfb_t *nsfb, const nsfb_bbox_t *loc, const nsfb_colour_t *pixel, int bmp_width, int bmp_height, int bmp_stride, bool alpha)
{
- return nsfb->plotter_fns->bitmap(nsfb, loc, pixel, bmp_width, bmp_height, bmp_stride, alpha);
+ return nsfb->plotter_fns->bitmap(nsfb, loc, pixel, bmp_width, bmp_height, bmp_stride, alpha);
+}
+
+bool nsfb_plot_bitmap_tiles(nsfb_t *nsfb, const nsfb_bbox_t *loc, int tiles_x, int tiles_y, const nsfb_colour_t *pixel, int bmp_width, int bmp_height, int bmp_stride, bool alpha)
+{
+ return nsfb->plotter_fns->bitmap_tiles(nsfb, loc, tiles_x, tiles_y, pixel, bmp_width, bmp_height, bmp_stride, alpha);
}
/** Plot an 8 bit glyph.
diff --git a/src/plot/common.c b/src/plot/common.c
index 998e3a6..e1f4a7a 100644
--- a/src/plot/common.c
+++ b/src/plot/common.c
@@ -491,6 +491,88 @@ bitmap(nsfb_t *nsfb,
return true;
}
+static bool
+bitmap_tiles(nsfb_t *nsfb,
+ const nsfb_bbox_t *loc,
+ int tiles_x,
+ int tiles_y,
+ const nsfb_colour_t *pixel,
+ int bmp_width,
+ int bmp_height,
+ int bmp_stride,
+ bool alpha)
+{
+ nsfb_bbox_t render_area;
+ nsfb_bbox_t tloc;
+ int tx, ty;
+ int width = loc->x1 - loc->x0;
+ int height = loc->y1 - loc->y0;
+ bool ok = true;
+ bool set_dither = false; /* true iff we enabled dithering here */
+
+ /* Avoid pointless rendering */
+ if (width == 0 || height == 0)
+ return true;
+
+ render_area.x0 = loc->x0;
+ render_area.y0 = loc->y0;
+ render_area.x1 = loc->x0 + width * tiles_x;
+ render_area.y1 = loc->y0 + height * tiles_y;
+
+ if (!nsfb_plot_clip_ctx(nsfb, &render_area))
+ return true;
+
+ /* Enable error diffusion for paletted screens, if not already on,
+ * if not repeating in x direction */
+ if (tiles_x == 1 && nsfb->palette != NULL &&
+ nsfb_palette_dithering_on(nsfb->palette) == false) {
+ nsfb_palette_dither_init(nsfb->palette,
+ render_area.x1 - render_area.x0);
+ set_dither = true;
+ }
+
+ /* Given tile location is top left; start with that one. */
+ tloc = *loc;
+
+ if (width != bmp_width || height != bmp_height) {
+ /* Scaled */
+ for (ty = 0; ty < tiles_y; ty++) {
+ for (tx = 0; tx < tiles_x; tx++) {
+ ok &= bitmap_scaled(nsfb, &tloc, pixel,
+ bmp_width, bmp_height,
+ bmp_stride, alpha);
+ tloc.x0 += width;
+ tloc.x1 += width;
+ }
+ tloc.x0 = loc->x0;
+ tloc.y0 += height;
+ tloc.x1 = loc->x1;
+ tloc.y1 += height;
+ }
+ } else {
+ /* Unscaled */
+ for (ty = 0; ty < tiles_y; ty++) {
+ for (tx = 0; tx < tiles_x; tx++) {
+ ok &= bitmap(nsfb, &tloc, pixel,
+ bmp_width, bmp_height,
+ bmp_stride, alpha);
+ tloc.x0 += width;
+ tloc.x1 += width;
+ }
+ tloc.x0 = loc->x0;
+ tloc.y0 += height;
+ tloc.x1 = loc->x1;
+ tloc.y1 += height;
+ }
+ }
+
+ if (set_dither) {
+ nsfb_palette_dither_fini(nsfb->palette);
+ }
+
+ return ok;
+}
+
static bool readrect(nsfb_t *nsfb, nsfb_bbox_t *rect, nsfb_colour_t *buffer)
{
PLOT_TYPE *pvideo;
commitdiff http://git.netsurf-browser.org/libnsfb.git/commit/?id=35df6a39826009e8dd7...
commit 35df6a39826009e8dd7ec9d2724afcdca5789e10
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Test if we're dithering already before turning it on. (No functional change atm, but when bitmap tiling is moved into nsfb, error diffusion will be able to cross tile boundaries.)
diff --git a/include/palette.h b/include/palette.h
index a4b9f77..04bdd4f 100644
--- a/include/palette.h
+++ b/include/palette.h
@@ -28,7 +28,7 @@ struct nsfb_palette_s {
uint8_t last; /**< Last used palette index */
nsfb_colour_t data[256]; /**< Palette for index modes */
- bool dither; /**< Whether to use error diffusion */
+ bool dither; /**< Whether error diffusion was requested */
struct {
int width; /**< Length of error value buffer ring*/
int current; /**< Current pos in ring buffer*/
@@ -53,6 +53,11 @@ void nsfb_palette_dither_fini(struct nsfb_palette_s *palette);
/** Generate libnsfb 8bpp default palette. */
void nsfb_palette_generate_nsfb_8bpp(struct nsfb_palette_s *palette);
+static inline bool nsfb_palette_dithering_on(struct nsfb_palette_s *palette)
+{
+ return palette->dither;
+}
+
/** Find best palette match for given colour. */
static inline uint8_t nsfb_palette_best_match(struct nsfb_palette_s *palette,
nsfb_colour_t c, int *r_error, int *g_error, int *b_error)
diff --git a/src/plot/common.c b/src/plot/common.c
index f8c4a70..998e3a6 100644
--- a/src/plot/common.c
+++ b/src/plot/common.c
@@ -249,6 +249,7 @@ static bool bitmap_scaled(nsfb_t *nsfb, const nsfb_bbox_t *loc,
int dxr, dyr; /* scale factor (remainder) */
int rx, ry, rxs; /* remainder trackers */
nsfb_bbox_t clipped; /* clipped display */
+ bool set_dither = false; /* true iff we enabled dithering here */
/* The part of the scaled image actually displayed is cropped to the
* current context. */
@@ -272,8 +273,11 @@ static bool bitmap_scaled(nsfb_t *nsfb, const nsfb_bbox_t *loc,
else
rwidth = width;
- if (nsfb->palette != NULL) {
+ /* Enable error diffusion for paletted screens, if not already on */
+ if (nsfb->palette != NULL &&
+ nsfb_palette_dithering_on(nsfb->palette) == false) {
nsfb_palette_dither_init(nsfb->palette, rwidth);
+ set_dither = true;
}
/* get veritcal (y) and horizontal (x) scale factors; both integer
@@ -379,7 +383,7 @@ static bool bitmap_scaled(nsfb_t *nsfb, const nsfb_bbox_t *loc,
}
}
- if (nsfb->palette != NULL) {
+ if (set_dither) {
nsfb_palette_dither_fini(nsfb->palette);
}
@@ -404,6 +408,7 @@ bitmap(nsfb_t *nsfb,
int width = loc->x1 - loc->x0;
int height = loc->y1 - loc->y0;
nsfb_bbox_t clipped; /* clipped display */
+ bool set_dither = false; /* true iff we enabled dithering here */
if (width == 0 || height == 0)
return true;
@@ -429,9 +434,12 @@ bitmap(nsfb_t *nsfb,
if (width > (clipped.x1 - clipped.x0))
width = (clipped.x1 - clipped.x0);
- if (nsfb->palette != NULL) {
- nsfb_palette_dither_init(nsfb->palette, width);
- }
+ /* Enable error diffusion for paletted screens, if not already on */
+ if (nsfb->palette != NULL &&
+ nsfb_palette_dithering_on(nsfb->palette) == false) {
+ nsfb_palette_dither_init(nsfb->palette, width);
+ set_dither = true;
+ }
xoff = clipped.x0 - x;
yoff = (clipped.y0 - y) * bmp_stride;
@@ -476,7 +484,7 @@ bitmap(nsfb_t *nsfb,
}
}
- if (nsfb->palette != NULL) {
+ if (set_dither) {
nsfb_palette_dither_fini(nsfb->palette);
}
-----------------------------------------------------------------------
Summary of changes:
include/libnsfb_plot.h | 4 ++
include/palette.h | 7 +++-
include/plot.h | 5 ++
src/plot/16bpp.c | 1 +
src/plot/24bpp.c | 1 +
src/plot/32bpp-xbgr8888.c | 1 +
src/plot/32bpp-xrgb8888.c | 1 +
src/plot/8bpp.c | 1 +
src/plot/api.c | 7 +++-
src/plot/common.c | 102 ++++++++++++++++++++++++++++++++++++++++++---
10 files changed, 122 insertions(+), 8 deletions(-)
diff --git a/include/libnsfb_plot.h b/include/libnsfb_plot.h
index b3f86d1..a563e2c 100644
--- a/include/libnsfb_plot.h
+++ b/include/libnsfb_plot.h
@@ -154,6 +154,10 @@ bool nsfb_plot_copy(nsfb_t *srcfb, nsfb_bbox_t *srcbox, nsfb_t *dstfb, nsfb_bbox
*/
bool nsfb_plot_bitmap(nsfb_t *nsfb, const nsfb_bbox_t *loc, const nsfb_colour_t *pixel, int bmp_width, int bmp_height, int bmp_stride, bool alpha);
+/** Plot bitmap.
+ */
+bool nsfb_plot_bitmap_tiles(nsfb_t *nsfb, const nsfb_bbox_t *loc, int tiles_x, int tiles_y, const nsfb_colour_t *pixel, int bmp_width, int bmp_height, int bmp_stride, bool alpha);
+
/** Plot an 8 bit glyph.
*/
bool nsfb_plot_glyph8(nsfb_t *nsfb, nsfb_bbox_t *loc, const uint8_t *pixel, int pitch, nsfb_colour_t c);
diff --git a/include/palette.h b/include/palette.h
index a4b9f77..04bdd4f 100644
--- a/include/palette.h
+++ b/include/palette.h
@@ -28,7 +28,7 @@ struct nsfb_palette_s {
uint8_t last; /**< Last used palette index */
nsfb_colour_t data[256]; /**< Palette for index modes */
- bool dither; /**< Whether to use error diffusion */
+ bool dither; /**< Whether error diffusion was requested */
struct {
int width; /**< Length of error value buffer ring*/
int current; /**< Current pos in ring buffer*/
@@ -53,6 +53,11 @@ void nsfb_palette_dither_fini(struct nsfb_palette_s *palette);
/** Generate libnsfb 8bpp default palette. */
void nsfb_palette_generate_nsfb_8bpp(struct nsfb_palette_s *palette);
+static inline bool nsfb_palette_dithering_on(struct nsfb_palette_s *palette)
+{
+ return palette->dither;
+}
+
/** Find best palette match for given colour. */
static inline uint8_t nsfb_palette_best_match(struct nsfb_palette_s *palette,
nsfb_colour_t c, int *r_error, int *g_error, int *b_error)
diff --git a/include/plot.h b/include/plot.h
index 38bed61..4b1545d 100644
--- a/include/plot.h
+++ b/include/plot.h
@@ -61,6 +61,10 @@ typedef bool (nsfb_plotfn_ellipse_fill_t)(nsfb_t *nsfb, nsfb_bbox_t *ellipse, ns
*/
typedef bool (nsfb_plotfn_bitmap_t)(nsfb_t *nsfb, const nsfb_bbox_t *loc, const nsfb_colour_t *pixel, int bmp_width, int bmp_height, int bmp_stride, bool alpha);
+/** Plot tiled bitmap
+ */
+typedef bool (nsfb_plotfn_bitmap_tiles_t)(nsfb_t *nsfb, const nsfb_bbox_t *loc, int tiles_x, int tiles_y, const nsfb_colour_t *pixel, int bmp_width, int bmp_height, int bmp_stride, bool alpha);
+
/** Copy an area of screen
*
@@ -108,6 +112,7 @@ typedef struct nsfb_plotter_fns_s {
nsfb_plotfn_ellipse_fill_t *ellipse_fill;
nsfb_plotfn_arc_t *arc;
nsfb_plotfn_bitmap_t *bitmap;
+ nsfb_plotfn_bitmap_tiles_t *bitmap_tiles;
nsfb_plotfn_point_t *point;
nsfb_plotfn_copy_t *copy;
nsfb_plotfn_glyph8_t *glyph8;
diff --git a/src/plot/16bpp.c b/src/plot/16bpp.c
index d629944..4f9134f 100644
--- a/src/plot/16bpp.c
+++ b/src/plot/16bpp.c
@@ -114,6 +114,7 @@ const nsfb_plotter_fns_t _nsfb_16bpp_plotters = {
.fill = fill,
.point = point,
.bitmap = bitmap,
+ .bitmap_tiles = bitmap_tiles,
.glyph8 = glyph8,
.glyph1 = glyph1,
.readrect = readrect,
diff --git a/src/plot/24bpp.c b/src/plot/24bpp.c
index 0fa53e9..dc67f04 100644
--- a/src/plot/24bpp.c
+++ b/src/plot/24bpp.c
@@ -430,6 +430,7 @@ const nsfb_plotter_fns_t _nsfb_24bpp_plotters = {
.fill = fill,
.point = point,
.bitmap = bitmap,
+ .bitmap_tiles = bitmap_tiles,
.glyph8 = glyph8,
.glyph1 = glyph1,
.readrect = readrect,
diff --git a/src/plot/32bpp-xbgr8888.c b/src/plot/32bpp-xbgr8888.c
index 9050903..4c19688 100644
--- a/src/plot/32bpp-xbgr8888.c
+++ b/src/plot/32bpp-xbgr8888.c
@@ -62,6 +62,7 @@ const nsfb_plotter_fns_t _nsfb_32bpp_xbgr8888_plotters = {
.fill = fill,
.point = point,
.bitmap = bitmap,
+ .bitmap_tiles = bitmap_tiles,
.glyph8 = glyph8,
.glyph1 = glyph1,
.readrect = readrect,
diff --git a/src/plot/32bpp-xrgb8888.c b/src/plot/32bpp-xrgb8888.c
index 548c970..9b3d551 100644
--- a/src/plot/32bpp-xrgb8888.c
+++ b/src/plot/32bpp-xrgb8888.c
@@ -62,6 +62,7 @@ const nsfb_plotter_fns_t _nsfb_32bpp_xrgb8888_plotters = {
.fill = fill,
.point = point,
.bitmap = bitmap,
+ .bitmap_tiles = bitmap_tiles,
.glyph8 = glyph8,
.glyph1 = glyph1,
.readrect = readrect,
diff --git a/src/plot/8bpp.c b/src/plot/8bpp.c
index 0245542..4fef119 100644
--- a/src/plot/8bpp.c
+++ b/src/plot/8bpp.c
@@ -73,6 +73,7 @@ const nsfb_plotter_fns_t _nsfb_8bpp_plotters = {
.fill = fill,
.point = point,
.bitmap = bitmap,
+ .bitmap_tiles = bitmap_tiles,
.glyph8 = glyph8,
.glyph1 = glyph1,
.readrect = readrect,
diff --git a/src/plot/api.c b/src/plot/api.c
index 2b5b974..ba6afc8 100644
--- a/src/plot/api.c
+++ b/src/plot/api.c
@@ -165,7 +165,12 @@ nsfb_plot_copy(nsfb_t *srcfb,
bool nsfb_plot_bitmap(nsfb_t *nsfb, const nsfb_bbox_t *loc, const nsfb_colour_t *pixel, int bmp_width, int bmp_height, int bmp_stride, bool alpha)
{
- return nsfb->plotter_fns->bitmap(nsfb, loc, pixel, bmp_width, bmp_height, bmp_stride, alpha);
+ return nsfb->plotter_fns->bitmap(nsfb, loc, pixel, bmp_width, bmp_height, bmp_stride, alpha);
+}
+
+bool nsfb_plot_bitmap_tiles(nsfb_t *nsfb, const nsfb_bbox_t *loc, int tiles_x, int tiles_y, const nsfb_colour_t *pixel, int bmp_width, int bmp_height, int bmp_stride, bool alpha)
+{
+ return nsfb->plotter_fns->bitmap_tiles(nsfb, loc, tiles_x, tiles_y, pixel, bmp_width, bmp_height, bmp_stride, alpha);
}
/** Plot an 8 bit glyph.
diff --git a/src/plot/common.c b/src/plot/common.c
index f8c4a70..e1f4a7a 100644
--- a/src/plot/common.c
+++ b/src/plot/common.c
@@ -249,6 +249,7 @@ static bool bitmap_scaled(nsfb_t *nsfb, const nsfb_bbox_t *loc,
int dxr, dyr; /* scale factor (remainder) */
int rx, ry, rxs; /* remainder trackers */
nsfb_bbox_t clipped; /* clipped display */
+ bool set_dither = false; /* true iff we enabled dithering here */
/* The part of the scaled image actually displayed is cropped to the
* current context. */
@@ -272,8 +273,11 @@ static bool bitmap_scaled(nsfb_t *nsfb, const nsfb_bbox_t *loc,
else
rwidth = width;
- if (nsfb->palette != NULL) {
+ /* Enable error diffusion for paletted screens, if not already on */
+ if (nsfb->palette != NULL &&
+ nsfb_palette_dithering_on(nsfb->palette) == false) {
nsfb_palette_dither_init(nsfb->palette, rwidth);
+ set_dither = true;
}
/* get veritcal (y) and horizontal (x) scale factors; both integer
@@ -379,7 +383,7 @@ static bool bitmap_scaled(nsfb_t *nsfb, const nsfb_bbox_t *loc,
}
}
- if (nsfb->palette != NULL) {
+ if (set_dither) {
nsfb_palette_dither_fini(nsfb->palette);
}
@@ -404,6 +408,7 @@ bitmap(nsfb_t *nsfb,
int width = loc->x1 - loc->x0;
int height = loc->y1 - loc->y0;
nsfb_bbox_t clipped; /* clipped display */
+ bool set_dither = false; /* true iff we enabled dithering here */
if (width == 0 || height == 0)
return true;
@@ -429,9 +434,12 @@ bitmap(nsfb_t *nsfb,
if (width > (clipped.x1 - clipped.x0))
width = (clipped.x1 - clipped.x0);
- if (nsfb->palette != NULL) {
- nsfb_palette_dither_init(nsfb->palette, width);
- }
+ /* Enable error diffusion for paletted screens, if not already on */
+ if (nsfb->palette != NULL &&
+ nsfb_palette_dithering_on(nsfb->palette) == false) {
+ nsfb_palette_dither_init(nsfb->palette, width);
+ set_dither = true;
+ }
xoff = clipped.x0 - x;
yoff = (clipped.y0 - y) * bmp_stride;
@@ -476,13 +484,95 @@ bitmap(nsfb_t *nsfb,
}
}
- if (nsfb->palette != NULL) {
+ if (set_dither) {
nsfb_palette_dither_fini(nsfb->palette);
}
return true;
}
+static bool
+bitmap_tiles(nsfb_t *nsfb,
+ const nsfb_bbox_t *loc,
+ int tiles_x,
+ int tiles_y,
+ const nsfb_colour_t *pixel,
+ int bmp_width,
+ int bmp_height,
+ int bmp_stride,
+ bool alpha)
+{
+ nsfb_bbox_t render_area;
+ nsfb_bbox_t tloc;
+ int tx, ty;
+ int width = loc->x1 - loc->x0;
+ int height = loc->y1 - loc->y0;
+ bool ok = true;
+ bool set_dither = false; /* true iff we enabled dithering here */
+
+ /* Avoid pointless rendering */
+ if (width == 0 || height == 0)
+ return true;
+
+ render_area.x0 = loc->x0;
+ render_area.y0 = loc->y0;
+ render_area.x1 = loc->x0 + width * tiles_x;
+ render_area.y1 = loc->y0 + height * tiles_y;
+
+ if (!nsfb_plot_clip_ctx(nsfb, &render_area))
+ return true;
+
+ /* Enable error diffusion for paletted screens, if not already on,
+ * if not repeating in x direction */
+ if (tiles_x == 1 && nsfb->palette != NULL &&
+ nsfb_palette_dithering_on(nsfb->palette) == false) {
+ nsfb_palette_dither_init(nsfb->palette,
+ render_area.x1 - render_area.x0);
+ set_dither = true;
+ }
+
+ /* Given tile location is top left; start with that one. */
+ tloc = *loc;
+
+ if (width != bmp_width || height != bmp_height) {
+ /* Scaled */
+ for (ty = 0; ty < tiles_y; ty++) {
+ for (tx = 0; tx < tiles_x; tx++) {
+ ok &= bitmap_scaled(nsfb, &tloc, pixel,
+ bmp_width, bmp_height,
+ bmp_stride, alpha);
+ tloc.x0 += width;
+ tloc.x1 += width;
+ }
+ tloc.x0 = loc->x0;
+ tloc.y0 += height;
+ tloc.x1 = loc->x1;
+ tloc.y1 += height;
+ }
+ } else {
+ /* Unscaled */
+ for (ty = 0; ty < tiles_y; ty++) {
+ for (tx = 0; tx < tiles_x; tx++) {
+ ok &= bitmap(nsfb, &tloc, pixel,
+ bmp_width, bmp_height,
+ bmp_stride, alpha);
+ tloc.x0 += width;
+ tloc.x1 += width;
+ }
+ tloc.x0 = loc->x0;
+ tloc.y0 += height;
+ tloc.x1 = loc->x1;
+ tloc.y1 += height;
+ }
+ }
+
+ if (set_dither) {
+ nsfb_palette_dither_fini(nsfb->palette);
+ }
+
+ return ok;
+}
+
static bool readrect(nsfb_t *nsfb, nsfb_bbox_t *rect, nsfb_colour_t *buffer)
{
PLOT_TYPE *pvideo;
--
NetSurf Framebuffer library
9 years, 11 months
netsurf: branch master updated. release/3.0-695-gb50743a
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/b50743a2538b95c172999...
...commit http://git.netsurf-browser.org/netsurf.git/commit/b50743a2538b95c17299979...
...tree http://git.netsurf-browser.org/netsurf.git/tree/b50743a2538b95c172999796d...
The branch, master has been updated
via b50743a2538b95c172999796d9b6ebae0538673c (commit)
from 0f166ad6b06d180e5f9eebfb4e49d596eb6400e5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=b50743a2538b95c1729...
commit b50743a2538b95c172999796d9b6ebae0538673c
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
tidy-up
diff --git a/amiga/gui.c b/amiga/gui.c
index e82c134..5c7acf1 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -2491,12 +2491,8 @@ void ami_handle_applib(void)
{
struct ApplicationCustomMsg *applibcustmsg =
(struct ApplicationCustomMsg *)applibmsg;
- // STRPTR tempmsg;
- // if(tempmsg = ASPrintf("\"%s\"",applibcustmsg->customMsg))
- // {
- OpenWorkbenchObjectA(applibcustmsg->customMsg, NULL);
- // FreeVec(tempmsg);
- // }
+ LOG(("Ringhio BackMsg received: %s", applibcustmsg->customMsg));
+ OpenWorkbenchObjectA(applibcustmsg->customMsg, NULL);
}
break;
}
-----------------------------------------------------------------------
Summary of changes:
amiga/gui.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/amiga/gui.c b/amiga/gui.c
index e82c134..5c7acf1 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -2491,12 +2491,8 @@ void ami_handle_applib(void)
{
struct ApplicationCustomMsg *applibcustmsg =
(struct ApplicationCustomMsg *)applibmsg;
- // STRPTR tempmsg;
- // if(tempmsg = ASPrintf("\"%s\"",applibcustmsg->customMsg))
- // {
- OpenWorkbenchObjectA(applibcustmsg->customMsg, NULL);
- // FreeVec(tempmsg);
- // }
+ LOG(("Ringhio BackMsg received: %s", applibcustmsg->customMsg));
+ OpenWorkbenchObjectA(applibcustmsg->customMsg, NULL);
}
break;
}
--
NetSurf Browser
9 years, 11 months
netsurf: branch master updated. release/3.0-694-g0f166ad
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/0f166ad6b06d180e5f9ee...
...commit http://git.netsurf-browser.org/netsurf.git/commit/0f166ad6b06d180e5f9eebf...
...tree http://git.netsurf-browser.org/netsurf.git/tree/0f166ad6b06d180e5f9eebfb4...
The branch, master has been updated
via 0f166ad6b06d180e5f9eebfb4e49d596eb6400e5 (commit)
from 1c85232a6345d5dd9730a6ca675db1cbcf1e1db9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=0f166ad6b06d180e5f9...
commit 0f166ad6b06d180e5f9eebfb4e49d596eb6400e5
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Remove comment. Background only used with alpha channel when printing via Tinct on RISC OS.
diff --git a/gtk/plotters.c b/gtk/plotters.c
index 2650611..8896da4 100644
--- a/gtk/plotters.c
+++ b/gtk/plotters.c
@@ -281,10 +281,6 @@ static bool nsgtk_plot_text(int x, int y, const char *text, size_t length,
static bool nsgtk_plot_pixbuf(int x, int y, int width, int height,
struct bitmap *bitmap, colour bg)
{
- /* XXX: This currently ignores the background colour supplied.
- * Does this matter?
- */
-
int x0, y0, x1, y1;
int dsrcx, dsrcy, dwidth, dheight;
int bmwidth, bmheight;
-----------------------------------------------------------------------
Summary of changes:
gtk/plotters.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/gtk/plotters.c b/gtk/plotters.c
index 2650611..8896da4 100644
--- a/gtk/plotters.c
+++ b/gtk/plotters.c
@@ -281,10 +281,6 @@ static bool nsgtk_plot_text(int x, int y, const char *text, size_t length,
static bool nsgtk_plot_pixbuf(int x, int y, int width, int height,
struct bitmap *bitmap, colour bg)
{
- /* XXX: This currently ignores the background colour supplied.
- * Does this matter?
- */
-
int x0, y0, x1, y1;
int dsrcx, dsrcy, dwidth, dheight;
int bmwidth, bmheight;
--
NetSurf Browser
9 years, 11 months
netsurf: branch master updated. release/3.0-693-g1c85232
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/1c85232a6345d5dd9730a...
...commit http://git.netsurf-browser.org/netsurf.git/commit/1c85232a6345d5dd9730a6c...
...tree http://git.netsurf-browser.org/netsurf.git/tree/1c85232a6345d5dd9730a6ca6...
The branch, master has been updated
via 1c85232a6345d5dd9730a6ca675db1cbcf1e1db9 (commit)
from 2277fb0284d50d378c2b0ca03798bf1512769eea (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=1c85232a6345d5dd973...
commit 1c85232a6345d5dd9730a6ca675db1cbcf1e1db9
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Improve responsiveness of drags.
diff --git a/riscos/mouse.c b/riscos/mouse.c
index 5ba1260..c655340 100644
--- a/riscos/mouse.c
+++ b/riscos/mouse.c
@@ -234,11 +234,13 @@ void ro_mouse_kill(void *data)
os_t ro_mouse_poll_interval(void)
{
- if (ro_mouse_drag_track_callback == NULL &&
- ro_mouse_poll_track_callback == NULL)
- return 0;
+ if (ro_mouse_drag_track_callback != NULL)
+ return 4;
+
+ if (ro_mouse_poll_track_callback != NULL)
+ return 10;
- return 10; // \TODO Return 4 for DRAG_SELECTION && DRAG_SCROLL
+ return 0;
}
diff --git a/riscos/mouse.h b/riscos/mouse.h
index e78a37e..bcb3b50 100644
--- a/riscos/mouse.h
+++ b/riscos/mouse.h
@@ -24,11 +24,6 @@
#ifndef _NETSURF_RISCOS_MOUSE_H_
#define _NETSURF_RISCOS_MOUSE_H_
-enum ro_mouse_track_response {
- RO_MOUSE_RESPONSE_LOW,
- RO_MOUSE_RESPONSE_HIGH
-};
-
/**
* Process Null polls for any drags and mouse trackers that are currently
-----------------------------------------------------------------------
Summary of changes:
riscos/mouse.c | 10 ++++++----
riscos/mouse.h | 5 -----
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/riscos/mouse.c b/riscos/mouse.c
index 5ba1260..c655340 100644
--- a/riscos/mouse.c
+++ b/riscos/mouse.c
@@ -234,11 +234,13 @@ void ro_mouse_kill(void *data)
os_t ro_mouse_poll_interval(void)
{
- if (ro_mouse_drag_track_callback == NULL &&
- ro_mouse_poll_track_callback == NULL)
- return 0;
+ if (ro_mouse_drag_track_callback != NULL)
+ return 4;
+
+ if (ro_mouse_poll_track_callback != NULL)
+ return 10;
- return 10; // \TODO Return 4 for DRAG_SELECTION && DRAG_SCROLL
+ return 0;
}
diff --git a/riscos/mouse.h b/riscos/mouse.h
index e78a37e..bcb3b50 100644
--- a/riscos/mouse.h
+++ b/riscos/mouse.h
@@ -24,11 +24,6 @@
#ifndef _NETSURF_RISCOS_MOUSE_H_
#define _NETSURF_RISCOS_MOUSE_H_
-enum ro_mouse_track_response {
- RO_MOUSE_RESPONSE_LOW,
- RO_MOUSE_RESPONSE_HIGH
-};
-
/**
* Process Null polls for any drags and mouse trackers that are currently
--
NetSurf Browser
9 years, 11 months
libnsfb: branch master updated. release/0.1.0-7-g23ec9ce
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libnsfb.git/shortlog/23ec9ceb5bb32a5348f84...
...commit http://git.netsurf-browser.org/libnsfb.git/commit/23ec9ceb5bb32a5348f8491...
...tree http://git.netsurf-browser.org/libnsfb.git/tree/23ec9ceb5bb32a5348f849124...
The branch, master has been updated
via 23ec9ceb5bb32a5348f8491243d41a14564c71f5 (commit)
from 797266ea930ca103e7fa7a2e683158d935683f8f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libnsfb.git/commit/?id=23ec9ceb5bb32a5348f...
commit 23ec9ceb5bb32a5348f8491243d41a14564c71f5
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Fix buffer length.
diff --git a/src/palette.c b/src/palette.c
index d600001..1a24127 100644
--- a/src/palette.c
+++ b/src/palette.c
@@ -30,7 +30,7 @@ bool nsfb_palette_new(struct nsfb_palette_s **palette, int width)
(*palette)->last = 0;
(*palette)->dither = false;
- (*palette)->dither_ctx.data_len = width * 3;
+ (*palette)->dither_ctx.data_len = width * 3 * sizeof(int);
(*palette)->dither_ctx.data = malloc(width * 3 * sizeof(int));
if ((*palette)->dither_ctx.data == NULL) {
nsfb_palette_free(*palette);
-----------------------------------------------------------------------
Summary of changes:
src/palette.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/palette.c b/src/palette.c
index d600001..1a24127 100644
--- a/src/palette.c
+++ b/src/palette.c
@@ -30,7 +30,7 @@ bool nsfb_palette_new(struct nsfb_palette_s **palette, int width)
(*palette)->last = 0;
(*palette)->dither = false;
- (*palette)->dither_ctx.data_len = width * 3;
+ (*palette)->dither_ctx.data_len = width * 3 * sizeof(int);
(*palette)->dither_ctx.data = malloc(width * 3 * sizeof(int));
if ((*palette)->dither_ctx.data == NULL) {
nsfb_palette_free(*palette);
--
NetSurf Framebuffer library
9 years, 11 months