r5949 bursa - /trunk/libnsgif/examples/disassemble_gif.pl
by netsurf@semichrome.net
Author: bursa
Date: Tue Dec 30 21:10:18 2008
New Revision: 5949
URL: http://source.netsurf-browser.org?rev=5949&view=rev
Log:
Script to disassemble GIFs, to help with debugging broken GIFs.
Added:
trunk/libnsgif/examples/disassemble_gif.pl (with props)
Added: trunk/libnsgif/examples/disassemble_gif.pl
URL: http://source.netsurf-browser.org/trunk/libnsgif/examples/disassemble_gif...
==============================================================================
--- trunk/libnsgif/examples/disassemble_gif.pl (added)
+++ trunk/libnsgif/examples/disassemble_gif.pl Tue Dec 30 21:10:18 2008
@@ -1,0 +1,109 @@
+#!/usr/bin/perl
+#
+# Disassemble a GIF file and display the sections and chunks within.
+#
+# Warning: only part of the specification is implemented.
+#
+
+use strict;
+use warnings;
+
+die "Usage: $0 IMAGE\n" unless @ARGV == 1;
+my ($image) = @ARGV;
+
+open IMAGE, '<', $image or die "$0: open $image: $!\n";
+undef $/;
+my $gif = <IMAGE>;
+close IMAGE;
+
+print "$image: ", length $gif, " bytes\n\n";
+
+my @gif = unpack 'C*', $gif;
+my $z = 0;
+
+output_chunk('Header', 6);
+output_chunk('Logical Screen Descriptor', 7);
+
+my $global_colors = $gif[10] & 0x80;
+my $color_table_size = 2 << ($gif[10] & 0x07);
+
+if ($global_colors) {
+ output_chunk('Global Color Table', $color_table_size * 3);
+}
+
+while (1) {
+ while ($gif[$z] == 0x21) {
+ if ($gif[$z + 1] == 0xf9) {
+ output_chunk('Graphic Control Extension', 5 + 2);
+ } elsif ($gif[$z + 1] == 0xfe) {
+ output_chunk('Comment Extension', 2);
+ } elsif ($gif[$z + 1] == 0x01) {
+ output_chunk('Plain Text Extension', 13 + 2);
+ } elsif ($gif[$z + 1] == 0xff) {
+ output_chunk('Application Extension', 12 + 2);
+ } else {
+ output_chunk((sprintf 'Unknown Extension 0x%.2x',
+ $gif[$z + 1]), $gif[$z + 2] + 3);
+ }
+
+ while ($gif[$z] != 0) {
+ output_chunk('Data Sub-block', $gif[$z] + 1);
+ }
+ output_chunk('Block Terminator', 1);
+ }
+
+ if ($gif[$z] == 0x3b) {
+ output_chunk('Trailer', 1);
+ last;
+ }
+
+ if ($gif[$z] != 0x2c) {
+ last;
+ }
+
+ output_chunk('Image Descriptor', 10);
+
+ output_chunk('Table Based Image Data', 1);
+
+ while ($gif[$z] != 0) {
+ output_chunk('Data Sub-block', $gif[$z] + 1);
+ }
+ output_chunk('Block Terminator', 1);
+}
+
+if ($z != @gif) {
+ output_chunk('*** Junk on End ***', @gif - $z);
+}
+
+
+#
+# Output a chunk of data as hex and characters.
+#
+sub output_chunk
+{
+ my ($description, $length) = @_;
+
+ print "$description";
+ for (my $i = 0; $i != $length; $i++) {
+ if ($i % 8 == 0) {
+ print "\n";
+ printf "%8i: ", $z + $i;
+ }
+ if ($z + $i == @gif) {
+ print "EOF\n\n";
+ print "Unexpected end of file\n";
+ exit;
+ }
+ my $c = $gif[$z + $i];
+ printf "%.2x ", $c;
+ if (32 <= $c and $c <= 126) {
+ printf "'%c'", $c;
+ } else {
+ print " ";
+ }
+ print " ";
+ }
+ print "\n\n";
+
+ $z += $length;
+}
Propchange: trunk/libnsgif/examples/disassemble_gif.pl
------------------------------------------------------------------------------
svn:executable = *
14 years, 5 months
r5948 jmb - /trunk/netsurf/render/html.c
by netsurf@semichrome.net
Author: jmb
Date: Tue Dec 30 09:46:06 2008
New Revision: 5948
URL: http://source.netsurf-browser.org?rev=5948&view=rev
Log:
More lenient refresh delay parsing
Modified:
trunk/netsurf/render/html.c
Modified: trunk/netsurf/render/html.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/html.c?rev=5948&r1...
==============================================================================
--- trunk/netsurf/render/html.c (original)
+++ trunk/netsurf/render/html.c Tue Dec 30 09:46:06 2008
@@ -517,7 +517,9 @@
end = (char *) content + strlen((const char *) content);
- /* content := *LWS 1*DIGIT *LWS [';' *LWS *1url *LWS]
+ /* content := *LWS intpart fracpart? *LWS [';' *LWS *1url *LWS]
+ * intpart := 1*DIGIT
+ * fracpart := 1*('.' | DIGIT)
* url := "url" *LWS '=' *LWS (url-nq | url-sq | url-dq)
* url-nq := *urlchar
* url-sq := "'" *(urlchar | '"') "'"
@@ -526,13 +528,19 @@
* nonascii := [#x80-#xD7FF#xE000-#xFFFD#x10000-#x10FFFF]
*/
- /* *LWS 1*DIGIT */
+ /* *LWS intpart */
msg_data.delay = (int)strtol((char *) content, &url, 10);
/* a very small delay and self-referencing URL can cause a loop
* that grinds machines to a halt. To prevent this we set a
* minimum refresh delay of 1s. */
if (msg_data.delay < 1)
msg_data.delay = 1;
+
+ /* fracpart? (ignored, as delay is integer only) */
+ while (url < end && (('0' <= *url && *url <= '9') ||
+ *url == '.')) {
+ url++;
+ }
/* *LWS */
while (url < end && isspace(*url)) {
14 years, 5 months
r5947 chris_y - /trunk/netsurf/image/gif.c
by netsurf@semichrome.net
Author: chris_y
Date: Tue Dec 30 07:23:36 2008
New Revision: 5947
URL: http://source.netsurf-browser.org?rev=5947&view=rev
Log:
If a GIF has insufficient frame data, display the frames that have been decoded.
Modified:
trunk/netsurf/image/gif.c
Modified: trunk/netsurf/image/gif.c
URL: http://source.netsurf-browser.org/trunk/netsurf/image/gif.c?rev=5947&r1=5...
==============================================================================
--- trunk/netsurf/image/gif.c (original)
+++ trunk/netsurf/image/gif.c Tue Dec 30 07:23:36 2008
@@ -92,10 +92,9 @@
do {
res = gif_initialise(gif, c->source_size,
(unsigned char *)c->source_data);
- if (res != GIF_OK && res != GIF_WORKING) {
+ if (res != GIF_OK && res != GIF_WORKING && res != GIF_INSUFFICIENT_FRAME_DATA) {
switch (res)
{
- case GIF_INSUFFICIENT_FRAME_DATA:
case GIF_FRAME_DATA_ERROR:
case GIF_INSUFFICIENT_DATA:
case GIF_DATA_ERROR:
@@ -109,7 +108,7 @@
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
return false;
}
- } while (res != GIF_OK);
+ } while (res != GIF_OK && res != GIF_INSUFFICIENT_FRAME_DATA);
/* Abort on bad GIFs */
if ((gif->frame_count_partial == 0) || (gif->width == 0) ||
14 years, 5 months
r5946 adrianl - /trunk/netsurf/desktop/textinput.c
by netsurf@semichrome.net
Author: adrianl
Date: Tue Dec 30 00:27:12 2008
New Revision: 5946
URL: http://source.netsurf-browser.org?rev=5946&view=rev
Log:
Improve pasting into password boxes
Modified:
trunk/netsurf/desktop/textinput.c
Modified: trunk/netsurf/desktop/textinput.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/textinput.c?rev=5...
==============================================================================
--- trunk/netsurf/desktop/textinput.c (original)
+++ trunk/netsurf/desktop/textinput.c Tue Dec 30 00:27:12 2008
@@ -1447,10 +1447,7 @@
nchars < input->gadget->maxlength &&
*p != '\n' && *p != '\r') {
unsigned len = utf8_next(p, ep - p, 0);
-
- if (input->gadget->type == GADGET_PASSWORD)
- buf[nbytes++] = '*';
- else if (*p == ' ')
+ if (*p == ' ')
nbytes += utf8_from_ucs4(160, &buf[nbytes]);
else {
memcpy(&buf[nbytes], p, len);
@@ -1647,6 +1644,7 @@
{
char *text;
struct box *input = text_box->parent->parent;
+ bool hide;
if (bw->sel->defined)
delete_selection(bw->sel);
@@ -1671,7 +1669,18 @@
input->gadget->length += utf8_len;
input->gadget->value[input->gadget->length] = 0;
}
-
+
+ hide = (input->gadget && input->gadget->type == GADGET_PASSWORD);
+ if (hide) {
+ /* determine the number of '*'s to be inserted */
+ const char *eutf8 = utf8 + utf8_len;
+ utf8_len = 0;
+ while (utf8 < eutf8) {
+ utf8 += utf8_next(utf8, eutf8 - utf8, 0);
+ utf8_len++;
+ }
+ }
+
/* insert in text box */
text = talloc_realloc(bw->current_content, text_box->text,
char,
@@ -1684,13 +1693,15 @@
if (text_box->space &&
char_offset == text_box->length + text_box->space) {
- unsigned int last_off = utf8_prev(utf8, utf8_len);
-
- if (utf8[last_off] != ' ')
+ if (hide)
text_box->space = 0;
- else
- utf8_len = last_off;
-
+ else {
+ unsigned int last_off = utf8_prev(utf8, utf8_len);
+ if (utf8[last_off] != ' ')
+ text_box->space = 0;
+ else
+ utf8_len = last_off;
+ }
text_box->text[text_box->length++] = ' ';
} else {
memmove(text_box->text + char_offset + utf8_len,
@@ -1698,9 +1709,10 @@
text_box->length - char_offset);
}
- memcpy(text_box->text + char_offset,
- input->gadget->type == GADGET_PASSWORD ? "*": utf8,
- utf8_len);
+ if (hide)
+ memset(text_box->text + char_offset, '*', utf8_len);
+ else
+ memcpy(text_box->text + char_offset, utf8, utf8_len);
text_box->length += utf8_len;
/* nothing should assume that the text is terminated,
14 years, 5 months
r5945 chris_y - in /trunk/netsurf/amiga: gui.h plotters.c
by netsurf@semichrome.net
Author: chris_y
Date: Sun Dec 28 19:18:53 2008
New Revision: 5945
URL: http://source.netsurf-browser.org?rev=5945&view=rev
Log:
More efficient layers clipping
Modified:
trunk/netsurf/amiga/gui.h
trunk/netsurf/amiga/plotters.c
Modified: trunk/netsurf/amiga/gui.h
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.h?rev=5945&r1=5...
==============================================================================
--- trunk/netsurf/amiga/gui.h (original)
+++ trunk/netsurf/amiga/gui.h Sun Dec 28 19:18:53 2008
@@ -124,6 +124,7 @@
struct Layer_Info *layerinfo;
APTR areabuf;
APTR tmprasbuf;
+ struct Rectangle rect;
#ifdef NS_AMIGA_CAIRO
cairo_surface_t *surface;
cairo_t *cr;
Modified: trunk/netsurf/amiga/plotters.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/plotters.c?rev=5945...
==============================================================================
--- trunk/netsurf/amiga/plotters.c (original)
+++ trunk/netsurf/amiga/plotters.c Sun Dec 28 19:18:53 2008
@@ -244,21 +244,28 @@
bool ami_clip(int x0, int y0, int x1, int y1)
{
struct Region *reg = NULL;
- struct Rectangle rect;
if(currp->Layer)
{
- reg = NewRegion();
-
- rect.MinX = x0;
- rect.MinY = y0;
- rect.MaxX = x1-1;
- rect.MaxY = y1-1;
-
- OrRectRegion(reg,&rect);
+ reg = InstallClipRegion(currp->Layer,NULL);
+
+ if(!reg)
+ {
+ reg = NewRegion();
+ }
+ else
+ {
+ ClearRectRegion(reg,&glob.rect);
+ }
+
+ glob.rect.MinX = x0;
+ glob.rect.MinY = y0;
+ glob.rect.MaxX = x1-1;
+ glob.rect.MaxY = y1-1;
+
+ OrRectRegion(reg,&glob.rect);
reg = InstallClipRegion(currp->Layer,reg);
-
if(reg) DisposeRegion(reg);
}
14 years, 5 months
r5944 chris_y - /trunk/netsurf/amiga/plotters.c
by netsurf@semichrome.net
Author: chris_y
Date: Sun Dec 28 18:52:19 2008
New Revision: 5944
URL: http://source.netsurf-browser.org?rev=5944&view=rev
Log:
Complete set of Cairo plotters (from gtk_plotters.c).
All except the polygon plotter - as the graphics.library implementation has problems -
are disabled, but can be enabled by defining NS_AMIGA_CAIRO_ALL.
Using only the Cairo plotters is much slower than using only the graphics.library
plotters (especially clipping which is adding several seconds to rendering with Cairo)
and the default "mixed" Cairo state is the recommended configuration for 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=5944...
==============================================================================
--- trunk/netsurf/amiga/plotters.c (original)
+++ trunk/netsurf/amiga/plotters.c Sun Dec 28 18:52:19 2008
@@ -114,6 +114,7 @@
bool ami_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed)
{
+#ifndef NS_AMIGA_CAIRO_ALL
currp->PenWidth = line_width;
currp->PenHeight = line_width;
@@ -132,6 +133,19 @@
currp->PenWidth = 1;
currp->PenHeight = 1;
currp->LinePtrn = PATT_LINE;
+#else
+ ami_cairo_set_colour(glob.cr,c);
+ if (dotted) ami_cairo_set_dotted(glob.cr);
+ else if (dashed) ami_cairo_set_dashed(glob.cr);
+ else ami_cairo_set_solid(glob.cr);
+
+ if (line_width == 0)
+ line_width = 1;
+
+ cairo_set_line_width(glob.cr, line_width);
+ cairo_rectangle(glob.cr, x0, y0, width, height);
+ cairo_stroke(glob.cr);
+#endif
return true;
}
@@ -139,6 +153,7 @@
bool ami_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed)
{
+#ifndef NS_AMIGA_CAIRO_ALL
currp->PenWidth = width;
currp->PenHeight = width;
@@ -154,13 +169,27 @@
currp->PenWidth = 1;
currp->PenHeight = 1;
currp->LinePtrn = PATT_LINE;
-
+#else
+ ami_cairo_set_colour(glob.cr,c);
+ if (dotted) ami_cairo_set_dotted(glob.cr);
+ else if (dashed) ami_cairo_set_dashed(glob.cr);
+ else ami_cairo_set_solid(glob.cr);
+
+ if (width == 0)
+ width = 1;
+
+ cairo_set_line_width(glob.cr, width);
+ cairo_move_to(glob.cr, x0, y0 - 0.5);
+ cairo_line_to(glob.cr, x1, y1 - 0.5);
+ cairo_stroke(glob.cr);
+#endif
return true;
}
bool ami_polygon(int *p, unsigned int n, colour fill)
{
int k;
+#ifndef NS_AMIGA_CAIRO
ULONG cx,cy;
//DebugPrintF("poly\n");
@@ -179,17 +208,36 @@
AreaEnd(currp);
BNDRYOFF(currp);
+#else
+ ami_cairo_set_colour(glob.cr,fill);
+ ami_cairo_set_solid(glob.cr);
+
+ cairo_set_line_width(glob.cr, 0);
+ cairo_move_to(glob.cr, p[0], p[1]);
+ for (k = 1; k != n; k++) {
+ cairo_line_to(glob.cr, p[k * 2], p[k * 2 + 1]);
+ }
+ cairo_fill(glob.cr);
+ cairo_stroke(glob.cr);
+#endif
return true;
}
bool ami_fill(int x0, int y0, int x1, int y1, colour c)
{
- //DebugPrintF("fill %ld,%ld,%ld,%ld\n",x0,y0,x1,y1);
-
+#ifndef NS_AMIGA_CAIRO_ALL
p96RectFill(currp,x0,y0,x1-1,y1-1,
p96EncodeColor(RGBFB_A8B8G8R8,c));
-
+#else
+ ami_cairo_set_colour(glob.cr,c);
+ ami_cairo_set_solid(glob.cr);
+
+ cairo_set_line_width(glob.cr, 0);
+ cairo_rectangle(glob.cr, x0, y0, x1 - x0, y1 - y0);
+ cairo_fill(glob.cr);
+ cairo_stroke(glob.cr);
+#endif
return true;
}
@@ -214,6 +262,11 @@
if(reg) DisposeRegion(reg);
}
+#ifdef NS_AMIGA_CAIRO_ALL
+ cairo_reset_clip(glob.cr);
+ cairo_rectangle(glob.cr, x0, y0, x1 - x0, y1 - y0);
+ cairo_clip(glob.cr);
+#endif
return true;
}
@@ -261,6 +314,7 @@
bool ami_disc(int x, int y, int radius, colour c, bool filled)
{
+#ifndef NS_AMIGA_CAIRO_ALL
SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
TAG_DONE);
@@ -273,7 +327,22 @@
{
DrawEllipse(currp,x,y,radius,radius); // NB: does not support fill, need to use AreaCircle for that
}
-
+#else
+ ami_cairo_set_colour(glob.cr,c);
+ ami_cairo_set_solid(glob.cr);
+
+ if (filled)
+ cairo_set_line_width(glob.cr, 0);
+ else
+ cairo_set_line_width(glob.cr, 1);
+
+ cairo_arc(glob.cr, x, y, radius, 0, M_PI * 2);
+
+ if (filled)
+ cairo_fill(glob.cr);
+
+ cairo_stroke(glob.cr);
+#endif
return true;
}
@@ -352,7 +421,7 @@
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_Over_Dest,tbm,scaledbm,
+ 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,
14 years, 5 months
r5943 chris_y - in /trunk/netsurf/amiga: bitmap.c bitmap.h plotters.c
by netsurf@semichrome.net
Author: chris_y
Date: Sun Dec 28 09:55:52 2008
New Revision: 5943
URL: http://source.netsurf-browser.org?rev=5943&view=rev
Log:
Some bitmap caching - not making much difference and using up a lot of gfx mem, may
need to make this a configurable option.
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=5943&r...
==============================================================================
--- trunk/netsurf/amiga/bitmap.c (original)
+++ trunk/netsurf/amiga/bitmap.c Sun Dec 28 09:55:52 2008
@@ -20,6 +20,7 @@
#include "image/bitmap.h"
#include "amiga/bitmap.h"
#include <proto/exec.h>
+#include <proto/picasso96api.h>
/**
* Create a bitmap.
@@ -34,7 +35,7 @@
{
struct bitmap *bitmap;
- bitmap = AllocVec(sizeof(struct bitmap),MEMF_PRIVATE);
+ bitmap = AllocVec(sizeof(struct bitmap),MEMF_PRIVATE | MEMF_CLEAR);
if(bitmap)
{
bitmap->pixdata = AllocVecTags(width*height*4,
@@ -101,6 +102,7 @@
if(bm)
{
+ if(bm->nativebm) p96FreeBitMap(bm->nativebm);
FreeVec(bm->pixdata);
bm->pixdata = NULL;
FreeVec(bm);
@@ -129,6 +131,10 @@
* \param bitmap a bitmap, as returned by bitmap_create()
*/
void bitmap_modified(void *bitmap) {
+ struct bitmap *bm = bitmap;
+
+ p96FreeBitMap(bm->nativebm);
+ bm->nativebm = NULL;
}
Modified: trunk/netsurf/amiga/bitmap.h
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/bitmap.h?rev=5943&r...
==============================================================================
--- trunk/netsurf/amiga/bitmap.h (original)
+++ trunk/netsurf/amiga/bitmap.h Sun Dec 28 09:55:52 2008
@@ -19,11 +19,16 @@
#ifndef AMIGA_BITMAP_H
#define AMIGA_BITMAP_H
#include <exec/types.h>
+#include <proto/graphics.h>
+
struct bitmap {
int width;
int height;
UBYTE *pixdata;
bool opaque;
+ struct BitMap *nativebm;
+ int nativebmwidth;
+ int nativebmheight;
};
#endif
Modified: trunk/netsurf/amiga/plotters.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/plotters.c?rev=5943...
==============================================================================
--- trunk/netsurf/amiga/plotters.c (original)
+++ trunk/netsurf/amiga/plotters.c Sun Dec 28 09:55:52 2008
@@ -318,25 +318,41 @@
SetRPAttrs(currp,RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,bg),
TAG_DONE);
*/
- 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)
+
+ if(bitmap->nativebm)
+ {
+ if((bitmap->nativebmwidth != width) || (bitmap->nativebmheight != height))
{
- CompositeTags(COMPOSITE_Src_Over_Dest,tbm,scaledbm,
+ 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_Over_Dest,tbm,scaledbm,
COMPTAG_ScaleX,COMP_FLOAT_TO_FIX(width/bitmap->width),
COMPTAG_ScaleY,COMP_FLOAT_TO_FIX(height/bitmap->height),
COMPTAG_Flags,COMPFLAG_IgnoreDestAlpha,
@@ -348,32 +364,68 @@
COMPTAG_OffsetY,0,
COMPTAG_FriendBitMap,currp->BitMap,
TAG_DONE);
- }
- else /* do it the old-fashioned way. This is pretty slow, but probably
+ }
+ 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);
+
+ bitmap->nativebm = scaledbm;
+ //p96FreeBitMap(scaledbm);
+
+ }
+ else
{
- 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,tbm,
+ BLITA_Dest,currp,
+ BLITA_DestX,x,
+ BLITA_DestY,y,
+ BLITA_SrcType,BLITT_BITMAP,
+ BLITA_DestType,BLITT_RASTPORT,
+ BLITA_UseSrcAlpha,!bitmap->opaque,
+ TAG_DONE);
+
+ bitmap->nativebm = tbm;
+ }
+
+ bitmap->nativebmwidth = width;
+ bitmap->nativebmheight = height;
+ }
+ else
+ {
BltBitMapTags(BLITA_Width,width,
BLITA_Height,height,
- BLITA_Source,scaledbm,
+ BLITA_Source,tbm,
BLITA_Dest,currp,
BLITA_DestX,x,
BLITA_DestY,y,
@@ -381,25 +433,9 @@
BLITA_DestType,BLITT_RASTPORT,
BLITA_UseSrcAlpha,!bitmap->opaque,
TAG_DONE);
-
- p96FreeBitMap(scaledbm);
-
- }
- else
- {
- BltBitMapTags(BLITA_Width,width,
- BLITA_Height,height,
- BLITA_Source,&trp,
- BLITA_Dest,currp,
- BLITA_DestX,x,
- BLITA_DestY,y,
- BLITA_SrcType,BLITT_RASTPORT,
- BLITA_DestType,BLITT_RASTPORT,
- BLITA_UseSrcAlpha,!bitmap->opaque,
- TAG_DONE);
- }
-
- p96FreeBitMap(tbm);
+ }
+
+// p96FreeBitMap(tbm);
return true;
}
@@ -418,14 +454,34 @@
SetRPAttrs(currp,RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,bg),
TAG_DONE);
*/
- 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(bitmap->nativebm)
+ {
+ if((bitmap->nativebmwidth != bitmap->width) || (bitmap->nativebmheight != bitmap->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,0,currp->BitMap,RGBFB_R8G8B8A8);
+ InitRastPort(&trp);
+ trp.BitMap = tbm;
+ p96WritePixelArray((struct RenderInfo *)&ri,0,0,&trp,0,0,bitmap->width,bitmap->height);
+ bitmap->nativebm = tbm;
+ bitmap->nativebmwidth = bitmap->width;
+ bitmap->nativebmheight = bitmap->height;
+ }
max_width = (repeat_x ? scrn->Width : width);
max_height = (repeat_y ? scrn->Height : height);
@@ -457,18 +513,18 @@
BltBitMapTags(BLITA_Width,wf,
BLITA_Height,hf,
- BLITA_Source,&trp,
+ BLITA_Source,tbm,
BLITA_Dest,currp,
BLITA_DestX,x+xf,
BLITA_DestY,y+yf,
- BLITA_SrcType,BLITT_RASTPORT,
+ BLITA_SrcType,BLITT_BITMAP,
BLITA_DestType,BLITT_RASTPORT,
BLITA_UseSrcAlpha,!bitmap->opaque,
TAG_DONE);
}
}
- p96FreeBitMap(tbm);
+// p96FreeBitMap(tbm);
return true;
}
14 years, 5 months
r5942 chris_y - in /trunk/netsurf/amiga: compat.c compat.h
by netsurf@semichrome.net
Author: chris_y
Date: Sun Dec 28 07:49:26 2008
New Revision: 5942
URL: http://source.netsurf-browser.org?rev=5942&view=rev
Log:
Update for new SDK
Modified:
trunk/netsurf/amiga/compat.c
trunk/netsurf/amiga/compat.h
Modified: trunk/netsurf/amiga/compat.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/compat.c?rev=5942&r...
==============================================================================
--- trunk/netsurf/amiga/compat.c (original)
+++ trunk/netsurf/amiga/compat.c Sun Dec 28 07:49:26 2008
@@ -49,7 +49,7 @@
{
/* dummy */
}
-
+/*
int uname(struct utsname *uts)
{
struct Library *VersionBase;
@@ -75,7 +75,7 @@
strcpy(uts->machine,"ppc");
}
-
+*/
uid_t geteuid(void)
{
return 0;
Modified: trunk/netsurf/amiga/compat.h
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/compat.h?rev=5942&r...
==============================================================================
--- trunk/netsurf/amiga/compat.h (original)
+++ trunk/netsurf/amiga/compat.h Sun Dec 28 07:49:26 2008
@@ -18,29 +18,12 @@
#ifndef AMIGA_COMPAT_H
#define AMIGA_COMPAT_H
-//#include <sys/unistd.h>
#include <sys/utsname.h>
/* for termios.h compatiblity */
-typedef unsigned int tcflag_t;
-typedef unsigned char cc_t;
-typedef unsigned int speed_t;
-
-#define NCCS 16
-
struct termios {
- tcflag_t c_iflag;
- tcflag_t c_oflag;
- tcflag_t c_cflag;
- tcflag_t c_lflag;
- cc_t c_cc[NCCS];
- /* Private */
- speed_t c_ispeed;
- speed_t c_ospeed;
- int type;
- unsigned int flags;
+ /* dummy */
};
-/**/
extern gid_t getegid(void);
extern uid_t geteuid(void);
@@ -49,7 +32,6 @@
extern int tcsetattr(int fildes, int optional_actions, const struct termios *termios_p);
extern int tcgetattr(int fildes, struct termios *termios_p);
-//char *strndup(const char *,size_t);
extern int strcasecmp(const char *, const char *);
-extern int uname(struct utsname *);
+//extern int uname(struct utsname *);
#endif
14 years, 5 months
r5941 chris_y - /trunk/netsurf/amiga/gui.c
by netsurf@semichrome.net
Author: chris_y
Date: Sun Dec 28 06:35:55 2008
New Revision: 5941
URL: http://source.netsurf-browser.org?rev=5941&view=rev
Log:
Fix crash when launching NetSurf if it is already running.
Modified:
trunk/netsurf/amiga/gui.c
Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=5941&r1=5...
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Sun Dec 28 06:35:55 2008
@@ -485,56 +485,42 @@
scrn = LockPubScreen("Workbench");
locked_screen = TRUE;
}
- }
-
-/* init shared bitmaps */
- glob.bm = p96AllocBitMap(scrn->Width,scrn->Height,32,
- BMF_CLEAR | BMF_DISPLAYABLE | BMF_INTERLEAVED,
- scrn->RastPort.BitMap,RGBFB_A8R8G8B8);
-
- if(!glob.bm)
- {
- warn_user("NoMemory","");
- //browser_window_destroy(bw);
- //return NULL;
- }
-
- InitRastPort(&glob.rp);
- glob.rp.BitMap = glob.bm;
- SetDrMd(&glob.rp,BGBACKFILL);
-
- glob.layerinfo = NewLayerInfo();
- glob.rp.Layer = CreateUpfrontLayer(glob.layerinfo,glob.bm,0,0,scrn->Width-1,scrn->Height-1,0,NULL);
-
- glob.areabuf = AllocVec(100,MEMF_PRIVATE | MEMF_CLEAR);
- glob.rp.AreaInfo = AllocVec(sizeof(struct AreaInfo),MEMF_PRIVATE | MEMF_CLEAR);
-
- if((!glob.areabuf) || (!glob.rp.AreaInfo))
- {
- warn_user("NoMemory","");
- //browser_window_destroy(bw);
- //return NULL;
- }
-
- 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);
-
- if((!glob.tmprasbuf) || (!glob.rp.TmpRas))
- {
- warn_user("NoMemory","");
- //browser_window_destroy(bw);
- //return NULL;
- }
-
- InitTmpRas(glob.rp.TmpRas,glob.tmprasbuf,scrn->Width*scrn->Height);
- currp = &glob.rp;
+
+ /* init shared bitmaps */
+ glob.bm = p96AllocBitMap(scrn->Width,scrn->Height,32,
+ BMF_CLEAR | BMF_DISPLAYABLE | BMF_INTERLEAVED,
+ scrn->RastPort.BitMap,RGBFB_A8R8G8B8);
+
+ if(!glob.bm) warn_user("NoMemory","");
+
+ InitRastPort(&glob.rp);
+ glob.rp.BitMap = glob.bm;
+ SetDrMd(&glob.rp,BGBACKFILL);
+
+ glob.layerinfo = NewLayerInfo();
+ glob.rp.Layer = CreateUpfrontLayer(glob.layerinfo,glob.bm,0,0,
+ scrn->Width-1,scrn->Height-1,0,NULL);
+
+ glob.areabuf = AllocVec(100,MEMF_PRIVATE | MEMF_CLEAR);
+ glob.rp.AreaInfo = AllocVec(sizeof(struct AreaInfo),MEMF_PRIVATE | MEMF_CLEAR);
+
+ if((!glob.areabuf) || (!glob.rp.AreaInfo)) warn_user("NoMemory","");
+
+ 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);
+
+ if((!glob.tmprasbuf) || (!glob.rp.TmpRas)) warn_user("NoMemory","");
+
+ InitTmpRas(glob.rp.TmpRas,glob.tmprasbuf,scrn->Width*scrn->Height);
+ currp = &glob.rp;
#ifdef NS_AMIGA_CAIRO
- glob.surface = cairo_amigaos_surface_create(glob.bm);
- glob.cr = cairo_create(glob.surface);
+ glob.surface = cairo_amigaos_surface_create(glob.bm);
+ glob.cr = cairo_create(glob.surface);
#endif
-/* init shared bitmaps */
+ /* init shared bitmaps */
+ }
if(argc) // argc==0 is started from wb
{
14 years, 5 months