summaryrefslogtreecommitdiff
path: root/amiga
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2009-03-08 17:41:24 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2009-03-08 17:41:24 +0000
commit0bdcf4b8e2538d499a95ac7153a5ad101b0100e0 (patch)
tree700d11cc3909ef41e44417b1f26f8b30ab5ea75f /amiga
parenta198acb7533e195a666d06434274c8fe115df8af (diff)
downloadnetsurf-0bdcf4b8e2538d499a95ac7153a5ad101b0100e0.tar.gz
netsurf-0bdcf4b8e2538d499a95ac7153a5ad101b0100e0.tar.bz2
Implement thumbnail creation
svn path=/trunk/netsurf/; revision=6736
Diffstat (limited to 'amiga')
-rwxr-xr-xamiga/gui.c13
-rwxr-xr-xamiga/plotters.c2
-rwxr-xr-xamiga/thumbnail.c59
3 files changed, 66 insertions, 8 deletions
diff --git a/amiga/gui.c b/amiga/gui.c
index 6a31901cd..038cec192 100755
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -508,8 +508,11 @@ void gui_init2(int argc, char** argv)
}
}
- /* init shared bitmaps */
- glob.bm = p96AllocBitMap(scrn->Width,scrn->Height,32,
+ /* init shared bitmaps *
+ * Height is set to screen width to give enough space for thumbnails *
+ * Also applies to the further gfx/layers functions and memory below */
+
+ glob.bm = p96AllocBitMap(scrn->Width,scrn->Width,32,
BMF_CLEAR | BMF_DISPLAYABLE | BMF_INTERLEAVED,
scrn->RastPort.BitMap,RGBFB_A8R8G8B8);
@@ -521,7 +524,7 @@ void gui_init2(int argc, char** argv)
glob.layerinfo = NewLayerInfo();
glob.rp.Layer = CreateUpfrontLayer(glob.layerinfo,glob.bm,0,0,
- scrn->Width-1,scrn->Height-1,0,NULL);
+ scrn->Width-1,scrn->Width-1,0,NULL);
glob.areabuf = AllocVec(100,MEMF_PRIVATE | MEMF_CLEAR);
glob.rp.AreaInfo = AllocVec(sizeof(struct AreaInfo),MEMF_PRIVATE | MEMF_CLEAR);
@@ -530,11 +533,11 @@ void gui_init2(int argc, char** argv)
InitArea(glob.rp.AreaInfo,glob.areabuf,100/5);
glob.rp.TmpRas = AllocVec(sizeof(struct TmpRas),MEMF_PRIVATE | MEMF_CLEAR);
- glob.tmprasbuf = AllocVec(scrn->Width*scrn->Height,MEMF_PRIVATE | MEMF_CLEAR);
+ glob.tmprasbuf = AllocVec(scrn->Width*scrn->Width,MEMF_PRIVATE | MEMF_CLEAR);
if((!glob.tmprasbuf) || (!glob.rp.TmpRas)) warn_user("NoMemory","");
- InitTmpRas(glob.rp.TmpRas,glob.tmprasbuf,scrn->Width*scrn->Height);
+ InitTmpRas(glob.rp.TmpRas,glob.tmprasbuf,scrn->Width*scrn->Width);
currp = &glob.rp;
#ifdef NS_AMIGA_CAIRO
diff --git a/amiga/plotters.c b/amiga/plotters.c
index 10d7b75cd..50a13cd7b 100755
--- a/amiga/plotters.c
+++ b/amiga/plotters.c
@@ -103,7 +103,7 @@ void ami_cairo_set_dashed(cairo_t *cr)
bool ami_clg(colour c)
{
- p96RectFill(currp,0,0,scrn->Width-1,scrn->Height-1,
+ p96RectFill(currp,0,0,scrn->Width-1,scrn->Width-1,
p96EncodeColor(RGBFB_A8B8G8R8,c));
/*
SetRPAttrs(currp,RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
diff --git a/amiga/thumbnail.c b/amiga/thumbnail.c
index ea138be65..abe308fbd 100755
--- a/amiga/thumbnail.c
+++ b/amiga/thumbnail.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ * Copyright 2008,2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -17,9 +17,64 @@
*/
#include "desktop/browser.h"
+#include <proto/graphics.h>
+#include <proto/Picasso96API.h>
+#include <intuition/intuition.h>
+#include <graphics/blitattr.h>
+#include <graphics/composite.h>
+#include "amiga/gui.h"
+#include "amiga/bitmap.h"
bool thumbnail_create(struct content *content, struct bitmap *bitmap,
const char *url)
{
- return false;
+ struct BitScaleArgs bsa;
+
+ bitmap->nativebm = p96AllocBitMap(bitmap->width,bitmap->height,32,
+ BMF_CLEAR | BMF_DISPLAYABLE | BMF_INTERLEAVED,glob.bm,RGBFB_A8R8G8B8);
+
+ bitmap->nativebmwidth = bitmap->width;
+ bitmap->nativebmheight = bitmap->height;
+ ami_clearclipreg(currp);
+ content_redraw(content, 0, 0, content->width, content->width,
+ 0, 0, content->width, content->width, 1.0, 0xFFFFFF);
+
+ if(GfxBase->lib_Version >= 53) // AutoDoc says v52, but this function isn't in OS4.0, so checking for v53 (OS4.1)
+ {
+ CompositeTags(COMPOSITE_Src,glob.bm,bitmap->nativebm,
+ COMPTAG_ScaleX,COMP_FLOAT_TO_FIX(bitmap->width/content->width),
+ COMPTAG_ScaleY,COMP_FLOAT_TO_FIX(bitmap->height/content->width),
+ COMPTAG_Flags,COMPFLAG_IgnoreDestAlpha | COMPFLAG_SrcAlphaOverride,
+ COMPTAG_DestX,0,
+ COMPTAG_DestY,0,
+ COMPTAG_DestWidth,bitmap->width,
+ COMPTAG_DestHeight,bitmap->height,
+ COMPTAG_OffsetX,0,
+ COMPTAG_OffsetY,0,
+ TAG_DONE);
+ }
+ else
+ {
+ bsa.bsa_SrcX = 0;
+ bsa.bsa_SrcY = 0;
+ bsa.bsa_SrcWidth = content->width;
+ bsa.bsa_SrcHeight = content->width;
+ bsa.bsa_DestX = 0;
+ bsa.bsa_DestY = 0;
+ // bsa.bsa_DestWidth = width;
+ // bsa.bsa_DestHeight = height;
+ bsa.bsa_XSrcFactor = content->width;
+ bsa.bsa_XDestFactor = bitmap->width;
+ bsa.bsa_YSrcFactor = content->width;
+ bsa.bsa_YDestFactor = bitmap->height;
+ bsa.bsa_SrcBitMap = glob.bm;
+ bsa.bsa_DestBitMap = bitmap->nativebm;
+ bsa.bsa_Flags = 0;
+
+ BitMapScale(&bsa);
+ }
+
+ if (url) urldb_set_thumbnail(url, bitmap);
+
+ return true;
}