git.asbjorn.biz
/
swftools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
32f13e6
)
handle font=0 in drawchar (dummy character passing)
author
kramm
<kramm>
Thu, 28 Jun 2007 11:25:36 +0000
(11:25 +0000)
committer
kramm
<kramm>
Thu, 28 Jun 2007 11:25:36 +0000
(11:25 +0000)
lib/devices/arts.c
patch
|
blob
|
history
lib/devices/bbox.c
patch
|
blob
|
history
lib/devices/opengl.c
patch
|
blob
|
history
lib/devices/record.c
patch
|
blob
|
history
lib/devices/render.c
patch
|
blob
|
history
lib/devices/swf.c
patch
|
blob
|
history
lib/devices/text.c
patch
|
blob
|
history
diff --git
a/lib/devices/arts.c
b/lib/devices/arts.c
index
78986ec
..
e3aef2b
100644
(file)
--- a/
lib/devices/arts.c
+++ b/
lib/devices/arts.c
@@
-218,6
+218,8
@@
void arts_addfont(struct _gfxdevice*dev, gfxfont_t*font)
void arts_drawchar(struct _gfxdevice*dev, gfxfont_t*font, int glyphnr, gfxcolor_t*color, gfxmatrix_t*matrix)
{
dbg("arts_drawchar");
void arts_drawchar(struct _gfxdevice*dev, gfxfont_t*font, int glyphnr, gfxcolor_t*color, gfxmatrix_t*matrix)
{
dbg("arts_drawchar");
+ if(!font)
+ return;
internal_t*i = (internal_t*)dev->internal;
gfxline_t*glyph = gfxline_clone(font->glyphs[glyphnr].line);
gfxline_transform(glyph, matrix);
internal_t*i = (internal_t*)dev->internal;
gfxline_t*glyph = gfxline_clone(font->glyphs[glyphnr].line);
gfxline_transform(glyph, matrix);
diff --git
a/lib/devices/bbox.c
b/lib/devices/bbox.c
index
5a13d51
..
05df67f
100644
(file)
--- a/
lib/devices/bbox.c
+++ b/
lib/devices/bbox.c
@@
-112,6
+112,8
@@
void bbox_addfont(gfxdevice_t*dev, gfxfont_t*font)
void bbox_drawchar(gfxdevice_t*dev, gfxfont_t*font, int glyphnr, gfxcolor_t*color, gfxmatrix_t*matrix)
{
internal_t*i = (internal_t*)dev->internal;
void bbox_drawchar(gfxdevice_t*dev, gfxfont_t*font, int glyphnr, gfxcolor_t*color, gfxmatrix_t*matrix)
{
internal_t*i = (internal_t*)dev->internal;
+ if(!font)
+ return;
if(i->do_text) {
gfxglyph_t*glyph = &font->glyphs[glyphnr];
if(i->do_text) {
gfxglyph_t*glyph = &font->glyphs[glyphnr];
diff --git
a/lib/devices/opengl.c
b/lib/devices/opengl.c
index
36ffcc7
..
366f249
100644
(file)
--- a/
lib/devices/opengl.c
+++ b/
lib/devices/opengl.c
@@
-476,6
+476,8
@@
void opengl_addfont(gfxdevice_t*dev, gfxfont_t*font)
void opengl_drawchar(gfxdevice_t*dev, gfxfont_t*font, int glyphnr, gfxcolor_t*color, gfxmatrix_t*matrix)
{
internal_t*i = (internal_t*)dev->internal;
void opengl_drawchar(gfxdevice_t*dev, gfxfont_t*font, int glyphnr, gfxcolor_t*color, gfxmatrix_t*matrix)
{
internal_t*i = (internal_t*)dev->internal;
+ if(!font)
+ return;
if(i->font && i->font->id && !strcmp(font->id, i->font->id)) {
// current font is correct
if(i->font && i->font->id && !strcmp(font->id, i->font->id)) {
// current font is correct
diff --git
a/lib/devices/record.c
b/lib/devices/record.c
index
617b427
..
ae5bedf
100644
(file)
--- a/
lib/devices/record.c
+++ b/
lib/devices/record.c
@@
-334,11
+334,14
@@
static void record_addfont(struct _gfxdevice*dev, gfxfont_t*font)
static void record_drawchar(struct _gfxdevice*dev, gfxfont_t*font, int glyphnr, gfxcolor_t*color, gfxmatrix_t*matrix)
{
internal_t*i = (internal_t*)dev->internal;
static void record_drawchar(struct _gfxdevice*dev, gfxfont_t*font, int glyphnr, gfxcolor_t*color, gfxmatrix_t*matrix)
{
internal_t*i = (internal_t*)dev->internal;
- if(!gfxfontlist_hasfont(i->fontlist, font))
+ if(font && !gfxfontlist_hasfont(i->fontlist, font))
record_addfont(dev, font);
writer_writeU8(&i->w, OP_DRAWCHAR);
record_addfont(dev, font);
writer_writeU8(&i->w, OP_DRAWCHAR);
- writer_writeString(&i->w, font->id);
+ if(font)
+ writer_writeString(&i->w, font->id);
+ else
+ writer_writeString(&i->w, "*NULL*");
writer_writeU32(&i->w, glyphnr);
dumpColor(&i->w, color);
dumpMatrix(&i->w, matrix);
writer_writeU32(&i->w, glyphnr);
dumpColor(&i->w, color);
dumpMatrix(&i->w, matrix);
@@
-463,7
+466,7
@@
void gfxresult_record_replay(gfxresult_t*result, gfxdevice_t*device)
}
case OP_DRAWCHAR: {
char* id = reader_readString(r);
}
case OP_DRAWCHAR: {
char* id = reader_readString(r);
- gfxfont_t*font = gfxfontlist_findfont(fontlist, id);
+ gfxfont_t*font = id?gfxfontlist_findfont(fontlist, id):0;
U32 glyph = reader_readU32(r);
gfxcolor_t color = readColor(r);
gfxmatrix_t matrix = readMatrix(r);
U32 glyph = reader_readU32(r);
gfxcolor_t color = readColor(r);
gfxmatrix_t matrix = readMatrix(r);
diff --git
a/lib/devices/render.c
b/lib/devices/render.c
index
5a9504b
..
bb71bed
100644
(file)
--- a/
lib/devices/render.c
+++ b/
lib/devices/render.c
@@
-648,6
+648,8
@@
void render_addfont(struct _gfxdevice*dev, gfxfont_t*font)
void render_drawchar(struct _gfxdevice*dev, gfxfont_t*font, int glyphnr, gfxcolor_t*color, gfxmatrix_t*matrix)
{
internal_t*i = (internal_t*)dev->internal;
void render_drawchar(struct _gfxdevice*dev, gfxfont_t*font, int glyphnr, gfxcolor_t*color, gfxmatrix_t*matrix)
{
internal_t*i = (internal_t*)dev->internal;
+ if(!font)
+ return;
/* align characters to whole pixels */
matrix->tx = (int)(matrix->tx * i->antialize) / i->antialize;
/* align characters to whole pixels */
matrix->tx = (int)(matrix->tx * i->antialize) / i->antialize;
diff --git
a/lib/devices/swf.c
b/lib/devices/swf.c
index
67c6ac4
..
0bd3160
100644
(file)
--- a/
lib/devices/swf.c
+++ b/
lib/devices/swf.c
@@
-2482,6
+2482,8
@@
static void swf_switchfont(gfxdevice_t*dev, char*fontid)
static void swf_drawchar(gfxdevice_t*dev, gfxfont_t*font, int glyph, gfxcolor_t*color, gfxmatrix_t*matrix)
{
swfoutput_internal*i = (swfoutput_internal*)dev->internal;
static void swf_drawchar(gfxdevice_t*dev, gfxfont_t*font, int glyph, gfxcolor_t*color, gfxmatrix_t*matrix)
{
swfoutput_internal*i = (swfoutput_internal*)dev->internal;
+ if(!font)
+ return;
if(!i->swffont || !i->swffont->name || strcmp((char*)i->swffont->name,font->id)) // not equal to current font
{
if(!i->swffont || !i->swffont->name || strcmp((char*)i->swffont->name,font->id)) // not equal to current font
{
diff --git
a/lib/devices/text.c
b/lib/devices/text.c
index
87b786c
..
d5b4bbc
100644
(file)
--- a/
lib/devices/text.c
+++ b/
lib/devices/text.c
@@
-120,9
+120,13
@@
void text_drawchar(gfxdevice_t*dev, gfxfont_t*font, int glyphnr, gfxcolor_t*colo
} else if(xshift > i->lastadvance*1.3 || xshift<0) {
addchar(dev, 32);
}
} else if(xshift > i->lastadvance*1.3 || xshift<0) {
addchar(dev, 32);
}
- i->lastadvance = font->glyphs[glyphnr].advance*matrix->m00;
-
- int u = font->glyphs[glyphnr].unicode;
+ if(font) {
+ i->lastadvance = font->glyphs[glyphnr].advance*matrix->m00;
+ int u = font->glyphs[glyphnr].unicode;
+ } else {
+ u = glyphnr;
+ i->currentx = 0;i->currenty = 0;
+ }
if(u>13) {
addchar(dev, u);
}
if(u>13) {
addchar(dev, u);
}