Gitweb links:
...log
http://git.netsurf-browser.org/libpencil.git/shortlog/42430ca115c0b52ca262382ccc476d227d1655c4
...commit
http://git.netsurf-browser.org/libpencil.git/commit/42430ca115c0b52ca262382ccc476d227d1655c4
...tree
http://git.netsurf-browser.org/libpencil.git/tree/42430ca115c0b52ca262382ccc476d227d1655c4
The branch, master has been updated
via 42430ca115c0b52ca262382ccc476d227d1655c4 (commit)
via 753a566e6f623286171685c2f57a561e7f35b6f9 (commit)
via 13fa47d2bbafeae95312c8e552bb106bffc54d12 (commit)
via 1ed1f57f878cd1eaf84634e597317c3bc28f4f6d (commit)
from aec3cd021f22c5bbc83751a4b8dd5b149f770a01 (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/libpencil.git/commit/?id=42430ca115c0b52ca262382ccc476d227d1655c4
commit 42430ca115c0b52ca262382ccc476d227d1655c4
Author: John-Mark Bell <[email protected]>
Commit: John-Mark Bell <[email protected]>
Test: add astral char; cope with squashed sprites
diff --git a/test/pencil_test.c b/test/pencil_test.c
index 04522ee..3113f1a 100644
--- a/test/pencil_test.c
+++ b/test/pencil_test.c
@@ -9,6 +9,7 @@
#include <stdio.h>
#include <oslib/osfile.h>
#include <oslib/osspriteop.h>
+#include <oslib/squash.h>
#include <rufl.h>
#include "pencil.h"
@@ -46,12 +47,13 @@ void test_pencil(void)
pencil_code code;
int path[] = {2, 100, 40, 8, 100, 400, 8, 300, 300, 0};
char utf8_test[] = "Hello, world! ὕαλον "
- "Uherské Hradiště. 𐀀";
+ "Uherské Hradiště. 𐀀\xf0\xa0\x80\xa1";
char *drawfile_buffer;
size_t drawfile_size;
os_error *error;
fileswitch_object_type obj_type;
int size;
+ bits load;
osspriteop_area *area;
diagram = pencil_create();
@@ -94,7 +96,7 @@ void test_pencil(void)
return;
}
- error = xosfile_read_no_path(SPRITE, &obj_type, 0, 0, &size, 0);
+ error = xosfile_read_no_path(SPRITE, &obj_type, &load, 0, &size, 0);
if (error) {
printf("xosfile_read_no_path failed: 0x%x: %s\n",
error->errnum, error->errmess);
@@ -104,23 +106,121 @@ void test_pencil(void)
printf("File " SPRITE " does not exist\n");
return;
}
-
- area = malloc(size + 4);
- if (!area) {
- printf("Out of memory\n");
+ if ((load & 0xfff00000) != 0xfff00000 ||
+ ((load & 0xfff00) != 0xff900 &&
+ (load & 0xfff00) != 0xfca00)) {
+ printf("File " SPRITE " is not a sprite file\n");
return;
}
- area->size = size + 4;
- area->sprite_count = 0;
- area->first = 0;
- area->used = 16;
- error = xosspriteop_load_sprite_file(osspriteop_USER_AREA,
- area, SPRITE);
- if (error) {
- printf("xosspriteop_load_sprite_file failed: 0x%x: %s\n",
- error->errnum, error->errmess);
- return;
+ if ((load & 0xfff00) == 0xfca00) {
+ /* File is squashed */
+ squash_output_status status;
+ struct squash_file_base sf;
+ char *buf, *ws;
+ int wslen;
+ FILE *fp;
+
+ fp = fopen(SPRITE, "r");
+ if (!fp) {
+ printf("Failed opening " SPRITE "\n");
+ return;
+ }
+ if (fread(&sf, 1, sizeof(sf), fp) != sizeof(sf)) {
+ printf("Failed loading squash header\n");
+ fclose(fp);
+ return;
+ }
+ if ((sf.load_addr & 0xffffff00) != 0xfffff900) {
+ printf("File " SPRITE " is not a sprite file\n");
+ fclose(fp);
+ return;
+ }
+
+ buf = malloc(size - sizeof(sf));
+ if (!buf) {
+ printf("Out of memory\n");
+ fclose(fp);
+ return;
+ }
+ if (fread(buf, 1, size - sizeof(sf), fp) != size - sizeof(sf)) {
+ printf("Failed reading squashed data\n");
+ free(buf);
+ fclose(fp);
+ return;
+ }
+
+ error = xsquash_decompress_return_sizes(size - sizeof(sf),
+ &wslen, NULL);
+ if (error) {
+ printf("xsquash_decompress_return_sizes failed: 0x%x:
%s\n",
+ error->errnum, error->errmess);
+ free(buf);
+ fclose(fp);
+ return;
+ }
+
+ ws = malloc(wslen);
+ if (!ws) {
+ printf("Out of memory\n");
+ free(buf);
+ fclose(fp);
+ return;
+ }
+
+ area = malloc(sf.size + 4);
+ if (!area) {
+ printf("Out of memory\n");
+ free(ws);
+ free(buf);
+ fclose(fp);
+ return;
+ }
+ area->size = sf.size + 4;
+
+ error = xsquash_decompress(squash_INPUT_ALL_PRESENT, ws,
+ (byte *) buf, size - sizeof(sf),
+ (byte *) &area->sprite_count, sf.size,
+ &status, NULL, NULL, NULL, NULL);
+ if (error) {
+ printf("xsquash_decompress failed: 0x%x: %s\n",
+ error->errnum, error->errmess);
+ free(area);
+ free(ws);
+ free(buf);
+ fclose(fp);
+ return;
+ }
+ if (status != 0) {
+ printf("xsquash_decompress did not complete: %x\n",
status);
+ free(area);
+ free(ws);
+ free(buf);
+ fclose(fp);
+ return;
+ }
+
+ free(ws);
+ free(buf);
+ fclose(fp);
+ } else {
+ area = malloc(size + 4);
+ if (!area) {
+ printf("Out of memory\n");
+ return;
+ }
+ area->size = size + 4;
+ area->sprite_count = 0;
+ area->first = 0;
+ area->used = 16;
+
+ error = xosspriteop_load_sprite_file(osspriteop_USER_AREA,
+ area, SPRITE);
+ if (error) {
+ printf("xosspriteop_load_sprite_file failed: 0x%x:
%s\n",
+ error->errnum, error->errmess);
+ return;
+ }
}
code = pencil_sprite(diagram, 400, 200, 200, 100,
commitdiff
http://git.netsurf-browser.org/libpencil.git/commit/?id=753a566e6f623286171685c2f57a561e7f35b6f9
commit 753a566e6f623286171685c2f57a561e7f35b6f9
Author: John-Mark Bell <[email protected]>
Commit: John-Mark Bell <[email protected]>
Link RISC OS test binaries statically
diff --git a/Makefile b/Makefile
index 0f41843..039c3e5 100644
--- a/Makefile
+++ b/Makefile
@@ -34,6 +34,7 @@ ifneq ($(findstring clean,$(MAKECMDGOALS)),clean)
ifeq ($(HOST),arm-unknown-riscos)
CFLAGS := $(CFLAGS) -I$(PREFIX)/include
LDFLAGS := $(LDFLAGS) -lOSLib32
+ TESTLDFLAGS := $(TESTLDFLAGS) -static
endif
endif
commitdiff
http://git.netsurf-browser.org/libpencil.git/commit/?id=13fa47d2bbafeae95312c8e552bb106bffc54d12
commit 13fa47d2bbafeae95312c8e552bb106bffc54d12
Author: John-Mark Bell <[email protected]>
Commit: John-Mark Bell <[email protected]>
Need OSLib when building tests for RISC OS
More fallout from the ancient BUILD/HOST confusion
diff --git a/Makefile b/Makefile
index 239436e..0f41843 100644
--- a/Makefile
+++ b/Makefile
@@ -31,7 +31,7 @@ endif
# OSLib
ifneq ($(findstring clean,$(MAKECMDGOALS)),clean)
- ifeq ($(BUILD),arm-unknown-riscos)
+ ifeq ($(HOST),arm-unknown-riscos)
CFLAGS := $(CFLAGS) -I$(PREFIX)/include
LDFLAGS := $(LDFLAGS) -lOSLib32
endif
commitdiff
http://git.netsurf-browser.org/libpencil.git/commit/?id=1ed1f57f878cd1eaf84634e597317c3bc28f4f6d
commit 1ed1f57f878cd1eaf84634e597317c3bc28f4f6d
Author: John-Mark Bell <[email protected]>
Commit: John-Mark Bell <[email protected]>
Update following librufl API changes
diff --git a/src/pencil_save.c b/src/pencil_save.c
index f5c23fb..c2cd390 100644
--- a/src/pencil_save.c
+++ b/src/pencil_save.c
@@ -46,13 +46,13 @@ static void pencil_save_pass1(struct pencil_save_context
*context,
struct pencil_item *item, unsigned int depth);
static void pencil_save_pass1_text_callback(void *c,
const char *font_name, unsigned int font_size,
- const char *s8, unsigned short *s16, unsigned int n,
+ const uint8_t *s8, const uint32_t *s32, unsigned int n,
int x, int y);
static void pencil_save_pass2(struct pencil_save_context *context,
struct pencil_item *item, unsigned int depth);
static void pencil_save_pass2_text_callback(void *c,
const char *font_name, unsigned int font_size,
- const char *s8, unsigned short *s16, unsigned int n,
+ const uint8_t *s8, const uint32_t *s32, unsigned int n,
int x, int y);
@@ -192,7 +192,7 @@ void pencil_save_pass1(struct pencil_save_context *context,
break;
case pencil_TEXT:
{
- int bbox[4];
+ os_box bbox;
int width;
code = rufl_paint_callback(item->font_family, item->font_style,
@@ -205,7 +205,7 @@ void pencil_save_pass1(struct pencil_save_context *context,
return;
code = rufl_font_bbox(item->font_family, item->font_style,
- item->font_size, bbox);
+ item->font_size, &bbox);
if (code != rufl_OK)
context->code = code;
if (context->code != pencil_OK)
@@ -222,7 +222,7 @@ void pencil_save_pass1(struct pencil_save_context *context,
item->bbox.x0 = item->x * 256;
item->bbox.y0 = item->y * 256;
item->bbox.x1 = (item->x + width) * 256;
- item->bbox.y1 = (item->y + (bbox[3] - bbox[1])) * 256;
+ item->bbox.y1 = (item->y + (bbox.y1 - bbox.y0)) * 256;
}
break;
case pencil_PATH:
@@ -290,7 +290,7 @@ void pencil_save_pass1(struct pencil_save_context *context,
void pencil_save_pass1_text_callback(void *c,
const char *font_name, unsigned int font_size,
- const char *s8, unsigned short *s16, unsigned int n,
+ const uint8_t *s8, const uint32_t *s32, unsigned int n,
int x, int y)
{
struct pencil_save_context *context = c;
@@ -301,7 +301,7 @@ void pencil_save_pass1_text_callback(void *c,
(void) x; /* unused */
(void) y; /* unused */
- assert(s8 || s16);
+ assert(s8 || s32);
/* check if the font name is new */
for (i = 0; i != context->font_count &&
@@ -331,12 +331,14 @@ void pencil_save_pass1_text_callback(void *c,
} else {
unsigned int utf8_length = 0;
for (i = 0; i != n; i++) {
- if (s16[i] < 0x80)
+ if (s32[i] < 0x80)
utf8_length += 1;
- else if (s16[i] < 0x800)
+ else if (s32[i] < 0x800)
utf8_length += 2;
- else
+ else if (s32[i] < 0x10000)
utf8_length += 3;
+ else
+ utf8_length += 4;
}
context->size += 24 + 56 + ((utf8_length + 4) & ~3);
}
@@ -470,14 +472,14 @@ void pencil_save_pass2(struct pencil_save_context
*context,
void pencil_save_pass2_text_callback(void *c,
const char *font_name, unsigned int font_size,
- const char *s8, unsigned short *s16, unsigned int n,
+ const uint8_t *s8, const uint32_t *s32, unsigned int n,
int x, int y)
{
struct pencil_save_context *context = c;
drawfile_object *object = (drawfile_object *) context->b;
unsigned int i;
- assert(s8 || s16);
+ assert(s8 || s32);
/* find font index */
for (i = 0; i != context->font_count &&
@@ -506,24 +508,30 @@ void pencil_save_pass2_text_callback(void *c,
object->data.trfm_text.base.y = y * 256;
if (s8) {
- strncpy(object->data.trfm_text.text, s8, n);
+ strncpy(object->data.trfm_text.text, (const char *) s8, n);
object->size = 24 + 56 + ((n + 4) & ~3);
} else {
char *z = object->data.trfm_text.text;
unsigned int utf8_length = 0;
for (i = 0; i != n; i++) {
- if (s16[i] < 0x80) {
- *z++ = s16[i];
+ if (s32[i] < 0x80) {
+ *z++ = s32[i];
utf8_length += 1;
- } else if (s16[i] < 0x800) {
- *z++ = 0xc0 | ((s16[i] >> 6) & 0x1f);
- *z++ = 0x80 | (s16[i] & 0x3f);
+ } else if (s32[i] < 0x800) {
+ *z++ = 0xc0 | ((s32[i] >> 6) & 0x1f);
+ *z++ = 0x80 | (s32[i] & 0x3f);
utf8_length += 2;
- } else {
- *z++ = 0xe0 | (s16[i] >> 12);
- *z++ = 0x80 | ((s16[i] >> 6) & 0x3f);
- *z++ = 0x80 | (s16[i] & 0x3f);
+ } else if (s32[i] < 0x10000) {
+ *z++ = 0xe0 | (s32[i] >> 12);
+ *z++ = 0x80 | ((s32[i] >> 6) & 0x3f);
+ *z++ = 0x80 | (s32[i] & 0x3f);
utf8_length += 3;
+ } else {
+ *z++ = 0xf0 | (s32[i] >> 18);
+ *z++ = 0x80 | ((s32[i] >> 12) & 0x3f);
+ *z++ = 0x80 | ((s32[i] >> 6) & 0x3f);
+ *z++ = 0x80 | (s32[i] & 0x3f);
+ utf8_length += 4;
}
}
object->size = 24 + 56 + ((utf8_length + 4) & ~3);
-----------------------------------------------------------------------
Summary of changes:
Makefile | 3 +-
src/pencil_save.c | 52 ++++++++++++---------
test/pencil_test.c | 132 +++++++++++++++++++++++++++++++++++++++++++++-------
3 files changed, 148 insertions(+), 39 deletions(-)
diff --git a/Makefile b/Makefile
index 239436e..039c3e5 100644
--- a/Makefile
+++ b/Makefile
@@ -31,9 +31,10 @@ endif
# OSLib
ifneq ($(findstring clean,$(MAKECMDGOALS)),clean)
- ifeq ($(BUILD),arm-unknown-riscos)
+ ifeq ($(HOST),arm-unknown-riscos)
CFLAGS := $(CFLAGS) -I$(PREFIX)/include
LDFLAGS := $(LDFLAGS) -lOSLib32
+ TESTLDFLAGS := $(TESTLDFLAGS) -static
endif
endif
diff --git a/src/pencil_save.c b/src/pencil_save.c
index f5c23fb..c2cd390 100644
--- a/src/pencil_save.c
+++ b/src/pencil_save.c
@@ -46,13 +46,13 @@ static void pencil_save_pass1(struct pencil_save_context
*context,
struct pencil_item *item, unsigned int depth);
static void pencil_save_pass1_text_callback(void *c,
const char *font_name, unsigned int font_size,
- const char *s8, unsigned short *s16, unsigned int n,
+ const uint8_t *s8, const uint32_t *s32, unsigned int n,
int x, int y);
static void pencil_save_pass2(struct pencil_save_context *context,
struct pencil_item *item, unsigned int depth);
static void pencil_save_pass2_text_callback(void *c,
const char *font_name, unsigned int font_size,
- const char *s8, unsigned short *s16, unsigned int n,
+ const uint8_t *s8, const uint32_t *s32, unsigned int n,
int x, int y);
@@ -192,7 +192,7 @@ void pencil_save_pass1(struct pencil_save_context *context,
break;
case pencil_TEXT:
{
- int bbox[4];
+ os_box bbox;
int width;
code = rufl_paint_callback(item->font_family, item->font_style,
@@ -205,7 +205,7 @@ void pencil_save_pass1(struct pencil_save_context *context,
return;
code = rufl_font_bbox(item->font_family, item->font_style,
- item->font_size, bbox);
+ item->font_size, &bbox);
if (code != rufl_OK)
context->code = code;
if (context->code != pencil_OK)
@@ -222,7 +222,7 @@ void pencil_save_pass1(struct pencil_save_context *context,
item->bbox.x0 = item->x * 256;
item->bbox.y0 = item->y * 256;
item->bbox.x1 = (item->x + width) * 256;
- item->bbox.y1 = (item->y + (bbox[3] - bbox[1])) * 256;
+ item->bbox.y1 = (item->y + (bbox.y1 - bbox.y0)) * 256;
}
break;
case pencil_PATH:
@@ -290,7 +290,7 @@ void pencil_save_pass1(struct pencil_save_context *context,
void pencil_save_pass1_text_callback(void *c,
const char *font_name, unsigned int font_size,
- const char *s8, unsigned short *s16, unsigned int n,
+ const uint8_t *s8, const uint32_t *s32, unsigned int n,
int x, int y)
{
struct pencil_save_context *context = c;
@@ -301,7 +301,7 @@ void pencil_save_pass1_text_callback(void *c,
(void) x; /* unused */
(void) y; /* unused */
- assert(s8 || s16);
+ assert(s8 || s32);
/* check if the font name is new */
for (i = 0; i != context->font_count &&
@@ -331,12 +331,14 @@ void pencil_save_pass1_text_callback(void *c,
} else {
unsigned int utf8_length = 0;
for (i = 0; i != n; i++) {
- if (s16[i] < 0x80)
+ if (s32[i] < 0x80)
utf8_length += 1;
- else if (s16[i] < 0x800)
+ else if (s32[i] < 0x800)
utf8_length += 2;
- else
+ else if (s32[i] < 0x10000)
utf8_length += 3;
+ else
+ utf8_length += 4;
}
context->size += 24 + 56 + ((utf8_length + 4) & ~3);
}
@@ -470,14 +472,14 @@ void pencil_save_pass2(struct pencil_save_context
*context,
void pencil_save_pass2_text_callback(void *c,
const char *font_name, unsigned int font_size,
- const char *s8, unsigned short *s16, unsigned int n,
+ const uint8_t *s8, const uint32_t *s32, unsigned int n,
int x, int y)
{
struct pencil_save_context *context = c;
drawfile_object *object = (drawfile_object *) context->b;
unsigned int i;
- assert(s8 || s16);
+ assert(s8 || s32);
/* find font index */
for (i = 0; i != context->font_count &&
@@ -506,24 +508,30 @@ void pencil_save_pass2_text_callback(void *c,
object->data.trfm_text.base.y = y * 256;
if (s8) {
- strncpy(object->data.trfm_text.text, s8, n);
+ strncpy(object->data.trfm_text.text, (const char *) s8, n);
object->size = 24 + 56 + ((n + 4) & ~3);
} else {
char *z = object->data.trfm_text.text;
unsigned int utf8_length = 0;
for (i = 0; i != n; i++) {
- if (s16[i] < 0x80) {
- *z++ = s16[i];
+ if (s32[i] < 0x80) {
+ *z++ = s32[i];
utf8_length += 1;
- } else if (s16[i] < 0x800) {
- *z++ = 0xc0 | ((s16[i] >> 6) & 0x1f);
- *z++ = 0x80 | (s16[i] & 0x3f);
+ } else if (s32[i] < 0x800) {
+ *z++ = 0xc0 | ((s32[i] >> 6) & 0x1f);
+ *z++ = 0x80 | (s32[i] & 0x3f);
utf8_length += 2;
- } else {
- *z++ = 0xe0 | (s16[i] >> 12);
- *z++ = 0x80 | ((s16[i] >> 6) & 0x3f);
- *z++ = 0x80 | (s16[i] & 0x3f);
+ } else if (s32[i] < 0x10000) {
+ *z++ = 0xe0 | (s32[i] >> 12);
+ *z++ = 0x80 | ((s32[i] >> 6) & 0x3f);
+ *z++ = 0x80 | (s32[i] & 0x3f);
utf8_length += 3;
+ } else {
+ *z++ = 0xf0 | (s32[i] >> 18);
+ *z++ = 0x80 | ((s32[i] >> 12) & 0x3f);
+ *z++ = 0x80 | ((s32[i] >> 6) & 0x3f);
+ *z++ = 0x80 | (s32[i] & 0x3f);
+ utf8_length += 4;
}
}
object->size = 24 + 56 + ((utf8_length + 4) & ~3);
diff --git a/test/pencil_test.c b/test/pencil_test.c
index 04522ee..3113f1a 100644
--- a/test/pencil_test.c
+++ b/test/pencil_test.c
@@ -9,6 +9,7 @@
#include <stdio.h>
#include <oslib/osfile.h>
#include <oslib/osspriteop.h>
+#include <oslib/squash.h>
#include <rufl.h>
#include "pencil.h"
@@ -46,12 +47,13 @@ void test_pencil(void)
pencil_code code;
int path[] = {2, 100, 40, 8, 100, 400, 8, 300, 300, 0};
char utf8_test[] = "Hello, world! ὕαλον "
- "Uherské Hradiště. 𐀀";
+ "Uherské Hradiště. 𐀀\xf0\xa0\x80\xa1";
char *drawfile_buffer;
size_t drawfile_size;
os_error *error;
fileswitch_object_type obj_type;
int size;
+ bits load;
osspriteop_area *area;
diagram = pencil_create();
@@ -94,7 +96,7 @@ void test_pencil(void)
return;
}
- error = xosfile_read_no_path(SPRITE, &obj_type, 0, 0, &size, 0);
+ error = xosfile_read_no_path(SPRITE, &obj_type, &load, 0, &size, 0);
if (error) {
printf("xosfile_read_no_path failed: 0x%x: %s\n",
error->errnum, error->errmess);
@@ -104,23 +106,121 @@ void test_pencil(void)
printf("File " SPRITE " does not exist\n");
return;
}
-
- area = malloc(size + 4);
- if (!area) {
- printf("Out of memory\n");
+ if ((load & 0xfff00000) != 0xfff00000 ||
+ ((load & 0xfff00) != 0xff900 &&
+ (load & 0xfff00) != 0xfca00)) {
+ printf("File " SPRITE " is not a sprite file\n");
return;
}
- area->size = size + 4;
- area->sprite_count = 0;
- area->first = 0;
- area->used = 16;
- error = xosspriteop_load_sprite_file(osspriteop_USER_AREA,
- area, SPRITE);
- if (error) {
- printf("xosspriteop_load_sprite_file failed: 0x%x: %s\n",
- error->errnum, error->errmess);
- return;
+ if ((load & 0xfff00) == 0xfca00) {
+ /* File is squashed */
+ squash_output_status status;
+ struct squash_file_base sf;
+ char *buf, *ws;
+ int wslen;
+ FILE *fp;
+
+ fp = fopen(SPRITE, "r");
+ if (!fp) {
+ printf("Failed opening " SPRITE "\n");
+ return;
+ }
+ if (fread(&sf, 1, sizeof(sf), fp) != sizeof(sf)) {
+ printf("Failed loading squash header\n");
+ fclose(fp);
+ return;
+ }
+ if ((sf.load_addr & 0xffffff00) != 0xfffff900) {
+ printf("File " SPRITE " is not a sprite file\n");
+ fclose(fp);
+ return;
+ }
+
+ buf = malloc(size - sizeof(sf));
+ if (!buf) {
+ printf("Out of memory\n");
+ fclose(fp);
+ return;
+ }
+ if (fread(buf, 1, size - sizeof(sf), fp) != size - sizeof(sf)) {
+ printf("Failed reading squashed data\n");
+ free(buf);
+ fclose(fp);
+ return;
+ }
+
+ error = xsquash_decompress_return_sizes(size - sizeof(sf),
+ &wslen, NULL);
+ if (error) {
+ printf("xsquash_decompress_return_sizes failed: 0x%x:
%s\n",
+ error->errnum, error->errmess);
+ free(buf);
+ fclose(fp);
+ return;
+ }
+
+ ws = malloc(wslen);
+ if (!ws) {
+ printf("Out of memory\n");
+ free(buf);
+ fclose(fp);
+ return;
+ }
+
+ area = malloc(sf.size + 4);
+ if (!area) {
+ printf("Out of memory\n");
+ free(ws);
+ free(buf);
+ fclose(fp);
+ return;
+ }
+ area->size = sf.size + 4;
+
+ error = xsquash_decompress(squash_INPUT_ALL_PRESENT, ws,
+ (byte *) buf, size - sizeof(sf),
+ (byte *) &area->sprite_count, sf.size,
+ &status, NULL, NULL, NULL, NULL);
+ if (error) {
+ printf("xsquash_decompress failed: 0x%x: %s\n",
+ error->errnum, error->errmess);
+ free(area);
+ free(ws);
+ free(buf);
+ fclose(fp);
+ return;
+ }
+ if (status != 0) {
+ printf("xsquash_decompress did not complete: %x\n",
status);
+ free(area);
+ free(ws);
+ free(buf);
+ fclose(fp);
+ return;
+ }
+
+ free(ws);
+ free(buf);
+ fclose(fp);
+ } else {
+ area = malloc(size + 4);
+ if (!area) {
+ printf("Out of memory\n");
+ return;
+ }
+ area->size = size + 4;
+ area->sprite_count = 0;
+ area->first = 0;
+ area->used = 16;
+
+ error = xosspriteop_load_sprite_file(osspriteop_USER_AREA,
+ area, SPRITE);
+ if (error) {
+ printf("xosspriteop_load_sprite_file failed: 0x%x:
%s\n",
+ error->errnum, error->errmess);
+ return;
+ }
}
code = pencil_sprite(diagram, 400, 200, 200, 100,
--
RISC OS Drawfile export library
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]