r6619 chris_y - in /trunk/netsurf/amiga: bitmap.c bitmap.h plotters.c
by netsurf@semichrome.net
Author: chris_y
Date: Wed Feb 25 13:56:04 2009
New Revision: 6619
URL: http://source.netsurf-browser.org?rev=6619&view=rev
Log:
Move native bitmap creation/caching routine into bitmap.c
Modified:
trunk/netsurf/amiga/bitmap.c
trunk/netsurf/amiga/bitmap.h
trunk/netsurf/amiga/plotters.c
Modified: trunk/netsurf/amiga/bitmap.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/bitmap.c?rev=6619&r...
==============================================================================
--- trunk/netsurf/amiga/bitmap.c (original)
+++ trunk/netsurf/amiga/bitmap.c Wed Feb 25 13:56:04 2009
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2008,2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -21,6 +21,8 @@
#include "amiga/bitmap.h"
#include <proto/exec.h>
#include <proto/picasso96api.h>
+#include <graphics/composite.h>
+#include "amiga/options.h"
/**
* Create a bitmap.
@@ -243,3 +245,106 @@
assert(bitmap);
return 4;
}
+
+struct BitMap *ami_getcachenativebm(struct bitmap *bitmap,int width,int height,struct BitMap *friendbm)
+{
+ struct RenderInfo ri;
+ struct BitMap *tbm = NULL;
+ struct RastPort trp;
+
+ if(bitmap->nativebm)
+ {
+ if((bitmap->nativebmwidth == width) && (bitmap->nativebmheight==height))
+ {
+ tbm = bitmap->nativebm;
+ return tbm;
+ }
+ else if((bitmap->nativebmwidth == bitmap->width) && (bitmap->nativebmheight==bitmap->height))
+ {
+ tbm = bitmap->nativebm;
+ }
+ else
+ {
+ if(bitmap->nativebm) p96FreeBitMap(bitmap->nativebm);
+ bitmap->nativebm = NULL;
+ }
+ }
+
+ if(!tbm)
+ {
+ ri.Memory = bitmap->pixdata;
+ ri.BytesPerRow = bitmap->width * 4;
+ ri.RGBFormat = RGBFB_R8G8B8A8;
+
+ tbm = p96AllocBitMap(bitmap->width,bitmap->height,32,0,friendbm,RGBFB_R8G8B8A8);
+ InitRastPort(&trp);
+ trp.BitMap = tbm;
+ p96WritePixelArray((struct RenderInfo *)&ri,0,0,&trp,0,0,bitmap->width,bitmap->height);
+
+ if(option_cache_bitmaps == 2)
+ {
+ bitmap->nativebm = tbm;
+ bitmap->nativebmwidth = bitmap->width;
+ bitmap->nativebmheight = bitmap->height;
+ }
+ }
+
+ if((bitmap->width != width) || (bitmap->height != height))
+ {
+ struct BitMap *scaledbm;
+ struct BitScaleArgs bsa;
+
+ scaledbm = p96AllocBitMap(width,height,32,BMF_DISPLAYABLE,friendbm,RGBFB_R8G8B8A8);
+
+ 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,tbm,scaledbm,
+ COMPTAG_ScaleX,COMP_FLOAT_TO_FIX(width/bitmap->width),
+ COMPTAG_ScaleY,COMP_FLOAT_TO_FIX(height/bitmap->height),
+ COMPTAG_Flags,COMPFLAG_IgnoreDestAlpha,
+ COMPTAG_DestX,0,
+ COMPTAG_DestY,0,
+ COMPTAG_DestWidth,width,
+ COMPTAG_DestHeight,height,
+ COMPTAG_OffsetX,0,
+ COMPTAG_OffsetY,0,
+ COMPTAG_FriendBitMap,friendbm,
+ TAG_DONE);
+ }
+ else /* do it the old-fashioned way. This is pretty slow, but probably
+ uses Composite() on OS4.1 anyway, so we're only saving a blit really. */
+ {
+ bsa.bsa_SrcX = 0;
+ bsa.bsa_SrcY = 0;
+ bsa.bsa_SrcWidth = bitmap->width;
+ bsa.bsa_SrcHeight = bitmap->height;
+ bsa.bsa_DestX = 0;
+ bsa.bsa_DestY = 0;
+// bsa.bsa_DestWidth = width;
+// bsa.bsa_DestHeight = height;
+ bsa.bsa_XSrcFactor = bitmap->width;
+ bsa.bsa_XDestFactor = width;
+ bsa.bsa_YSrcFactor = bitmap->height;
+ bsa.bsa_YDestFactor = height;
+ bsa.bsa_SrcBitMap = tbm;
+ bsa.bsa_DestBitMap = scaledbm;
+ bsa.bsa_Flags = 0;
+
+ BitMapScale(&bsa);
+ }
+
+ if(bitmap->nativebm != tbm) p96FreeBitMap(bitmap->nativebm);
+ p96FreeBitMap(tbm);
+ tbm = scaledbm;
+ bitmap->nativebm = NULL;
+
+ if(option_cache_bitmaps >= 1)
+ {
+ bitmap->nativebm = tbm;
+ bitmap->nativebmwidth = width;
+ bitmap->nativebmheight = height;
+ }
+ }
+
+ return tbm;
+}
Modified: trunk/netsurf/amiga/bitmap.h
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/bitmap.h?rev=6619&r...
==============================================================================
--- trunk/netsurf/amiga/bitmap.h (original)
+++ trunk/netsurf/amiga/bitmap.h Wed Feb 25 13:56:04 2009
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2008,2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -31,4 +31,6 @@
int nativebmheight;
};
+struct BitMap *ami_getcachenativebm(struct bitmap *bitmap,int width,int height,struct BitMap *friendbm);
+
#endif
Modified: trunk/netsurf/amiga/plotters.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/plotters.c?rev=6619...
==============================================================================
--- trunk/netsurf/amiga/plotters.c (original)
+++ trunk/netsurf/amiga/plotters.c Wed Feb 25 13:56:04 2009
@@ -29,7 +29,6 @@
#include <proto/layers.h>
#include "amiga/options.h"
#include <graphics/blitattr.h>
-#include <graphics/composite.h>
#include "utils/log.h"
#include <math.h>
#include <assert.h>
@@ -386,148 +385,13 @@
bool ami_bitmap(int x, int y, int width, int height,
struct bitmap *bitmap, colour bg, struct content *content)
{
- struct RenderInfo ri;
struct BitMap *tbm;
- struct RastPort trp;
if(!width || !height) return true;
-// ami_fill(x,y,x+width,y+height,bg);
-
-/*
- SetRPAttrs(currp,RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,bg),
- TAG_DONE);
-*/
-
- if(bitmap->nativebm)
- {
- if((bitmap->nativebmwidth != width) || (bitmap->nativebmheight != height))
- {
- p96FreeBitMap(bitmap->nativebm);
- bitmap->nativebm = NULL;
- }
- else
- {
- tbm = bitmap->nativebm;
- }
- }
-
- if(!bitmap->nativebm)
- {
- ri.Memory = bitmap->pixdata;
- ri.BytesPerRow = bitmap->width * 4;
- ri.RGBFormat = RGBFB_R8G8B8A8;
-
- tbm = p96AllocBitMap(bitmap->width,bitmap->height,32,BMF_DISPLAYABLE,currp->BitMap,RGBFB_R8G8B8A8);
- InitRastPort(&trp);
- trp.BitMap = tbm;
- p96WritePixelArray((struct RenderInfo *)&ri,0,0,&trp,0,0,bitmap->width,bitmap->height);
-
- if((bitmap->width != width) || (bitmap->height != height))
- {
- struct BitMap *scaledbm;
- struct BitScaleArgs bsa;
-
- scaledbm = p96AllocBitMap(width,height,32,BMF_DISPLAYABLE,currp->BitMap,RGBFB_R8G8B8A8);
-
- 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,tbm,scaledbm,
- COMPTAG_ScaleX,COMP_FLOAT_TO_FIX(width/bitmap->width),
- COMPTAG_ScaleY,COMP_FLOAT_TO_FIX(height/bitmap->height),
- COMPTAG_Flags,COMPFLAG_IgnoreDestAlpha,
- COMPTAG_DestX,0,
- COMPTAG_DestY,0,
- COMPTAG_DestWidth,width,
- COMPTAG_DestHeight,height,
- COMPTAG_OffsetX,0,
- COMPTAG_OffsetY,0,
- COMPTAG_FriendBitMap,currp->BitMap,
- TAG_DONE);
- }
- else /* do it the old-fashioned way. This is pretty slow, but probably
- uses Composite() on OS4.1 anyway, so we're only saving a blit really. */
- {
- bsa.bsa_SrcX = 0;
- bsa.bsa_SrcY = 0;
- bsa.bsa_SrcWidth = bitmap->width;
- bsa.bsa_SrcHeight = bitmap->height;
- bsa.bsa_DestX = 0;
- bsa.bsa_DestY = 0;
- // bsa.bsa_DestWidth = width;
- // bsa.bsa_DestHeight = height;
- bsa.bsa_XSrcFactor = bitmap->width;
- bsa.bsa_XDestFactor = width;
- bsa.bsa_YSrcFactor = bitmap->height;
- bsa.bsa_YDestFactor = height;
- bsa.bsa_SrcBitMap = tbm;
- bsa.bsa_DestBitMap = scaledbm;
- bsa.bsa_Flags = 0;
-
- BitMapScale(&bsa);
- }
-
- BltBitMapTags(BLITA_Width,width,
- BLITA_Height,height,
- BLITA_Source,scaledbm,
- BLITA_Dest,currp,
- BLITA_DestX,x,
- BLITA_DestY,y,
- BLITA_SrcType,BLITT_BITMAP,
- BLITA_DestType,BLITT_RASTPORT,
- BLITA_UseSrcAlpha,!bitmap->opaque,
- TAG_DONE);
-
- if(option_cache_bitmaps >= 1)
- {
- if(bitmap->nativebm)
- {
- p96FreeBitMap(bitmap->nativebm);
- }
-
- bitmap->nativebm = scaledbm;
- }
- else
- {
- p96FreeBitMap(scaledbm);
- }
-
- p96FreeBitMap(tbm);
- }
- else
- {
- BltBitMapTags(BLITA_Width,width,
- BLITA_Height,height,
- BLITA_Source,tbm,
- BLITA_Dest,currp,
- BLITA_DestX,x,
- BLITA_DestY,y,
- BLITA_SrcType,BLITT_BITMAP,
- BLITA_DestType,BLITT_RASTPORT,
- BLITA_UseSrcAlpha,!bitmap->opaque,
- TAG_DONE);
-
- if(option_cache_bitmaps == 2)
- {
- if(bitmap->nativebm)
- {
- p96FreeBitMap(bitmap->nativebm);
- }
-
- bitmap->nativebm = tbm;
- }
- else
- {
- p96FreeBitMap(tbm);
- }
- }
-
- bitmap->nativebmwidth = width;
- bitmap->nativebmheight = height;
- }
- else
- {
- BltBitMapTags(BLITA_Width,width,
+ tbm = ami_getcachenativebm(bitmap,width,height,currp->BitMap);
+
+ BltBitMapTags(BLITA_Width,width,
BLITA_Height,height,
BLITA_Source,tbm,
BLITA_Dest,currp,
@@ -537,7 +401,6 @@
BLITA_DestType,BLITT_RASTPORT,
BLITA_UseSrcAlpha,!bitmap->opaque,
TAG_DONE);
- }
return true;
}
@@ -546,12 +409,9 @@
struct bitmap *bitmap, colour bg,
bool repeat_x, bool repeat_y, struct content *content)
{
- struct RenderInfo ri;
ULONG xf,yf,wf,hf;
int max_width,max_height;
struct BitMap *tbm = NULL;
- struct RastPort trp;
- bool gotscaledbm = false;
/*
SetRPAttrs(currp,RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,bg),
@@ -561,102 +421,7 @@
if(!(repeat_x || repeat_y))
return ami_bitmap(x, y, width, height, bitmap, bg, content);
- if(bitmap->nativebm)
- {
- if((bitmap->nativebmwidth == width) && (bitmap->nativebmheight==height))
- {
- tbm = bitmap->nativebm;
- gotscaledbm = true;
- }
- else if((bitmap->nativebmwidth == bitmap->width) && (bitmap->nativebmheight==bitmap->height))
- {
- tbm = bitmap->nativebm;
- }
- else
- {
- if(bitmap->nativebm) p96FreeBitMap(bitmap->nativebm);
- bitmap->nativebm = NULL;
- }
- }
-
- if(!tbm && !gotscaledbm)
- {
- ri.Memory = bitmap->pixdata;
- ri.BytesPerRow = bitmap->width * 4;
- ri.RGBFormat = RGBFB_R8G8B8A8;
-
- tbm = p96AllocBitMap(bitmap->width,bitmap->height,32,0,currp->BitMap,RGBFB_R8G8B8A8);
- InitRastPort(&trp);
- trp.BitMap = tbm;
- p96WritePixelArray((struct RenderInfo *)&ri,0,0,&trp,0,0,bitmap->width,bitmap->height);
-
- if(option_cache_bitmaps == 2)
- {
- bitmap->nativebm = tbm;
- bitmap->nativebmwidth = bitmap->width;
- bitmap->nativebmheight = bitmap->height;
- }
- }
-
- if((bitmap->width != width) || (bitmap->height != height))
- {
- if(!gotscaledbm)
- {
- struct BitMap *scaledbm;
- struct BitScaleArgs bsa;
-
- scaledbm = p96AllocBitMap(width,height,32,BMF_DISPLAYABLE,currp->BitMap,RGBFB_R8G8B8A8);
-
- 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,tbm,scaledbm,
- COMPTAG_ScaleX,COMP_FLOAT_TO_FIX(width/bitmap->width),
- COMPTAG_ScaleY,COMP_FLOAT_TO_FIX(height/bitmap->height),
- COMPTAG_Flags,COMPFLAG_IgnoreDestAlpha,
- COMPTAG_DestX,0,
- COMPTAG_DestY,0,
- COMPTAG_DestWidth,width,
- COMPTAG_DestHeight,height,
- COMPTAG_OffsetX,0,
- COMPTAG_OffsetY,0,
- COMPTAG_FriendBitMap,currp->BitMap,
- TAG_DONE);
- }
- else /* do it the old-fashioned way. This is pretty slow, but probably
- uses Composite() on OS4.1 anyway, so we're only saving a blit really. */
- {
- bsa.bsa_SrcX = 0;
- bsa.bsa_SrcY = 0;
- bsa.bsa_SrcWidth = bitmap->width;
- bsa.bsa_SrcHeight = bitmap->height;
- bsa.bsa_DestX = 0;
- bsa.bsa_DestY = 0;
- // bsa.bsa_DestWidth = width;
- // bsa.bsa_DestHeight = height;
- bsa.bsa_XSrcFactor = bitmap->width;
- bsa.bsa_XDestFactor = width;
- bsa.bsa_YSrcFactor = bitmap->height;
- bsa.bsa_YDestFactor = height;
- bsa.bsa_SrcBitMap = tbm;
- bsa.bsa_DestBitMap = scaledbm;
- bsa.bsa_Flags = 0;
-
- BitMapScale(&bsa);
- }
-
- if(bitmap->nativebm != tbm) p96FreeBitMap(bitmap->nativebm);
- p96FreeBitMap(tbm);
- tbm = scaledbm;
- bitmap->nativebm = NULL;
-
- if(option_cache_bitmaps >= 1)
- {
- bitmap->nativebm = tbm;
- bitmap->nativebmwidth = width;
- bitmap->nativebmheight = height;
- }
- }
- }
+ tbm = ami_getcachenativebm(bitmap,width,height,currp->BitMap);
/* get left most tile position */
if (repeat_x)
14 years, 7 months
r6618 chris_y - /trunk/netsurf/amiga/dist/Install
by netsurf@semichrome.net
Author: chris_y
Date: Wed Feb 25 13:55:07 2009
New Revision: 6618
URL: http://source.netsurf-browser.org?rev=6618&view=rev
Log:
Force AmiUpdate to pick the part-Cairo version on OS4.1, as it hasn't seen any release
yet and I'd rather people made a conscious decision to use the static one rather than
the update picking it because updating a Cairo version is impossible.
Modified:
trunk/netsurf/amiga/dist/Install
Modified: trunk/netsurf/amiga/dist/Install
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/dist/Install?rev=66...
==============================================================================
--- trunk/netsurf/amiga/dist/Install (original)
+++ trunk/netsurf/amiga/dist/Install Wed Feb 25 13:55:07 2009
@@ -144,9 +144,10 @@
(
; Guess if the installed version is static, if it
; is bigger than 9MB then it probably is!
-
- (set #netsurf-size (getsize (tackon @default-dest "NetSurf")))
- (if (> #netsurf-size 9000000) (set #cairo-version 0))
+; Comment this out temporarily as we want AutoInstall to update to the Cairo
+; version at this stage, as it hasn't seen a snapshot release yet.
+; (set #netsurf-size (getsize (tackon @default-dest "NetSurf")))
+; (if (> #netsurf-size 9000000) (set #cairo-version 0))
)
)
)
14 years, 7 months
r6617 mmu_man - /trunk/netsurf/beos/beos_res.rdef
by netsurf@semichrome.net
Author: mmu_man
Date: Tue Feb 24 21:31:02 2009
New Revision: 6617
URL: http://source.netsurf-browser.org?rev=6617&view=rev
Log:
Fix Haiku vector icon
Modified:
trunk/netsurf/beos/beos_res.rdef
Modified: trunk/netsurf/beos/beos_res.rdef
URL: http://source.netsurf-browser.org/trunk/netsurf/beos/beos_res.rdef?rev=66...
==============================================================================
--- trunk/netsurf/beos/beos_res.rdef (original)
+++ trunk/netsurf/beos/beos_res.rdef Tue Feb 24 21:31:02 2009
@@ -301,41 +301,64 @@
};
resource(101, "BEOS:ICON") #'VICN' array {
- $"6E636966060200060240CCB33B58BF3B58BFC0CCB34E598BCD1673003F6EFFFF"
- $"93ADFF05FF020106023E5402000000000000BE540248497948816C00B8F5FFFF"
- $"0097FF05000201060242B568000000000000C2B5684E57E54A4B53002668EEFF"
- $"B8F5FF032668EE120204B685BFC2B685C434B685BB51BE90B7B7BA1EB7B7C302"
- $"B7B7C69CBFC2C69CBB51C69CC434BE90C7CEC302C7CEBA1EC7CE0204B685BFC2"
- $"B685C434B685BB51BE90B7B7BA1EB7B7C302B7B7C69CBFC2C69CBB51C69CC434"
- $"BE90C7CEC302C7CEBA1EC7CE0204B685BFC2B685C434B685BB51BE90B7B7BA1E"
- $"B7B7C302B7B7C69CBFC2C69CBB51C69CC434BE90C7CEC302C7CEBA1EC7CE0204"
- $"B685BFC2B685C434B685BB51BE90B7B7BA1EB7B7C302B7B7C69CBFC2C69CBB51"
- $"C69CC434BE90C7CEC302C7CEBA1EC7CE0A10C3E8BE78C367BD12C48EBC60C335"
- $"BBBEC389BA6FC222BAF1C170B9C9C0CEBB22BF80BACFC001BC35BEDABCE7C033"
- $"BD89BFE0BED8C146BE56C1F8BF7EC29ABE250A10C3E8BE78C367BD12C48EBC60"
- $"C335BBBEC389BA6FC222BAF1C170B9C9C0CEBB22BF80BACFC001BC35BEDABCE7"
- $"C033BD89BFE0BED8C146BE56C1F8BF7EC29ABE250A04BAF5B910BA97BA76B9FA"
- $"BA56BA65B8D10A04BA4CBBE132BD4DB99CBD47B9BCBBC90A0432BEC6BA65C02B"
- $"B9C8C04AB99CBECC0A04BABDC197BB4DC2DDBAC3C31C32C1BD0A04BBFDC429BC"
- $"D2C54ABC54C5AEBB79C4750A04BDBAC677BEC8C78BBE31C7D6BD49C6D60A04B7"
- $"6EC2F6B8A7C37AB882C3FEB774C3AC0A04BA0DC3C5BB85C3DEBB7FC47BB9FAC4"
- $"550A04BCF7C3E5BE69C3BFBE7CC455BCFEC47B0A04BFD5C387C13BC32FC167C3"
- $"C5BFF5C41D0A04C2A1C2B8C3EDC221C42BC2A5C2D9C3480A04C51AC159C615C0"
- $"5DC69FC0B5C57EC1D0120A0101001240D69000000000000040D690C65277C763"
- $"0301144000000000000000004000000000000000000A0101011240D690000000"
- $"00000040D690C65277C7630301178403040A0201020240D69000000000000040"
- $"D690C65277C763030A0301031240D69000000000000040D690C65277C7630301"
- $"178103040A0101040240D69000000000000040D690C65277C763030A01010512"
- $"40D69000000000000040D690C65277C7630301178003040A0301060240D69000"
- $"000000000040D690C65277C763030A0301070240D69000000000000040D690C6"
- $"5277C763030A0301080240D69000000000000040D690C65277C763030A030109"
- $"0240D69000000000000040D690C65277C763030A03010A0240D6900000000000"
- $"0040D690C65277C763030A03010B0240D69000000000000040D690C65277C763"
- $"030A03010C0240D69000000000000040D690C65277C763030A03010D0240D690"
- $"00000000000040D690C65277C763030A03010E0240D69000000000000040D690"
- $"C65277C763030A03010F0240D69000000000000040D690C65277C763030A0301"
- $"100240D69000000000000040D690C65277C763030A0301110240D69000000000"
- $"000040D690C65277C76303"
+ $"6E6369660A02010203AE259A400198BFFA65AE20E548AF9547F2037F30A0FFFF"
+ $"00E8F1FDFFF131A0FFFB02000602B83B85BC57333C5733B83B8549EAE1481199"
+ $"00359FFFFFFFFFFF05FF05010400600500020002033D9F21B889EB3A4CEE3F48"
+ $"204AB4B1440D2D10339DFF51369381810DB3339DFF68020002013E7E6E26628C"
+ $"A83C7540569A4565A3CA24492BEEF3F70001EEF3F731017D828B95160204BFE6"
+ $"B413C670B413B95DB413B411BF78B411B92DB411C5C3BFE6CADDB95CCADDC66F"
+ $"CADDCBBCBF78CBBCC5C4CBBCB92E0204BC63B4EAC0E922B7DDB608B570BBF0B4"
+ $"C0B92EB61EBEB2BEDDBEE8BA56C007C363BDCBC5D0B7E2C67FBAA5C522B52002"
+ $"04BFDEB448C60DB448B9ADB448B4ADBF9AB4ADB955B4ADC5DABFDECAEDB9ABCA"
+ $"EDC60BCAEDCB0FBF9ACB0FC5DCCB0FB9570204BFDFB4D8C5BFB4D8B9FEB4D8B5"
+ $"3DBF9AB53DB9A5B53DC58ABFDFCA5CB9FCCA5CC5BDCA5CCA81BF9ACA81C58BCA"
+ $"81B9A70606BA0BBF11CB5CC71BCAFECB92C8F7CA15CAF2CCF9C666CA36C48EC4"
+ $"A7CA76C78DC943C2BECB40BF11CB5D0A04BB16B6B2BA9C2EB9CFB86BBA5AB65D"
+ $"0A04BA10BC6AB954BC62B96CBADFBA3EBAE70A04BA21BEB5BA5AC047B98DC071"
+ $"B93ABEF30A04BAFDC28BBB88C3E9BAD5C43EBA59C2CD0A04BD84C730BCE154BC"
+ $"1CC679BCAAC5F90A04BEF3C932C015CA3BBF51CAA0BE4FC9AB0A04B812C4E6B8"
+ $"1CC5AEB693C46DB6DEC3F70A04BA6AC535BBD4C545BBCDC617BAACC6020A04BE"
+ $"1EC565BF9AC51CBFB2C5E6BE5FC6340A04C1DCC4D3C348C459C381C524C244C5"
+ $"8D0A04C6D0C2EDC721C39FC5E5C45FC595C3AA0A04C8E6C175C9A042CA54C102"
+ $"C962C20E0611AAAAAAAE02C14FB955C2EAB96FC38BB7E6C47FB928C628B8C3C6"
+ $"04BA40C793BB18C64ABC15C6B4BDE0C50CBDCAC479BF41C372BE11C17FBE79C1"
+ $"FEBCB2C207BCB3C1F5BCB2C047BC1CC1A7BAEBC14EB9540205C03CC10EC030C0"
+ $"EFC0B9C250BFCBC606BE8FC591C21CC6E2C5DBC385C74DC4AAC5AAC35EC643BC"
+ $"27C7D2BF42C4B3B90CC27CB994C3B1BA28C084B8A30605EF03B6CFBA0EB779B7"
+ $"92B672BB6AB633BD29B598BCA2B7B3BE77BD4BBD3EC58CB654C86EB88FC42DB5"
+ $"45BC71B55CBF70B47FB920B65000000204CB77C91ACB76C797CB79CAACC293CB"
+ $"88C456CB8AC0CCCB86BAB3C975BAACCAF2BABAC7F6C286C704C0CCC704C44DC7"
+ $"04250A090115023FFFDCB41DBB3451734030CDBF6EE7C3CF400A000100023F88"
+ $"1AB4F02F34DE2C3F9E484326CF4422000A060112023CDC96413114C145263E69"
+ $"DE4C32CFCB0EE00A0301031A4002C300000000000040012FBD3E023BCFC439BF"
+ $"01178100040A0301031A4002C300000000000040012FBD3E023BCFC42F390117"
+ $"8200040A0301031A4002C300000000000040012FBD3E023BCFC41A2F01178200"
+ $"040A050105023EF4D13E9DFDBE66B43EB65E491E02C6E7CA0A0501051A3EE861"
+ $"3EABC8BE735C3EAAF54929C0C6EFBE1A3901178100040A050106023F4B963E44"
+ $"75BE44753F4B9648D9CDC72B1A0A0501061A3F4B963E4475BE44753F4B9648D9"
+ $"CDC72B1A1A3901178100040A0501061A3F4B963E4475BE44753F4B9648D9CDC7"
+ $"2B1A001901178300040A050107023F4B963E4475BE44753F4B9648D9CDC72B1A"
+ $"0A0501071A3F4B963E4475BE44753F4B9648D9CDC72B1A1A3901178100040A05"
+ $"0108023F4B963E4475BE44753F4B9648D9CDC72B1A0A0501081A3F4B963E4475"
+ $"BE44753F4B9648D9CDC72B1A1A3901178100040A0501081A3F4B963E4475BE44"
+ $"753F4B9648D9CDC72B1A001901178300040A050109023F70F53E0A00BE0A003F"
+ $"70F5485F8CC6CD790A0501091A3F70F53E0A00BE0A003F70F5485F8CC6CD791A"
+ $"3901178100040A05010A023F4B963E4475BD81043E8BD247F0BEC26F710A0501"
+ $"0A1A3F4B963E4475BD81043E8BD247F0BEC26F711A3901178100040A05010A1A"
+ $"3F4B963E4475BD81043E8BD247F0BEC26F71001901178300040A05010B023F7B"
+ $"673D4154BE6C8B3F3385495313C5FE290A05010B1A3F7B673D4154BE6C8B3F33"
+ $"85495313C5FE291A3901178100040A05010C023F70093E0B8EBE0B8E3F700948"
+ $"A7CCC721CF0A05010C1A3F70093E0B8EBE0B8E3F700948A7CCC721CF1A390117"
+ $"8100040A05010D023F70093E0B8EBE0B8E3F700948A7CCC721CF0A05010D1A3F"
+ $"70093E0B8EBE0B8E3F700948A7CCC721CF1A3901178100040A05010D1A3F7009"
+ $"3E0B8EBE0B8E3F700948A7CCC721CF001901178300040A05010E023F70093E0B"
+ $"8EBE0B8E3F700948A7CCC721CF0A05010E1A3F70093E0B8EBE0B8E3F700948A7"
+ $"CCC721CF1A3901178100040A05010F023FB1173D145ABD145A3FB117474282C6"
+ $"7CF80A05010F1A3FB1173D145ABD145A3FB117474282C67CF81A390117810004"
+ $"0A05010F1A3FB1173D145ABD145A3FB117474282C67CF8001901178300040A05"
+ $"0110023F68373CD78FBD05193F9ECF48132CC5E0A80A0501101A3F68373CD78F"
+ $"BD05193F9ECF48132CC5E0A81A3901178100040A020111000A0301031A4002C3"
+ $"00000000000040012FBD3E023BCFC400190117850004"
};
resource(101, "BEOS:D:STD_ICON") (#'iICO') $"4944585A055300";
14 years, 7 months
r6616 chris_y - /trunk/netsurf/amiga/plotters.c
by netsurf@semichrome.net
Author: chris_y
Date: Tue Feb 24 18:26:46 2009
New Revision: 6616
URL: http://source.netsurf-browser.org?rev=6616&view=rev
Log:
The native bitmap caching was eating memory, this should be correct now.
Modified:
trunk/netsurf/amiga/plotters.c
Modified: trunk/netsurf/amiga/plotters.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/plotters.c?rev=6616...
==============================================================================
--- trunk/netsurf/amiga/plotters.c (original)
+++ trunk/netsurf/amiga/plotters.c Tue Feb 24 18:26:46 2009
@@ -32,6 +32,7 @@
#include <graphics/composite.h>
#include "utils/log.h"
#include <math.h>
+#include <assert.h>
#ifndef M_PI /* For some reason we don't always get this from math.h */
#define M_PI 3.14159265358979323846
@@ -548,8 +549,9 @@
struct RenderInfo ri;
ULONG xf,yf,wf,hf;
int max_width,max_height;
- struct BitMap *tbm;
+ struct BitMap *tbm = NULL;
struct RastPort trp;
+ bool gotscaledbm = false;
/*
SetRPAttrs(currp,RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,bg),
@@ -561,18 +563,23 @@
if(bitmap->nativebm)
{
- if((bitmap->nativebmwidth != width) || (bitmap->nativebmheight != height))
- {
- p96FreeBitMap(bitmap->nativebm);
+ if((bitmap->nativebmwidth == width) && (bitmap->nativebmheight==height))
+ {
+ tbm = bitmap->nativebm;
+ gotscaledbm = true;
+ }
+ else if((bitmap->nativebmwidth == bitmap->width) && (bitmap->nativebmheight==bitmap->height))
+ {
+ tbm = bitmap->nativebm;
+ }
+ else
+ {
+ if(bitmap->nativebm) p96FreeBitMap(bitmap->nativebm);
bitmap->nativebm = NULL;
}
- else
- {
- tbm = bitmap->nativebm;
- }
- }
-
- if(!bitmap->nativebm)
+ }
+
+ if(!tbm && !gotscaledbm)
{
ri.Memory = bitmap->pixdata;
ri.BytesPerRow = bitmap->width * 4;
@@ -583,7 +590,7 @@
trp.BitMap = tbm;
p96WritePixelArray((struct RenderInfo *)&ri,0,0,&trp,0,0,bitmap->width,bitmap->height);
- if((option_cache_bitmaps == 2) && (bitmap->height == height && bitmap->width == width))
+ if(option_cache_bitmaps == 2)
{
bitmap->nativebm = tbm;
bitmap->nativebmwidth = bitmap->width;
@@ -591,13 +598,9 @@
}
}
- if((bitmap->nativebm) && (bitmap->nativebmwidth == width) && (bitmap->nativebmheight==height))
- {
- tbm = bitmap->nativebm;
- }
- else
- {
- if((bitmap->width != width) || (bitmap->height != height))
+ if((bitmap->width != width) || (bitmap->height != height))
+ {
+ if(!gotscaledbm)
{
struct BitMap *scaledbm;
struct BitScaleArgs bsa;
@@ -641,8 +644,10 @@
BitMapScale(&bsa);
}
+ if(bitmap->nativebm != tbm) p96FreeBitMap(bitmap->nativebm);
p96FreeBitMap(tbm);
tbm = scaledbm;
+ bitmap->nativebm = NULL;
if(option_cache_bitmaps >= 1)
{
@@ -666,6 +671,8 @@
/* tile down and across to extents */
for (xf = x; xf < glob.rect.MaxX; xf += width) {
for (yf = y; yf < glob.rect.MaxY; yf += height) {
+
+ assert(tbm);
BltBitMapTags(BLITA_Width,width,
BLITA_Height,height,
14 years, 7 months
r6615 chris_y - /trunk/netsurf/amiga/plotters.c
by netsurf@semichrome.net
Author: chris_y
Date: Tue Feb 24 17:47:58 2009
New Revision: 6615
URL: http://source.netsurf-browser.org?rev=6615&view=rev
Log:
Optimise tile plotter
Modified:
trunk/netsurf/amiga/plotters.c
Modified: trunk/netsurf/amiga/plotters.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/plotters.c?rev=6615...
==============================================================================
--- trunk/netsurf/amiga/plotters.c (original)
+++ trunk/netsurf/amiga/plotters.c Tue Feb 24 17:47:58 2009
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2008,2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -556,9 +556,12 @@
TAG_DONE);
*/
+ if(!(repeat_x || repeat_y))
+ return ami_bitmap(x, y, width, height, bitmap, bg, content);
+
if(bitmap->nativebm)
{
- if((bitmap->nativebmwidth != bitmap->width) || (bitmap->nativebmheight != bitmap->height))
+ if((bitmap->nativebmwidth != width) || (bitmap->nativebmheight != height))
{
p96FreeBitMap(bitmap->nativebm);
bitmap->nativebm = NULL;
@@ -580,7 +583,7 @@
trp.BitMap = tbm;
p96WritePixelArray((struct RenderInfo *)&ri,0,0,&trp,0,0,bitmap->width,bitmap->height);
- if(option_cache_bitmaps == 2)
+ if((option_cache_bitmaps == 2) && (bitmap->height == height && bitmap->width == width))
{
bitmap->nativebm = tbm;
bitmap->nativebmwidth = bitmap->width;
@@ -588,48 +591,101 @@
}
}
- max_width = (repeat_x ? scrn->Width : width);
- max_height = (repeat_y ? scrn->Height : height);
-
- if(repeat_x && (x<-bitmap->width)) while(x<-bitmap->width) x+=bitmap->width;
- if(repeat_y && (y<-bitmap->height)) while(y<-bitmap->height) y+=bitmap->height;
-
- for(xf=0;xf<max_width;xf+=bitmap->width)
- {
- for(yf=0;yf<max_height;yf+=bitmap->height)
- {
- if(width > xf+bitmap->width)
- {
- wf = width-(xf+bitmap->width);
- }
- else
- {
- wf=bitmap->width;
- }
-
- if(height > yf+bitmap->height)
- {
- hf = height-(yf+bitmap->height);
- }
- else
- {
- hf=bitmap->height;
- }
-
- BltBitMapTags(BLITA_Width,wf,
- BLITA_Height,hf,
+ if((bitmap->nativebm) && (bitmap->nativebmwidth == width) && (bitmap->nativebmheight==height))
+ {
+ tbm = bitmap->nativebm;
+ }
+ else
+ {
+ if((bitmap->width != width) || (bitmap->height != height))
+ {
+ struct BitMap *scaledbm;
+ struct BitScaleArgs bsa;
+
+ scaledbm = p96AllocBitMap(width,height,32,BMF_DISPLAYABLE,currp->BitMap,RGBFB_R8G8B8A8);
+
+ 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,tbm,scaledbm,
+ COMPTAG_ScaleX,COMP_FLOAT_TO_FIX(width/bitmap->width),
+ COMPTAG_ScaleY,COMP_FLOAT_TO_FIX(height/bitmap->height),
+ COMPTAG_Flags,COMPFLAG_IgnoreDestAlpha,
+ COMPTAG_DestX,0,
+ COMPTAG_DestY,0,
+ COMPTAG_DestWidth,width,
+ COMPTAG_DestHeight,height,
+ COMPTAG_OffsetX,0,
+ COMPTAG_OffsetY,0,
+ COMPTAG_FriendBitMap,currp->BitMap,
+ TAG_DONE);
+ }
+ else /* do it the old-fashioned way. This is pretty slow, but probably
+ uses Composite() on OS4.1 anyway, so we're only saving a blit really. */
+ {
+ bsa.bsa_SrcX = 0;
+ bsa.bsa_SrcY = 0;
+ bsa.bsa_SrcWidth = bitmap->width;
+ bsa.bsa_SrcHeight = bitmap->height;
+ bsa.bsa_DestX = 0;
+ bsa.bsa_DestY = 0;
+ // bsa.bsa_DestWidth = width;
+ // bsa.bsa_DestHeight = height;
+ bsa.bsa_XSrcFactor = bitmap->width;
+ bsa.bsa_XDestFactor = width;
+ bsa.bsa_YSrcFactor = bitmap->height;
+ bsa.bsa_YDestFactor = height;
+ bsa.bsa_SrcBitMap = tbm;
+ bsa.bsa_DestBitMap = scaledbm;
+ bsa.bsa_Flags = 0;
+
+ BitMapScale(&bsa);
+ }
+
+ p96FreeBitMap(tbm);
+ tbm = scaledbm;
+
+ if(option_cache_bitmaps >= 1)
+ {
+ bitmap->nativebm = tbm;
+ bitmap->nativebmwidth = width;
+ bitmap->nativebmheight = height;
+ }
+ }
+ }
+
+ /* get left most tile position */
+ if (repeat_x)
+ for (; x > glob.rect.MinX; x -= width)
+ ;
+
+ /* get top most tile position */
+ if (repeat_y)
+ for (; y > glob.rect.MinY; y -= height)
+ ;
+
+ /* tile down and across to extents */
+ for (xf = x; xf < glob.rect.MaxX; xf += width) {
+ for (yf = y; yf < glob.rect.MaxY; yf += height) {
+
+ BltBitMapTags(BLITA_Width,width,
+ BLITA_Height,height,
BLITA_Source,tbm,
BLITA_Dest,currp,
- BLITA_DestX,x+xf,
- BLITA_DestY,y+yf,
+ BLITA_DestX,xf,
+ BLITA_DestY,yf,
BLITA_SrcType,BLITT_BITMAP,
BLITA_DestType,BLITT_RASTPORT,
BLITA_UseSrcAlpha,!bitmap->opaque,
TAG_DONE);
- }
- }
-
- if(option_cache_bitmaps != 2)
+
+ if (!repeat_y)
+ break;
+ }
+ if (!repeat_x)
+ break;
+ }
+
+ if(!option_cache_bitmaps)
{
p96FreeBitMap(tbm);
}
14 years, 7 months
r6613 vince - in /trunk/netsurf/framebuffer: fb_frontend_linuxfb.c fb_frontend_sdl.c fb_gui.c fb_plotters.c
by netsurf@semichrome.net
Author: vince
Date: Tue Feb 24 06:32:28 2009
New Revision: 6613
URL: http://source.netsurf-browser.org?rev=6613&view=rev
Log:
Fix horizontal panning
Fix linux fb keymap
Modified:
trunk/netsurf/framebuffer/fb_frontend_linuxfb.c
trunk/netsurf/framebuffer/fb_frontend_sdl.c
trunk/netsurf/framebuffer/fb_gui.c
trunk/netsurf/framebuffer/fb_plotters.c
Modified: trunk/netsurf/framebuffer/fb_frontend_linuxfb.c
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/fb_frontend_l...
==============================================================================
--- trunk/netsurf/framebuffer/fb_frontend_linuxfb.c (original)
+++ trunk/netsurf/framebuffer/fb_frontend_linuxfb.c Tue Feb 24 06:32:28 2009
@@ -592,58 +592,116 @@
fb_cleanup();
}
+
+static int keymap[] = {
+ -1, -1, '1', '2', '3', '4', '5', '6', '7', '8', /* 0 - 9 */
+ '9', '0', '-', '=', 8, 9, 'q', 'w', 'e', 'r', /* 10 - 19 */
+ 't', 'y', 'u', 'i', 'o', 'p', '[', ']', 13, -1, /* 20 - 29 */
+ 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', /* 30 - 39 */
+ '\'', '#', -1, '\\', 'z', 'x', 'c', 'v', 'b', 'n', /* 40 - 49 */
+ 'm', ',', '.', '/', -1, -1, -1, ' ', -1, -1, /* 50 - 59 */
+};
+
+static int sh_keymap[] = {
+ -1, -1, '!', '"', '£', '$', '%', '^', '&', '*', /* 0 - 9 */
+ '(', ')', '_', '+', 8, 9, 'Q', 'W', 'E', 'R', /* 10 - 19 */
+ 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', 13, -1, /* 20 - 29 */
+ 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', /* 30 - 39 */
+ '@', '~', -1, '|', 'Z', 'X', 'C', 'V', 'B', 'N', /* 40 - 49 */
+ 'M', '<', '>', '?', -1, -1, -1, ' ', -1, -1, /* 50 - 59 */
+};
+
+
+/* performs character mapping */
+static int keycode_to_ascii(int code, bool shift)
+{
+ int ascii = -1;
+
+ if (shift) {
+ if ((code >= 0) && (code < sizeof(sh_keymap)))
+ ascii = sh_keymap[code];
+ } else {
+ if ((code >= 0) && (code < sizeof(keymap)))
+ ascii = keymap[code];
+ }
+ return ascii;
+}
+
void fb_os_input(struct gui_window *g, bool active)
{
ssize_t amt;
struct input_event event;
fb_input_dev *d;
-
+ int ascii = -1;
+ static bool shift = false;
+
for (d = inputdevs; d != NULL; d = d->next) {
amt = read(d->fd, &event, sizeof(struct input_event));
if (amt > 0) {
if (event.type == EV_KEY) {
- if (event.value == 0)
+ if (event.value == 0) {
+ /* key up */
+ switch (event.code) {
+ case KEY_LEFTSHIFT:
+ case KEY_RIGHTSHIFT:
+ shift = false;
+ break;
+
+ case BTN_LEFT:
+ fb_rootwindow_click(g,
+ BROWSER_MOUSE_CLICK_1,
+ fb_cursor_x(framebuffer),
+ fb_cursor_y(framebuffer));
+ break;
+ }
return;
+ }
switch (event.code) {
- case KEY_J:
+ case KEY_PAGEDOWN:
+ fb_window_scroll(g, 0, g->height);
+ break;
+
+ case KEY_PAGEUP:
+ fb_window_scroll(g, 0, -g->height);
+ break;
+
+ case KEY_DOWN:
fb_window_scroll(g, 0, 100);
break;
-
- case KEY_K:
+
+ case KEY_UP:
fb_window_scroll(g, 0, -100);
break;
-
- case KEY_Q:
- browser_window_destroy(g->bw);
- break;
-
- case KEY_D:
- list_schedule();
- break;
-
- case KEY_UP:
- fb_cursor_move(framebuffer, 0, -1);
- break;
-
- case KEY_DOWN:
- fb_cursor_move(framebuffer, 0, 1);
- break;
-
+
case KEY_LEFT:
- fb_cursor_move(framebuffer, -1, 0);
+ fb_window_scroll(g, -100, 0);
break;
case KEY_RIGHT:
- fb_cursor_move(framebuffer, 1, 0);
- break;
+ fb_window_scroll(g, 100, 0);
+ break;
+
+ case KEY_ESC:
+ browser_window_destroy(g->bw);
+ break;
+
case BTN_LEFT:
fb_rootwindow_click(g,
- BROWSER_MOUSE_CLICK_1,
+ BROWSER_MOUSE_PRESS_1,
fb_cursor_x(framebuffer),
fb_cursor_y(framebuffer));
break;
+
+ case KEY_LEFTSHIFT:
+ case KEY_RIGHTSHIFT:
+ shift = true;
+ break;
+
+ default:
+ ascii = keycode_to_ascii(event.code, shift);
+
}
} else if (event.type == EV_REL) {
switch (event.code) {
@@ -660,6 +718,12 @@
break;
}
}
+
+ if (ascii != -1) {
+ fb_rootwindow_input(g, ascii);
+ ascii = -1;
+ }
+
}
}
Modified: trunk/netsurf/framebuffer/fb_frontend_sdl.c
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/fb_frontend_s...
==============================================================================
--- trunk/netsurf/framebuffer/fb_frontend_sdl.c (original)
+++ trunk/netsurf/framebuffer/fb_frontend_sdl.c Tue Feb 24 06:32:28 2009
@@ -126,18 +126,14 @@
break;
case SDLK_LEFT:
- if (history_back_available(g->bw->history))
- history_back(g->bw, g->bw->history);
+ fb_window_scroll(g, -100, 0);
break;
case SDLK_RIGHT:
- if (history_forward_available(g->bw->history))
- history_forward(g->bw, g->bw->history);
+ fb_window_scroll(g, 100, 0);
break;
default:
- printf("The %s key was pressed!\n",
- SDL_GetKeyName(event.key.keysym.sym));
fb_rootwindow_input(g, event.key.keysym.sym);
break;
}
Modified: trunk/netsurf/framebuffer/fb_gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/fb_gui.c?rev=...
==============================================================================
--- trunk/netsurf/framebuffer/fb_gui.c (original)
+++ trunk/netsurf/framebuffer/fb_gui.c Tue Feb 24 06:32:28 2009
@@ -85,6 +85,14 @@
if ((g->scrolly + g->pany) > (c->height - g->height))
g->pany = (c->height - g->height) - g->scrolly;
+ /* dont pan off the left */
+ if ((g->scrollx + g->panx) < 0)
+ g->panx = - g->scrollx;
+
+ /* do not pan off the right of the content */
+ if ((g->scrollx + g->panx) > (c->width - g->width))
+ g->panx = (c->width - g->width) - g->scrollx;
+
LOG(("panning %d, %d",g->panx, g->pany));
/* pump up the volume. dance, dance! lets do it */
@@ -117,6 +125,36 @@
g->width, g->height);
}
+ if (g->panx < 0) {
+ /* we cannot pan more than a window width at a time */
+ if (g->panx < -g->width)
+ g->panx = -g->width;
+
+ LOG(("panning left %d", g->panx));
+
+ fb_plotters_move_block(g->x, g->y,
+ g->width + g->panx, g->height ,
+ g->x - g->panx, g->y );
+ g->scrollx += g->panx;
+ fb_queue_redraw(g, 0, 0,
+ - g->panx, g->height);
+ }
+
+ if (g->panx > 0) {
+ /* we cannot pan more than a window width at a time */
+ if (g->panx > g->width)
+ g->panx = g->width;
+
+ LOG(("panning right %d", g->panx));
+
+ fb_plotters_move_block(g->x + g->panx, g->y,
+ g->width - g->panx, g->height,
+ g->x, g->y);
+ g->scrollx += g->panx;
+ fb_queue_redraw(g, g->width - g->panx, 0,
+ g->width, g->height);
+ }
+
g->pan_required = false;
g->panx = 0;
g->pany = 0;
@@ -270,7 +308,9 @@
if (redraws_pending == true) {
struct gui_window *g;
- fb_cursor_move(framebuffer, fb_cursor_x(framebuffer), fb_cursor_y(framebuffer));
+ fb_cursor_move(framebuffer,
+ fb_cursor_x(framebuffer),
+ fb_cursor_y(framebuffer));
redraws_pending = false;
Modified: trunk/netsurf/framebuffer/fb_plotters.c
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/fb_plotters.c...
==============================================================================
--- trunk/netsurf/framebuffer/fb_plotters.c (original)
+++ trunk/netsurf/framebuffer/fb_plotters.c Tue Feb 24 06:32:28 2009
@@ -471,18 +471,28 @@
{
uint8_t *srcptr = (framebuffer->ptr +
(srcy * framebuffer->linelen) +
- (srcx));
+ ((srcx * framebuffer->bpp) / 8));
uint8_t *dstptr = (framebuffer->ptr +
(dsty * framebuffer->linelen) +
- (dstx));
+ ((dstx * framebuffer->bpp) / 8));
bbox_t redrawbox;
+ int hloop;
LOG(("from (%d,%d) w %d h %d to (%d,%d)",srcx,srcy,width,height,dstx,dsty));
- memmove(dstptr, srcptr, (width * height * framebuffer->bpp) / 8);
-
+ if (width == framebuffer->width) {
+ /* take shortcut and use memmove */
+ memmove(dstptr, srcptr, (width * height * framebuffer->bpp) / 8);
+ } else {
+
+ for (hloop = height; hloop > 0; hloop--) {
+ memmove(dstptr, srcptr, (width * framebuffer->bpp) / 8);
+ srcptr += framebuffer->linelen;
+ dstptr += framebuffer->linelen;
+ }
+ }
/* callback to the os specific routine in case it needs to do something
* explicit to redraw
*/
14 years, 7 months
r6611 vince - /trunk/netsurf/framebuffer/fb_gui.c
by netsurf@semichrome.net
Author: vince
Date: Tue Feb 24 04:02:43 2009
New Revision: 6611
URL: http://source.netsurf-browser.org?rev=6611&view=rev
Log:
stop framebuffer port updating its status text every time the mouse pointer is moved
Modified:
trunk/netsurf/framebuffer/fb_gui.c
Modified: trunk/netsurf/framebuffer/fb_gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/fb_gui.c?rev=...
==============================================================================
--- trunk/netsurf/framebuffer/fb_gui.c (original)
+++ trunk/netsurf/framebuffer/fb_gui.c Tue Feb 24 04:02:43 2009
@@ -485,6 +485,16 @@
void gui_window_set_status(struct gui_window *g, const char *text)
{
+ static char *cur_text = NULL;
+
+ if (cur_text != NULL) {
+ if (strcmp(cur_text, text) == 0)
+ return;
+
+ free(cur_text);
+ }
+ cur_text = strdup(text);
+
fb_rootwindow_status(text);
}
14 years, 7 months
r6610 vince - /trunk/netsurf/framebuffer/fb_16bpp_plotters.c
by netsurf@semichrome.net
Author: vince
Date: Tue Feb 24 03:24:20 2009
New Revision: 6610
URL: http://source.netsurf-browser.org?rev=6610&view=rev
Log:
add 16bpp freetype font plotting
Modified:
trunk/netsurf/framebuffer/fb_16bpp_plotters.c
Modified: trunk/netsurf/framebuffer/fb_16bpp_plotters.c
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/fb_16bpp_plot...
==============================================================================
--- trunk/netsurf/framebuffer/fb_16bpp_plotters.c (original)
+++ trunk/netsurf/framebuffer/fb_16bpp_plotters.c Tue Feb 24 03:24:20 2009
@@ -38,6 +38,12 @@
(x << 1));
}
+static inline colour fb_16bpp_to_colour(uint16_t pixel)
+{
+ return ((pixel & 0x1F) << 19) |
+ ((pixel & 0x7E0) << 5) |
+ ((pixel & 0xF800) >> 8);
+}
#define SIGN(x) ((x<0) ? -1 : ((x>0) ? 1 : 0))
@@ -192,11 +198,114 @@
}
#ifdef FB_USE_FREETYPE
+
+static bool
+fb_16bpp_draw_ft_monobitmap(FT_Bitmap *bp, int x, int y, colour c)
+{
+ return false;
+}
+
+static bool
+fb_16bpp_draw_ft_bitmap(FT_Bitmap *bp, int x, int y, colour c)
+{
+ uint16_t *pvideo;
+ uint8_t *pixel = (uint8_t *)bp->buffer;
+ colour abpixel; /* alphablended pixel */
+ int xloop, yloop;
+ int x0,y0,x1,y1;
+ int xoff, yoff; /* x and y offset into image */
+ int height = bp->rows;
+ int width = bp->width;
+ uint32_t fgcol;
+
+ /* The part of the scaled image actually displayed is cropped to the
+ * current context.
+ */
+ x0 = x;
+ y0 = y;
+ x1 = x + width;
+ y1 = y + height;
+
+ if (!fb_plotters_clip_rect_ctx(&x0, &y0, &x1, &y1))
+ return true;
+
+ if (height > (y1 - y0))
+ height = (y1 - y0);
+
+ if (width > (x1 - x0))
+ width = (x1 - x0);
+
+ xoff = x0 - x;
+ yoff = y0 - y;
+
+ /* plot the image */
+ pvideo = fb_16bpp_get_xy_loc(x0, y0);
+
+ fgcol = c & 0xFFFFFF;
+
+ for (yloop = 0; yloop < height; yloop++) {
+ for (xloop = 0; xloop < width; xloop++) {
+ abpixel = (pixel[((yoff + yloop) * bp->pitch) + xloop + xoff] << 24) | fgcol;
+ if ((abpixel & 0xFF000000) != 0) {
+ if ((abpixel & 0xFF000000) != 0xFF000000) {
+ abpixel = fb_plotters_ablend(abpixel,
+ fb_16bpp_to_colour(*(pvideo + xloop)));
+ }
+
+ *(pvideo + xloop) =
+ ((abpixel & 0xF8) << 8) |
+ ((abpixel & 0xFC00 ) >> 5) |
+ ((abpixel & 0xF80000) >> 19);
+
+ }
+ }
+ pvideo += (framebuffer->linelen >> 1);
+ }
+
+ return true;
+}
+
static bool fb_16bpp_text(int x, int y, const struct css_style *style,
const char *text, size_t length, colour bg, colour c)
{
- return false;
-}
+ uint32_t ucs4;
+ size_t nxtchr = 0;
+ FT_UInt glyph_index;
+ FT_Face face = fb_get_face(style);
+ FT_Error error;
+
+ while (nxtchr < length) {
+ ucs4 = utf8_to_ucs4(text + nxtchr, length - nxtchr);
+ nxtchr = utf8_next(text, length, nxtchr);
+ glyph_index = FT_Get_Char_Index(face, ucs4);
+
+ error = FT_Load_Glyph(face,
+ glyph_index,
+ FT_LOAD_RENDER |
+ FT_LOAD_FORCE_AUTOHINT |
+ ft_load_type);
+ if (error)
+ continue;
+
+ /* now, draw to our target surface */
+ if (face->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_MONO) {
+ fb_16bpp_draw_ft_monobitmap( &face->glyph->bitmap,
+ x + face->glyph->bitmap_left,
+ y - face->glyph->bitmap_top,
+ c);
+ } else {
+ fb_16bpp_draw_ft_bitmap( &face->glyph->bitmap,
+ x + face->glyph->bitmap_left,
+ y - face->glyph->bitmap_top,
+ c);
+ }
+
+ x += face->glyph->advance.x >> 6;
+
+ }
+ return true;
+}
+
#else
static bool fb_16bpp_text(int x, int y, const struct css_style *style,
const char *text, size_t length, colour bg, colour c)
@@ -302,12 +411,6 @@
return true;
}
-static inline colour fb_16bpp_to_colour(uint16_t pixel)
-{
- return ((pixel & 0x1F) << 19) |
- ((pixel & 0x7E0) << 5) |
- ((pixel & 0xF800) >> 8);
-}
static bool fb_16bpp_bitmap(int x, int y, int width, int height,
struct bitmap *bitmap, colour bg,
@@ -359,7 +462,7 @@
for (xloop = 0; xloop < width; xloop++) {
abpixel = pixel[((yoff + yloop) * bitmap->width) + xloop + xoff];
if ((abpixel & 0xFF000000) != 0) {
- if ((abpixel & 0xFF000000) != 0xFF) {
+ if ((abpixel & 0xFF000000) != 0xFF000000) {
abpixel = fb_plotters_ablend(abpixel,
fb_16bpp_to_colour(*(pvideo + xloop)));
}
14 years, 7 months