summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Kramm <kramm@quiss.org>2009-10-12 13:18:59 -0700
committerMatthias Kramm <kramm@quiss.org>2009-10-12 13:18:59 -0700
commitd84140e50c86deb557dc2af0e111440d0644c496 (patch)
tree2611c33fdc1cd106cfd6b62387b45f2c59169491
parent0c314912130bcd888d0c796424649e2f1f8ef4a9 (diff)
added workaround for broken Flash text selection
-rw-r--r--lib/devices/swf.c20
-rw-r--r--lib/rfxswf.h16
2 files changed, 30 insertions, 6 deletions
diff --git a/lib/devices/swf.c b/lib/devices/swf.c
index 48acd373..8ee00708 100644
--- a/lib/devices/swf.c
+++ b/lib/devices/swf.c
@@ -802,7 +802,7 @@ static charbuffer_t*charbuffer_append(charbuffer_t*buf, SWFFONT*font, int charid
If we set it to low, however, the char positions will be inaccurate */
#define GLYPH_SCALE 1
-static void chararray_writetodev(gfxdevice_t*dev, chararray_t*array, MATRIX*matrix)
+static void chararray_writetodev(gfxdevice_t*dev, chararray_t*array, MATRIX*matrix, char invisible)
{
swfoutput_internal*i = (swfoutput_internal*)dev->internal;
@@ -833,14 +833,18 @@ static void chararray_writetodev(gfxdevice_t*dev, chararray_t*array, MATRIX*matr
swf_SetU8(i->tag, 0);//reserved
}
i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2);
- swf_ObjectPlace(i->tag,textid,getNewDepth(dev),&i->page_matrix,NULL,NULL);
+ if(invisible && i->config_flashversion>=8) {
+ swf_ObjectPlaceBlend(i->tag,textid,getNewDepth(dev),&i->page_matrix,NULL,NULL,BLENDMODE_MULTIPLY);
+ } else {
+ swf_ObjectPlace(i->tag,textid,getNewDepth(dev),&i->page_matrix,NULL,NULL);
+ }
}
-static void charbuffer_writetodevandfree(gfxdevice_t*dev, charbuffer_t*buf)
+static void charbuffer_writetodevandfree(gfxdevice_t*dev, charbuffer_t*buf, char invisible)
{
while(buf) {
charbuffer_t*next = buf->next;buf->next = 0;
- chararray_writetodev(dev, buf->array, &buf->matrix);
+ chararray_writetodev(dev, buf->array, &buf->matrix, invisible);
chararray_destroy(buf->array);
free(buf);
buf = next;
@@ -852,7 +856,7 @@ static void endtext(gfxdevice_t*dev)
swfoutput_internal*i = (swfoutput_internal*)dev->internal;
if(!i->textmode)
return;
- charbuffer_writetodevandfree(dev, i->chardata);i->chardata = 0;
+ charbuffer_writetodevandfree(dev, i->chardata, 0);i->chardata = 0;
i->textmode = 0;
}
@@ -979,7 +983,7 @@ static void endpage(gfxdevice_t*dev)
if(i->textmode)
endtext(dev);
if(i->topchardata) {
- charbuffer_writetodevandfree(dev, i->topchardata);
+ charbuffer_writetodevandfree(dev, i->topchardata, 1);
i->topchardata=0;
}
@@ -3055,6 +3059,10 @@ static void swf_drawchar(gfxdevice_t*dev, gfxfont_t*font, int glyph, gfxcolor_t*
glyph, i->swffont->id, x, y, color->r, color->g, color->b, color->a);
if(color->a == 0 && i->config_invisibletexttofront) {
+ if(i->config_flashversion>=8) {
+ // use "multiply" blend mode
+ color->a = color->r = color->g = color->b = 255;
+ }
i->topchardata = charbuffer_append(i->topchardata, i->swffont, glyph, x, y, i->current_font_size, *(RGBA*)color, &i->fontmatrix);
} else {
i->chardata = charbuffer_append(i->chardata, i->swffont, glyph, x, y, i->current_font_size, *(RGBA*)color, &i->fontmatrix);
diff --git a/lib/rfxswf.h b/lib/rfxswf.h
index 862d492f..a3420c93 100644
--- a/lib/rfxswf.h
+++ b/lib/rfxswf.h
@@ -917,6 +917,22 @@ int swf_ObjectMove(TAG * t,U16 depth,MATRIX * m,CXFORM * cx);
#define PF2_ASBITMAP 0x04
//...
+#define BLENDMODE_NORMAL 0
+#define BLENDMODE_NORMAL2 1
+#define BLENDMODE_LAYER 2
+#define BLENDMODE_MULTIPLY 3
+#define BLENDMODE_SCREEN 4
+#define BLENDMODE_LIGHTEN 5
+#define BLENDMODE_DARKEN 6
+#define BLENDMODE_ADD 7
+#define BLENDMODE_SUBSTRACT 8
+#define BLENDMODE_DIFFERENCE 9
+#define BLENDMODE_INVERT 10
+#define BLENDMODE_ALPHA 11
+#define BLENDMODE_ERASE 12
+#define BLENDMODE_OVERLAY 13
+#define BLENDMODE_HARDLIGHT 14
+
typedef struct _SWFPLACEOBJECT {
U16 depth;
U16 id; // may be 0