Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/c8caf08ef16297379754d...
...commit
http://git.netsurf-browser.org/netsurf.git/commit/c8caf08ef16297379754d4a...
...tree
http://git.netsurf-browser.org/netsurf.git/tree/c8caf08ef16297379754d4a70...
The branch, master has been updated
via c8caf08ef16297379754d4a70e80cef3a0fde820 (commit)
via 5b5e621c7ac1bedc8c153b8ab99d47224b537497 (commit)
from 9729febf7245431e80f4fe0acfba212db08e770d (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=c8caf08ef1629737975...
commit c8caf08ef16297379754d4a70e80cef3a0fde820
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
As the content interface is now doing the scaling, we render to a native BitMap and
then copy that to the RGBA32 bitmap buffer without re-scaling.
The native BitMap is currently discarded and will be re-created when it is displayed.
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index bb47ae3..da0cabf 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -236,6 +236,16 @@ static size_t bitmap_get_bpp(void *vbitmap)
return 4;
}
+static void ami_bitmap_argb_to_rgba(struct bitmap *bm)
+{
+ if(bm == NULL) return;
+
+ ULONG *data = (ULONG *)amiga_bitmap_get_buffer(bm);
+ for(int i = 0; i < ((amiga_bitmap_get_rowstride(bm) / sizeof(ULONG)) *
bm->height); i++) {
+ data[i] = (data[i] << 8) | (data[i] >> 24);
+ }
+}
+
#ifdef BITMAP_DUMP
void bitmap_dump(struct bitmap *bitmap)
{
@@ -508,76 +518,59 @@ struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content)
{
- struct BitScaleArgs bsa;
int plot_width;
int plot_height;
- int redraw_tile_size = nsoption_int(redraw_tile_size_x);
+ struct MinList shared_pens;
+ struct gui_globals bm_globals;
+
struct redraw_context ctx = {
.interactive = false,
.background_images = true,
.plot = &amiplot
};
- if(nsoption_int(redraw_tile_size_y) < nsoption_int(redraw_tile_size_x))
- redraw_tile_size = nsoption_int(redraw_tile_size_y);
-
- plot_width = MIN(content_get_width(content), redraw_tile_size);
+ plot_width = MIN(content_get_width(content), bitmap->width);
plot_height = ((plot_width * bitmap->height) + (bitmap->width / 2)) /
bitmap->width;
- bitmap->nativebm = ami_rtg_allocbitmap(bitmap->width, bitmap->height, 32,
- BMF_CLEAR, browserglob.bm, RGBFB_A8R8G8B8);
+ ami_init_layers(&bm_globals, bitmap->width, bitmap->height);
+ NewMinList(&shared_pens);
+ bm_globals.shared_pens = &shared_pens;
- bitmap->nativebmwidth = bitmap->width;
- bitmap->nativebmheight = bitmap->height;
- ami_clearclipreg(&browserglob);
+ glob = &bm_globals;
+ ami_clearclipreg(&bm_globals);
content_scaled_redraw(content, plot_width, plot_height, &ctx);
#ifdef __amigaos4__
- if(__builtin_expect(GfxBase->LibNode.lib_Version >= 53, 1)) {
- /* AutoDoc says v52, but this function isn't in OS4.0, so checking for v53 (OS4.1)
*/
- float resample_scale = bitmap->width / (float)plot_width;
- uint32 flags = COMPFLAG_IgnoreDestAlpha;
- if(nsoption_bool(scale_quality)) flags |= COMPFLAG_SrcFilter;
-
- CompositeTags(COMPOSITE_Src,browserglob.bm,bitmap->nativebm,
- COMPTAG_ScaleX,
- COMP_FLOAT_TO_FIX(resample_scale),
- COMPTAG_ScaleY,
- COMP_FLOAT_TO_FIX(resample_scale),
- COMPTAG_Flags,flags,
- COMPTAG_DestX,0,
- COMPTAG_DestY,0,
- COMPTAG_DestWidth,bitmap->width,
- COMPTAG_DestHeight,bitmap->height,
- COMPTAG_OffsetX,0,
- COMPTAG_OffsetY,0,
- COMPTAG_FriendBitMap, scrn->RastPort.BitMap,
+ /* Create a RGBA32 version in case we lose the native BitMap for some reason */
+ BltBitMapTags( BLITA_SrcX, 0,
+ BLITA_SrcY, 0,
+ BLITA_Width, bitmap->width,
+ BLITA_Height, bitmap->height,
+ BLITA_Source, bm_globals.bm,
+ BLITA_SrcType, BLITT_BITMAP,
+ BLITA_Dest, bitmap->pixdata,
+ BLITA_DestType, BLITT_ARGB32,
+ BLITA_DestBytesPerRow, 4 * bitmap->width,
+ BLITA_DestX, 0,
+ BLITA_DestY, 0,
TAG_DONE);
- } else
+
+ ami_bitmap_argb_to_rgba(bitmap);
+
+#else
+#warning FIXME for OS3
#endif
- {
- bsa.bsa_SrcX = 0;
- bsa.bsa_SrcY = 0;
- bsa.bsa_SrcWidth = plot_width;
- bsa.bsa_SrcHeight = plot_height;
- bsa.bsa_DestX = 0;
- bsa.bsa_DestY = 0;
- // bsa.bsa_DestWidth = width;
- // bsa.bsa_DestHeight = height;
- bsa.bsa_XSrcFactor = plot_width;
- bsa.bsa_XDestFactor = bitmap->width;
- bsa.bsa_YSrcFactor = plot_height;
- bsa.bsa_YDestFactor = bitmap->height;
- bsa.bsa_SrcBitMap = browserglob.bm;
- bsa.bsa_DestBitMap = bitmap->nativebm;
- bsa.bsa_Flags = 0;
-
- BitMapScale(&bsa);
- }
- return true;
+ /**\todo In theory we should be able to move the bitmap to our native area
+ to try to avoid re-conversion */
+
+ ami_free_layers(&bm_globals);
+ ami_plot_release_pens(&shared_pens);
+ amiga_bitmap_set_opaque(bitmap, true);
+
+ return NSERROR_OK;
}
static struct gui_bitmap_table bitmap_table = {
diff --git a/amiga/plotters.c b/amiga/plotters.c
index 4c86f31..fa5f661 100644
--- a/amiga/plotters.c
+++ b/amiga/plotters.c
@@ -115,6 +115,8 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG
height)
if(!width) width = nsoption_int(redraw_tile_size_x);
if(!height) height = nsoption_int(redraw_tile_size_y);
+ gg->width = width;
+ gg->height = height;
gg->layerinfo = NewLayerInfo();
gg->areabuf = AllocVecTagList(AREA_SIZE, NULL);
@@ -177,9 +179,9 @@ void ami_free_layers(struct gui_globals *gg)
FreeVec(gg->areabuf);
DisposeLayerInfo(gg->layerinfo);
if(palette_mapped == false) {
- ami_rtg_freebitmap(gg->bm);
+ if(gg->bm) ami_rtg_freebitmap(gg->bm);
} else {
- FreeBitMap(gg->bm);
+ if(gg->bm) FreeBitMap(gg->bm);
}
}
diff --git a/amiga/plotters.h b/amiga/plotters.h
index f286b98..49afbe1 100644
--- a/amiga/plotters.h
+++ b/amiga/plotters.h
@@ -33,6 +33,8 @@ struct gui_globals
APTR tmprasbuf;
struct Rectangle rect;
struct MinList *shared_pens;
+ int width; /* size of bm and */
+ int height; /* associated memory */
};
extern const struct plotter_table amiplot;
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=5b5e621c7ac1bedc8c1...
commit 5b5e621c7ac1bedc8c153b8ab99d47224b537497
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Keep the size of the bitmap and layers used for rendering in the structure itself,
rather than assuming it is the same as the tile size.
diff --git a/amiga/gui.c b/amiga/gui.c
index 3df4d54..41ecd33 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -3461,10 +3461,13 @@ static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool
busy,
{
int x, y;
struct rect clip;
- int tile_x_scale = (int)(nsoption_int(redraw_tile_size_x) / gwin->gw->scale);
- int tile_y_scale = (int)(nsoption_int(redraw_tile_size_y) / gwin->gw->scale);
-
- browserglob.shared_pens = &gwin->shared_pens;
+ int tile_size_x = glob->width;
+ int tile_size_y = glob->height;
+
+ int tile_x_scale = (int)(tile_size_x / gwin->gw->scale);
+ int tile_y_scale = (int)(tile_size_y / gwin->gw->scale);
+
+ browserglob.shared_pens = &gwin->shared_pens; /* do we need this?? */
if(top < 0) {
height += top;
@@ -3498,14 +3501,14 @@ static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool
busy,
for(y = top; y < (top + height); y += tile_y_scale) {
clip.y0 = 0;
- clip.y1 = nsoption_int(redraw_tile_size_y);
+ clip.y1 = tile_size_y;
if(clip.y1 > height) clip.y1 = height;
if((((y - sy) * gwin->gw->scale) + clip.y1) > bbox->Height)
clip.y1 = bbox->Height - ((y - sy) * gwin->gw->scale);
for(x = left; x < (left + width); x += tile_x_scale) {
clip.x0 = 0;
- clip.x1 = nsoption_int(redraw_tile_size_x);
+ clip.x1 = tile_size_x;
if(clip.x1 > width) clip.x1 = width;
if((((x - sx) * gwin->gw->scale) + clip.x1) > bbox->Width)
clip.x1 = bbox->Width - ((x - sx) * gwin->gw->scale);
-----------------------------------------------------------------------
Summary of changes:
amiga/bitmap.c | 95 +++++++++++++++++++++++++-----------------------------
amiga/gui.c | 15 +++++----
amiga/plotters.c | 6 ++--
amiga/plotters.h | 2 ++
4 files changed, 59 insertions(+), 59 deletions(-)
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index bb47ae3..da0cabf 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -236,6 +236,16 @@ static size_t bitmap_get_bpp(void *vbitmap)
return 4;
}
+static void ami_bitmap_argb_to_rgba(struct bitmap *bm)
+{
+ if(bm == NULL) return;
+
+ ULONG *data = (ULONG *)amiga_bitmap_get_buffer(bm);
+ for(int i = 0; i < ((amiga_bitmap_get_rowstride(bm) / sizeof(ULONG)) *
bm->height); i++) {
+ data[i] = (data[i] << 8) | (data[i] >> 24);
+ }
+}
+
#ifdef BITMAP_DUMP
void bitmap_dump(struct bitmap *bitmap)
{
@@ -508,76 +518,59 @@ struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content)
{
- struct BitScaleArgs bsa;
int plot_width;
int plot_height;
- int redraw_tile_size = nsoption_int(redraw_tile_size_x);
+ struct MinList shared_pens;
+ struct gui_globals bm_globals;
+
struct redraw_context ctx = {
.interactive = false,
.background_images = true,
.plot = &amiplot
};
- if(nsoption_int(redraw_tile_size_y) < nsoption_int(redraw_tile_size_x))
- redraw_tile_size = nsoption_int(redraw_tile_size_y);
-
- plot_width = MIN(content_get_width(content), redraw_tile_size);
+ plot_width = MIN(content_get_width(content), bitmap->width);
plot_height = ((plot_width * bitmap->height) + (bitmap->width / 2)) /
bitmap->width;
- bitmap->nativebm = ami_rtg_allocbitmap(bitmap->width, bitmap->height, 32,
- BMF_CLEAR, browserglob.bm, RGBFB_A8R8G8B8);
+ ami_init_layers(&bm_globals, bitmap->width, bitmap->height);
+ NewMinList(&shared_pens);
+ bm_globals.shared_pens = &shared_pens;
- bitmap->nativebmwidth = bitmap->width;
- bitmap->nativebmheight = bitmap->height;
- ami_clearclipreg(&browserglob);
+ glob = &bm_globals;
+ ami_clearclipreg(&bm_globals);
content_scaled_redraw(content, plot_width, plot_height, &ctx);
#ifdef __amigaos4__
- if(__builtin_expect(GfxBase->LibNode.lib_Version >= 53, 1)) {
- /* AutoDoc says v52, but this function isn't in OS4.0, so checking for v53 (OS4.1)
*/
- float resample_scale = bitmap->width / (float)plot_width;
- uint32 flags = COMPFLAG_IgnoreDestAlpha;
- if(nsoption_bool(scale_quality)) flags |= COMPFLAG_SrcFilter;
-
- CompositeTags(COMPOSITE_Src,browserglob.bm,bitmap->nativebm,
- COMPTAG_ScaleX,
- COMP_FLOAT_TO_FIX(resample_scale),
- COMPTAG_ScaleY,
- COMP_FLOAT_TO_FIX(resample_scale),
- COMPTAG_Flags,flags,
- COMPTAG_DestX,0,
- COMPTAG_DestY,0,
- COMPTAG_DestWidth,bitmap->width,
- COMPTAG_DestHeight,bitmap->height,
- COMPTAG_OffsetX,0,
- COMPTAG_OffsetY,0,
- COMPTAG_FriendBitMap, scrn->RastPort.BitMap,
+ /* Create a RGBA32 version in case we lose the native BitMap for some reason */
+ BltBitMapTags( BLITA_SrcX, 0,
+ BLITA_SrcY, 0,
+ BLITA_Width, bitmap->width,
+ BLITA_Height, bitmap->height,
+ BLITA_Source, bm_globals.bm,
+ BLITA_SrcType, BLITT_BITMAP,
+ BLITA_Dest, bitmap->pixdata,
+ BLITA_DestType, BLITT_ARGB32,
+ BLITA_DestBytesPerRow, 4 * bitmap->width,
+ BLITA_DestX, 0,
+ BLITA_DestY, 0,
TAG_DONE);
- } else
+
+ ami_bitmap_argb_to_rgba(bitmap);
+
+#else
+#warning FIXME for OS3
#endif
- {
- bsa.bsa_SrcX = 0;
- bsa.bsa_SrcY = 0;
- bsa.bsa_SrcWidth = plot_width;
- bsa.bsa_SrcHeight = plot_height;
- bsa.bsa_DestX = 0;
- bsa.bsa_DestY = 0;
- // bsa.bsa_DestWidth = width;
- // bsa.bsa_DestHeight = height;
- bsa.bsa_XSrcFactor = plot_width;
- bsa.bsa_XDestFactor = bitmap->width;
- bsa.bsa_YSrcFactor = plot_height;
- bsa.bsa_YDestFactor = bitmap->height;
- bsa.bsa_SrcBitMap = browserglob.bm;
- bsa.bsa_DestBitMap = bitmap->nativebm;
- bsa.bsa_Flags = 0;
-
- BitMapScale(&bsa);
- }
- return true;
+ /**\todo In theory we should be able to move the bitmap to our native area
+ to try to avoid re-conversion */
+
+ ami_free_layers(&bm_globals);
+ ami_plot_release_pens(&shared_pens);
+ amiga_bitmap_set_opaque(bitmap, true);
+
+ return NSERROR_OK;
}
static struct gui_bitmap_table bitmap_table = {
diff --git a/amiga/gui.c b/amiga/gui.c
index 3df4d54..41ecd33 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -3461,10 +3461,13 @@ static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool
busy,
{
int x, y;
struct rect clip;
- int tile_x_scale = (int)(nsoption_int(redraw_tile_size_x) / gwin->gw->scale);
- int tile_y_scale = (int)(nsoption_int(redraw_tile_size_y) / gwin->gw->scale);
-
- browserglob.shared_pens = &gwin->shared_pens;
+ int tile_size_x = glob->width;
+ int tile_size_y = glob->height;
+
+ int tile_x_scale = (int)(tile_size_x / gwin->gw->scale);
+ int tile_y_scale = (int)(tile_size_y / gwin->gw->scale);
+
+ browserglob.shared_pens = &gwin->shared_pens; /* do we need this?? */
if(top < 0) {
height += top;
@@ -3498,14 +3501,14 @@ static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool
busy,
for(y = top; y < (top + height); y += tile_y_scale) {
clip.y0 = 0;
- clip.y1 = nsoption_int(redraw_tile_size_y);
+ clip.y1 = tile_size_y;
if(clip.y1 > height) clip.y1 = height;
if((((y - sy) * gwin->gw->scale) + clip.y1) > bbox->Height)
clip.y1 = bbox->Height - ((y - sy) * gwin->gw->scale);
for(x = left; x < (left + width); x += tile_x_scale) {
clip.x0 = 0;
- clip.x1 = nsoption_int(redraw_tile_size_x);
+ clip.x1 = tile_size_x;
if(clip.x1 > width) clip.x1 = width;
if((((x - sx) * gwin->gw->scale) + clip.x1) > bbox->Width)
clip.x1 = bbox->Width - ((x - sx) * gwin->gw->scale);
diff --git a/amiga/plotters.c b/amiga/plotters.c
index 4c86f31..fa5f661 100644
--- a/amiga/plotters.c
+++ b/amiga/plotters.c
@@ -115,6 +115,8 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG
height)
if(!width) width = nsoption_int(redraw_tile_size_x);
if(!height) height = nsoption_int(redraw_tile_size_y);
+ gg->width = width;
+ gg->height = height;
gg->layerinfo = NewLayerInfo();
gg->areabuf = AllocVecTagList(AREA_SIZE, NULL);
@@ -177,9 +179,9 @@ void ami_free_layers(struct gui_globals *gg)
FreeVec(gg->areabuf);
DisposeLayerInfo(gg->layerinfo);
if(palette_mapped == false) {
- ami_rtg_freebitmap(gg->bm);
+ if(gg->bm) ami_rtg_freebitmap(gg->bm);
} else {
- FreeBitMap(gg->bm);
+ if(gg->bm) FreeBitMap(gg->bm);
}
}
diff --git a/amiga/plotters.h b/amiga/plotters.h
index f286b98..49afbe1 100644
--- a/amiga/plotters.h
+++ b/amiga/plotters.h
@@ -33,6 +33,8 @@ struct gui_globals
APTR tmprasbuf;
struct Rectangle rect;
struct MinList *shared_pens;
+ int width; /* size of bm and */
+ int height; /* associated memory */
};
extern const struct plotter_table amiplot;
--
NetSurf Browser