Esempio n. 1
0
void ShapeMaker::close(bool stroke) {
	// diffx/diffy captures rounding errors. they can accumulate a bit! FIXME
	
	if( diffx || diffy ) {
		/*fprintf(stderr,"WARNING: shape not closed; closing (%f/%f).\n", diffx, diffy);
		fprintf(stderr,"DEBUG: accumulated rounding error (%f/%f).\n", roundx, roundy);*/
		
		if(!stroke) {
			doSetup( 0, 0, false, -1, -1, 0 );
		}
		
		// closing line
		LineTo *segment = new LineTo;
		segment->setType(1);
		//segment->setbits( maxBitsNeeded( true, 2, x, y ) );
		segment->setx( (int)-diffx );
		segment->sety( (int)-diffy );
		edges->append( segment );

		if(!stroke) {
			doSetup( 0, 0, false, -1, -1, lineStyle );
		}
		
		diffx = diffy = 0;
		if(stroke) {
			lastx = lastsetupx; lasty = lastsetupy;
		}
	}
}
Esempio n. 2
0
	void ShapeMaker::close(bool stroke) {
		// diffx/diffy captures rounding errors. they can accumulate a bit! FIXME

		if (diffx || diffy) {
			if (!stroke) {
				doSetup(0, 0, false, -1, -1, 0);
			}

			// closing line
			LineTo *segment = new LineTo;
			segment->setType(1);
			segment->setx((int)-diffx);
			segment->sety((int)-diffy);
			edges->append(segment);

			if (!stroke) {
				doSetup(0, 0, false, -1, -1, lineStyle);
			}

			diffx = diffy = 0;
			if (stroke) {
				lastx = lastsetupx; lasty = lastsetupy;
			}
		}
	}