summaryrefslogtreecommitdiff
path: root/amiga
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-04-24 11:56:19 +0100
committerVincent Sanders <vince@kyllikki.org>2015-04-24 11:56:19 +0100
commit124de5775a3a469d797a805ebe1f97312f7e1a0c (patch)
treeda7f5f88d06d267d5fa01492dcdab424fbb8116f /amiga
parent4e7dcde2b056c16a96dde6adcadb29a65ca72fde (diff)
downloadnetsurf-124de5775a3a469d797a805ebe1f97312f7e1a0c.tar.gz
netsurf-124de5775a3a469d797a805ebe1f97312f7e1a0c.tar.bz2
Update amiga to use bitmap render API
Diffstat (limited to 'amiga')
-rw-r--r--amiga/Makefile.target2
-rw-r--r--amiga/bitmap.c78
-rw-r--r--amiga/icon.c6
-rwxr-xr-xamiga/thumbnail.c117
4 files changed, 81 insertions, 122 deletions
diff --git a/amiga/Makefile.target b/amiga/Makefile.target
index 5c7bc3b45..4f9efb56b 100644
--- a/amiga/Makefile.target
+++ b/amiga/Makefile.target
@@ -68,7 +68,7 @@ MESSAGES_FILTER=ami
# S_AMIGA are sources purely for the Amiga build
S_AMIGA := gui.c tree.c history.c hotlist.c schedule.c file.c \
- thumbnail.c misc.c bitmap.c font.c filetype.c utf8.c login.c \
+ misc.c bitmap.c font.c filetype.c utf8.c login.c \
plotters.c object.c menu.c save_pdf.c arexx.c version.c \
cookies.c context_menu.c clipboard.c help.c font_scan.c \
launch.c search.c history_local.c download.c iff_dr2d.c \
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index 67e7b15ea..bb47ae321 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -24,14 +24,15 @@
#include <graphics/composite.h>
#endif
#include <graphics/gfxbase.h>
-#include "utils/nsoption.h"
#include <proto/datatypes.h>
#include <datatypes/pictureclass.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include <proto/utility.h>
+#include <sys/param.h>
#include "assert.h"
+#include "utils/nsoption.h"
#include "utils/messages.h"
#include "desktop/mouse.h"
#include "desktop/gui_window.h"
@@ -505,6 +506,80 @@ 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 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_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);
+
+ bitmap->nativebmwidth = bitmap->width;
+ bitmap->nativebmheight = bitmap->height;
+ ami_clearclipreg(&browserglob);
+
+ 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,
+ TAG_DONE);
+ } else
+#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;
+}
+
static struct gui_bitmap_table bitmap_table = {
.create = amiga_bitmap_create,
.destroy = amiga_bitmap_destroy,
@@ -518,6 +593,7 @@ static struct gui_bitmap_table bitmap_table = {
.get_bpp = bitmap_get_bpp,
.save = amiga_bitmap_save,
.modified = amiga_bitmap_modified,
+ .render = bitmap_render,
};
struct gui_bitmap_table *amiga_bitmap_table = &bitmap_table;
diff --git a/amiga/icon.c b/amiga/icon.c
index 042e1a826..fd39fddde 100644
--- a/amiga/icon.c
+++ b/amiga/icon.c
@@ -37,13 +37,13 @@
#endif
#include <workbench/icon.h>
-#include "desktop/plotters.h"
-#include "image/bitmap.h"
-#include "content/content_protected.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/file.h"
+#include "desktop/plotters.h"
+#include "image/bitmap.h"
+#include "content/content_protected.h"
#include "amiga/os3support.h"
#include "amiga/bitmap.h"
diff --git a/amiga/thumbnail.c b/amiga/thumbnail.c
deleted file mode 100755
index 04417bbe8..000000000
--- a/amiga/thumbnail.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright 2008,2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "amiga/os3support.h"
-
-#include <proto/graphics.h>
-#include <intuition/intuition.h>
-#ifdef __amigaos4__
-#include <graphics/blitattr.h>
-#include <graphics/composite.h>
-#endif
-#include <graphics/gfxbase.h>
-
-#include <sys/param.h>
-
-#include "amiga/os3support.h"
-#include "desktop/browser.h"
-#include "utils/nsoption.h"
-#include "content/urldb.h"
-#include "desktop/plotters.h"
-#include "desktop/thumbnail.h"
-#include "desktop/mouse.h"
-#include "desktop/gui_window.h"
-
-#include "amiga/gui.h"
-#include "amiga/bitmap.h"
-#include "amiga/rtg.h"
-
-bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap)
-{
- struct BitScaleArgs bsa;
- int plot_width;
- int plot_height;
- int redraw_tile_size = nsoption_int(redraw_tile_size_x);
- 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_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);
-
- bitmap->nativebmwidth = bitmap->width;
- bitmap->nativebmheight = bitmap->height;
- ami_clearclipreg(&browserglob);
-
- thumbnail_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,
- TAG_DONE);
- } else
-#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;
-}
-