Esempio n. 1
0
void
SWFOutput_writeGlyphShape(SWFOutput out, SWFShape shape)
{
    unsigned char c;
    int styleDone = 0;
    int i;

    c = 1<<4;
    SWFOutput_writeUInt8(out, c);
    shape->nFills = 1;
    shape->nLines = 0;
    for ( i=0; i<shape->nRecords; ++i )
    {
        if(!styleDone && shape->records[i].type == SHAPERECORD_STATECHANGE)
        {
            shape->records[i].record.stateChange->flags |= SWF_SHAPE_FILLSTYLE0FLAG;
            shape->records[i].record.stateChange->leftFill = 1;
            styleDone = 1;
        }

        if ( i < shape->nRecords-1 ||
                shape->records[i].type != SHAPERECORD_STATECHANGE )
        {
            SWFShape_writeShapeRecord(shape, shape->records[i], out);
        }
    }

    SWFOutput_writeBits(out, 0, 6); /* end tag */
    SWFOutput_byteAlign(out);
}
Esempio n. 2
0
void
SWFShape_end(SWFShape shape)
{
	int i;
	byte* buffer;

	if ( shape->isEnded )
		return;

	shape->isEnded = TRUE;

	buffer = SWFOutput_getBuffer(shape->out);

	if (shape->isUsingNewStyles == FALSE) {
		buffer[0] =
			(SWFOutput_numBits(shape->nFills2) << 4) + SWFOutput_numBits(shape->nLines2);
	}

	for ( i=0; i<shape->nRecords; ++i )
	{
		if ( i < shape->nRecords-1 ||
				 shape->records[i].type != SHAPERECORD_STATECHANGE )
		{
			SWFShape_writeShapeRecord(shape, shape->records[i]);
		}

		free(shape->records[i].record.stateChange); /* all in union are pointers */
	}

	SWFOutput_writeBits(shape->out, 0, 6); /* end tag */
	SWFOutput_byteAlign(shape->out);

	/* addStyleHeader creates a new output and adds the existing one after
		 itself- so even though it's called afterwards it's written before,
		 as it should be */

	if ( BLOCK(shape)->type > 0 ) /* i.e., shape with style */
		SWFShape_addStyleHeader(shape);

	free(shape->records);
	shape->records = NULL;
	shape->nRecords = 0;

	shape->lines = &shape->lines2;
	shape->fills = &shape->fills2;

	shape->nLines = &shape->nLines2;
	shape->nFills = &shape->nFills2;
}