| | |
| | | --- opensmalltalk-vm-sun-v5.0.31/src/plugins/VectorEnginePlugin/VectorEnginePlugin.c 1970-01-01 01:00:00.000000000 +0000 |
| | | +++ p0/opensmalltalk-vm-sun-v5.0.31/src/plugins/VectorEnginePlugin/VectorEnginePlugin.c 2021-07-23 21:15:45.616152455 +0000 |
| | | @@ -0,0 +1,4820 @@ |
| | | +/* Smalltalk from Cuis 5.0 with VMMaker 4.19.5 translated as C source on 23 July 2021 9:14:42.510163 pm */ |
| | | --- opensmalltalk-vm-sun-v5.0.30/src/plugins/VectorEnginePlugin/VectorEnginePlugin.c 1970-01-01 01:00:00.000000000 +0000 |
| | | +++ p0/opensmalltalk-vm-sun-v5.0.30/src/plugins/VectorEnginePlugin/VectorEnginePlugin.c 2021-06-18 19:58:39.303784182 +0000 |
| | | @@ -0,0 +1,4624 @@ |
| | | +/* Smalltalk from Cuis 5.0 with VMMaker 4.19.5 translated as C source on 18 June 2021 7:10:51.834109 pm */ |
| | | +/* Automatically generated by PluginMaker (VMMaker) from VectorEnginePlugin */ |
| | | + |
| | | + |
| | | +/* Configuration options */ |
| | | +#include "sqConfig.h" |
| | | +#include <math.h> |
| | | +#include <stdio.h> |
| | | +#include <stdlib.h> |
| | | +#include <string.h> |
| | | +#include <time.h> |
| | | + |
| | | +/* Default EXPORT macro that does nothing (see comment in sq.h): */ |
| | | +#define EXPORT(returnType) returnType |
| | | + |
| | | +/* Do not include the entire sq.h file but just those parts needed. */ |
| | | +/* The virtual machine proxy definition */ |
| | | +#include "sqVirtualMachine.h" |
| | | +/* Configuration options */ |
| | | +#include "sqConfig.h" |
| | | +/* Platform specific definitions */ |
| | | +#include "sqPlatformSpecific.h" |
| | | + |
| | | +#define true 1 |
| | | +#define false 0 |
| | | +#define null 0 /* using 'null' because nil is predefined in Think C */ |
| | |
| | | +#include <stdint.h> |
| | | + |
| | | +#include "sqMemoryAccess.h" |
| | | + |
| | | + |
| | | +/*** Constants ***/ |
| | | + |
| | |
| | | +#pragma export on |
| | | +EXPORT(sqInt) primQuadraticBezier(void); |
| | | +EXPORT(sqInt) primQuadraticBezierWP(void); |
| | | +EXPORT(sqInt) primResetContour(void); |
| | | +EXPORT(sqInt) setInterpreter(struct VirtualMachine*anInterpreter); |
| | | +EXPORT(sqInt) primSpanBottom(void); |
| | | +EXPORT(sqInt) primSpanLeft(void); |
| | |
| | | +static sqInt updateAlphasForXy(float x, float y); |
| | | +static sqInt updateAlphasWPForXy(float x, float y); |
| | | +static sqInt updateAlphasWPZeroStrokeForXy(float x, float y); |
| | | +static sqInt updateContourForXy(float x, float y); |
| | | +#pragma export on |
| | | +EXPORT(sqInt) primUpdateContourLastLine(void); |
| | | +#pragma export off |
| | | +static sqInt updateEdgeCountAtXy(float x, float y); |
| | | +static sqInt updateEdgeCountWPAtXy(float x, float y); |
| | | +/*** Variables ***/ |
| | |
| | | +static sqInt clipLeft; |
| | | +static sqInt clipRight; |
| | | +static sqInt clipTop; |
| | | +static float * contour; |
| | | +static sqInt currentClipsSubmorphs; |
| | | +static uint32_t currentMorphId; |
| | | +static uint32_t * edgeCounts; |
| | |
| | | +extern |
| | | +#endif |
| | | +struct VirtualMachine* interpreterProxy; |
| | | +static float leftAtThisY; |
| | | +static const char *moduleName = |
| | | +#ifdef SQUEAK_BUILTIN_PLUGIN |
| | | + "VectorEnginePlugin 23 July 2021 (i)" |
| | | + "VectorEnginePlugin 18 June 2021 (i)" |
| | | +#else |
| | | + "VectorEnginePlugin 23 July 2021 (e)" |
| | | + "VectorEnginePlugin 18 June 2021 (e)" |
| | | +#endif |
| | | +; |
| | | +static uint32_t * morphIds; |
| | | +static sqInt prevYRounded; |
| | | +static sqInt prevYTruncated; |
| | | +static float rightAtThisY; |
| | | +static sqInt simulator; |
| | | +static float spanBottom; |
| | | +static float spanLeft; |
| | |
| | | + double tthetaSin; |
| | | + unsigned *otherWordArray; |
| | | + unsigned *anotherWordArray; |
| | | + float *aFloat32Array; |
| | | + |
| | | + centerX = interpreterProxy->stackFloatValue(10); |
| | | + centerY = interpreterProxy->stackFloatValue(9); |
| | | + radiusPointX = interpreterProxy->stackFloatValue(8); |
| | | + radiusPointY = interpreterProxy->stackFloatValue(7); |
| | | + startAngle = interpreterProxy->stackFloatValue(6); |
| | | + sweepAngle = interpreterProxy->stackFloatValue(5); |
| | | + tthetaCos = interpreterProxy->stackFloatValue(4); |
| | | + tthetaSin = interpreterProxy->stackFloatValue(3); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(2))); |
| | | + otherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(2)))); |
| | | + centerX = interpreterProxy->stackFloatValue(9); |
| | | + centerY = interpreterProxy->stackFloatValue(8); |
| | | + radiusPointX = interpreterProxy->stackFloatValue(7); |
| | | + radiusPointY = interpreterProxy->stackFloatValue(6); |
| | | + startAngle = interpreterProxy->stackFloatValue(5); |
| | | + sweepAngle = interpreterProxy->stackFloatValue(4); |
| | | + tthetaCos = interpreterProxy->stackFloatValue(3); |
| | | + tthetaSin = interpreterProxy->stackFloatValue(2); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(1))); |
| | | + anotherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); |
| | | + aFloat32Array = ((float *) (interpreterProxy->arrayValueOf(interpreterProxy->stackValue(0)))); |
| | | + otherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(0))); |
| | | + anotherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(0)))); |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | |
| | | + scale = sqrt(txA11*txA11 + txA21*txA21);; |
| | | + trx = radiusPointX * scale; |
| | | + try = radiusPointY * scale; |
| | | + hops = (((sqInt)(((((trx < try) ? try : trx)) * (fabs(sweepAngle))) / hop))) + 2; |
| | | + hops = (((sqInt)(((((trx < try) ? try : trx)) * (fabs(sweepAngle))) / hop))) + 1; |
| | | + d = sweepAngle / hops; |
| | | + edgeCounts = otherWordArray; |
| | | + alphaMask = anotherWordArray; |
| | | + contour = aFloat32Array; |
| | | + angle = startAngle; |
| | | + hops += 1; |
| | | + for (h = 1; h <= hops; h += 1) { |
| | | + for (h = 1; h <= (hops + 1); h += 1) { |
| | | + xp = (cos(angle)) * trx; |
| | | + yp = (sin(angle)) * try; |
| | | + x = ((tthetaCos * xp) - (tthetaSin * yp)) + tcx; |
| | |
| | | + if (!(fillA == 0.0)) { |
| | | + updateEdgeCountAtXy(x, y); |
| | | + } |
| | | + updateContourForXy(x, y); |
| | | + angle += d; |
| | | + } |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(11); |
| | | + interpreterProxy->pop(10); |
| | | + return null; |
| | | +} |
| | | + |
| | |
| | | + double tthetaSin; |
| | | + unsigned char *otherByteArray; |
| | | + unsigned char *anotherByteArray; |
| | | + float *aFloat32Array; |
| | | + |
| | | + centerX = interpreterProxy->stackFloatValue(10); |
| | | + centerY = interpreterProxy->stackFloatValue(9); |
| | | + radiusPointX = interpreterProxy->stackFloatValue(8); |
| | | + radiusPointY = interpreterProxy->stackFloatValue(7); |
| | | + startAngle = interpreterProxy->stackFloatValue(6); |
| | | + sweepAngle = interpreterProxy->stackFloatValue(5); |
| | | + tthetaCos = interpreterProxy->stackFloatValue(4); |
| | | + tthetaSin = interpreterProxy->stackFloatValue(3); |
| | | + interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(2))); |
| | | + otherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(2)))); |
| | | + centerX = interpreterProxy->stackFloatValue(9); |
| | | + centerY = interpreterProxy->stackFloatValue(8); |
| | | + radiusPointX = interpreterProxy->stackFloatValue(7); |
| | | + radiusPointY = interpreterProxy->stackFloatValue(6); |
| | | + startAngle = interpreterProxy->stackFloatValue(5); |
| | | + sweepAngle = interpreterProxy->stackFloatValue(4); |
| | | + tthetaCos = interpreterProxy->stackFloatValue(3); |
| | | + tthetaSin = interpreterProxy->stackFloatValue(2); |
| | | + interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(1))); |
| | | + anotherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); |
| | | + aFloat32Array = ((float *) (interpreterProxy->arrayValueOf(interpreterProxy->stackValue(0)))); |
| | | + otherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); |
| | | + interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(0))); |
| | | + anotherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(0)))); |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | |
| | | + scale = sqrt(txA11*txA11 + txA21*txA21);; |
| | | + trx = radiusPointX * scale; |
| | | + try = radiusPointY * scale; |
| | | + hops = (((sqInt)(((((trx < try) ? try : trx)) * (fabs(sweepAngle))) / hop))) + 2; |
| | | + hops = (((sqInt)(((((trx < try) ? try : trx)) * (fabs(sweepAngle))) / hop))) + 1; |
| | | + d = sweepAngle / hops; |
| | | + edgeCountsWP = otherByteArray; |
| | | + alphaMaskWP = anotherByteArray; |
| | | + contour = aFloat32Array; |
| | | + angle = startAngle; |
| | | + hops += 1; |
| | | + for (h = 1; h <= hops; h += 1) { |
| | | + for (h = 1; h <= (hops + 1); h += 1) { |
| | | + xp = (cos(angle)) * trx; |
| | | + yp = (sin(angle)) * try; |
| | | + x = ((tthetaCos * xp) - (tthetaSin * yp)) + tcx; |
| | |
| | | + if (!(fillA == 0.0)) { |
| | | + updateEdgeCountWPAtXy(x, y); |
| | | + } |
| | | + updateContourForXy(x, y); |
| | | + angle += d; |
| | | + } |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(11); |
| | | + interpreterProxy->pop(10); |
| | | + return null; |
| | | +} |
| | | + |
| | | + |
| | | +/* Blends fill color over background. Target translucency computed correctly. |
| | | +/* Blends fill over background. Target translucency computed correctly. |
| | | + For blending, alphas are in [0 .. 1.0] and R, G, B color components are in [0 .. 255] */ |
| | | + |
| | | +static sqInt blendFillOnlyAtredIsInsidegreenIsInsideblueIsInsideantiAliasAlphasWord(sqInt pixelIndex, sqInt isRedInside, sqInt isGreenInside, sqInt isBlueInside, uint32_t antiAliasAlphasWord) { |
| | |
| | | + return null; |
| | | +} |
| | | + |
| | | + |
| | | +/* Blends fill color over background. Target translucency computed correctly. |
| | | + For blending, alphas are in [0 .. 1.0] and R, G, B color components are in [0 .. 255] */ |
| | | + |
| | | +EXPORT(sqInt) primBlendFillOnly(void) { |
| | | + sqInt isRedInside; |
| | | + sqInt isBlueInside; |
| | |
| | | +} |
| | | + |
| | | + |
| | | +/* Blends fill color over background. |
| | | + WP: Whole pixel anti aliasing. |
| | | + OT: Target ignored on input and set to opaque on output. |
| | | +/* Blends fill over background. Target translucency computed correctly. |
| | | + For blending, alphas are in [0 .. 1.0] and R, G, B color components are in [0 .. 255] */ |
| | | + |
| | | +static sqInt blendFillOnlyWPOTAtantiAliasAlphaByte(sqInt pixelIndex, uint8_t antiAliasAlphaBits) { |
| | | + uint32_t targetWord; |
| | | + uint32_t clippingAntiAliasBits; |
| | | + float unAlpha; |
| | | + float resultG; |
| | | + float antiAliasAlpha; |
| | | + float unAlpha; |
| | | + float clippingAntiAlias; |
| | | + uint32_t morphIdWord; |
| | | + uint32_t resultGBits; |
| | | + uint32_t resultBBits; |
| | | + float resultB; |
| | | + float clippingAntiAlias; |
| | | + float antiAliasAlpha; |
| | | + uint32_t morphIdWord; |
| | | + float alpha; |
| | | + uint32_t resultRBits; |
| | | + float resultR; |
| | | + float resultB; |
| | | + |
| | | + |
| | | + /* 1.0/127.0 */ |
| | |
| | | + return null; |
| | | +} |
| | | + |
| | | + |
| | | +/* Blends fill color over background. |
| | | + WP: Whole pixel anti aliasing. |
| | | + OT: Target ignored on input and set to opaque on output. |
| | | + For blending, alphas are in [0 .. 1.0] and R, G, B color components are in [0 .. 255] */ |
| | | + |
| | | +EXPORT(sqInt) primBlendFillOnlyWPOT(void) { |
| | | + uint8_t edgesUpToThisPixel; |
| | | + uint8_t antiAliasAlphaBits; |
| | | + sqInt pixelIndex; |
| | | + sqInt displayX; |
| | | + uint8_t edgesThisPixel; |
| | | + uint8_t antiAliasAlphaBits; |
| | | + sqInt displayY; |
| | | + sqInt l; |
| | | + sqInt t; |
| | |
| | | + } |
| | | + antiAliasAlphaBits = alphaMaskWP[pixelIndex]; |
| | | + if (edgesUpToThisPixel == 0) { |
| | | + |
| | | + /* Still in the anti aliasing area, but outside the shape, strictly speaking. */ |
| | | + |
| | | + if (!(antiAliasAlphaBits == 0)) { |
| | | + alphaMaskWP[pixelIndex] = 0; |
| | | + blendFillOnlyWPOTAtantiAliasAlphaByte(pixelIndex, antiAliasAlphaBits); |
| | | + } |
| | | + } else { |
| | | + |
| | | + /* Inside the shape */ |
| | | + |
| | | + if (!(antiAliasAlphaBits == 0)) { |
| | | + alphaMaskWP[pixelIndex] = 0; |
| | | + } |
| | |
| | | +} |
| | | + |
| | | + |
| | | +/* Blends stroke color and fill color over background. |
| | | + Do an appropriate (anti aliased) gradient between stoke color and fill color (or pick just stroke or just fill). Blend this over background. |
| | | +/* Do an appropriate (anti aliased) mix between stoke and fill (or pick just stroke or just fill). Blend this over background. |
| | | + Target translucency computed correctly. |
| | | + For blending, alphas are in [0 .. 1.0] and R, G, B color components are in [0 .. 255] */ |
| | | + |
| | |
| | | +} |
| | | + |
| | | + |
| | | +/* Inside the shape: Do an appropriate (anti aliased) gradient between stoke color and fill color (or pick just stroke or just fill). |
| | | + Blend this over background. |
| | | + WP: Whole pixel anti aliasing. |
| | | + OT: Target ignored on input and set to opaque on output. |
| | | +/* Inside the shape: Do gradient between stroke and fill. Blend the result over background */ |
| | | +/* Do an appropriate (anti aliased) mix between stoke and fill (or pick just stroke or just fill). Blend this over background. |
| | | + Target translucency computed correctly. |
| | | + For blending, alphas are in [0 .. 1.0] and R, G, B color components are in [0 .. 255] */ |
| | | + |
| | | +static sqInt blendStrokeAndFillInsideWPOTAtantiAliasAlphaByte(sqInt pixelIndex, uint8_t antiAliasAlphaBits) { |
| | |
| | | + } |
| | | + return null; |
| | | +} |
| | | + |
| | | + |
| | | +/* Blends stroke color and fill color over background. |
| | | + Do an appropriate (anti aliased) gradient between stoke color and fill color (or pick just stroke or just fill). Blend this over background. |
| | | + Target translucency computed correctly. |
| | | + For blending, alphas are in [0 .. 1.0] and R, G, B color components are in [0 .. 255] */ |
| | | + |
| | | +EXPORT(sqInt) primBlendStrokeAndFill(void) { |
| | | + sqInt isRedInside; |
| | |
| | | +} |
| | | + |
| | | + |
| | | +/* Outside the shape, but still in the stroke: Blend stroke color over background. |
| | | + WP: Whole pixel anti aliasing. |
| | | + OT: Target ignored on input and set to opaque on output. |
| | | +/* Outside the shape, but still in the stroke: Blend stroke over background */ |
| | | +/* Do an appropriate (anti aliased) mix between stoke and fill (or pick just stroke or just fill). Blend this over background. |
| | | + Target translucency computed correctly. |
| | | + For blending, alphas are in [0 .. 1.0] and R, G, B color components are in [0 .. 255] */ |
| | | + |
| | | +static sqInt blendStrokeAndFillOutsideWPOTAtantiAliasAlphaByte(sqInt pixelIndex, uint8_t antiAliasAlphaBits) { |
| | |
| | | + return null; |
| | | +} |
| | | + |
| | | + |
| | | +/* Blends stroke color and fill color over background. |
| | | + Do an appropriate (anti aliased) gradient between stoke color and fill color (or pick just stroke or just fill). Blend this over background. |
| | | + WP: Whole pixel anti aliasing. |
| | | + OT: Target ignored on input and set to opaque on output. |
| | | + For blending, alphas are in [0 .. 1.0] and R, G, B color components are in [0 .. 255] */ |
| | | + |
| | | +EXPORT(sqInt) primBlendStrokeAndFillWPOT(void) { |
| | | + uint8_t edgesUpToThisPixel; |
| | | + uint8_t antiAliasAlphaBits; |
| | | + sqInt pixelIndex; |
| | | + sqInt displayX; |
| | | + uint8_t edgesThisPixel; |
| | | + uint8_t antiAliasAlphaBits; |
| | | + sqInt displayY; |
| | | + sqInt l; |
| | | + sqInt t; |
| | |
| | | + } |
| | | + antiAliasAlphaBits = alphaMaskWP[pixelIndex]; |
| | | + if (edgesUpToThisPixel == 0) { |
| | | + |
| | | + /* Still in the stroke, but outside the shape, strictly speaking. */ |
| | | + |
| | | + if (!(antiAliasAlphaBits == 0)) { |
| | | + alphaMaskWP[pixelIndex] = 0; |
| | | + if (!(antiAliasAlphaBits == 0)) { |
| | |
| | | + } |
| | | + } |
| | | + } else { |
| | | + |
| | | + /* Inside the shape */ |
| | | + |
| | | + if (!(antiAliasAlphaBits == 0)) { |
| | | + alphaMaskWP[pixelIndex] = 0; |
| | | + } |
| | |
| | | +} |
| | | + |
| | | + |
| | | +/* Blends stroke color over background. Target translucency computed correctly. |
| | | +/* Blends stroke over background. Target translucency computed correctly. |
| | | + For blending, alphas are in [0 .. 1.0] and R, G, B color components are in [0 .. 255] */ |
| | | + |
| | | +static sqInt blendStrokeOnlyAtantiAliasAlphasWord(sqInt pixelIndex, uint32_t antiAliasAlphasWord) { |
| | |
| | | + return null; |
| | | +} |
| | | + |
| | | + |
| | | +/* Blends stroke color over background. Target translucency computed correctly. |
| | | + For blending, alphas are in [0 .. 1.0] and R, G, B color components are in [0 .. 255] */ |
| | | + |
| | | +EXPORT(sqInt) primBlendStrokeOnly(void) { |
| | | + sqInt pixelIndex; |
| | | + sqInt displayY; |
| | |
| | | +} |
| | | + |
| | | + |
| | | +/* Blends stroke color over background. |
| | | + WP: Whole pixel anti aliasing. |
| | | + OT: Target ignored on input and set to opaque on output. |
| | | +/* Blends stroke over background. Target translucency computed correctly. |
| | | + For blending, alphas are in [0 .. 1.0] and R, G, B color components are in [0 .. 255] */ |
| | | + |
| | | +static sqInt blendStrokeOnlyWPOTAtantiAliasAlphaByte(sqInt pixelIndex, uint8_t antiAliasAlphaBits) { |
| | | + uint32_t targetWord; |
| | | + uint32_t clippingAntiAliasBits; |
| | | + float unAlpha; |
| | | + float resultG; |
| | | + float antiAliasAlpha; |
| | | + float unAlpha; |
| | | + float clippingAntiAlias; |
| | | + uint32_t morphIdWord; |
| | | + uint32_t resultGBits; |
| | | + uint32_t resultBBits; |
| | | + float resultB; |
| | | + float clippingAntiAlias; |
| | | + float antiAliasAlpha; |
| | | + uint32_t morphIdWord; |
| | | + float alpha; |
| | | + uint32_t resultRBits; |
| | | + float resultR; |
| | | + float resultB; |
| | | + |
| | | + |
| | | + /* 1.0/127.0 */ |
| | |
| | | + return null; |
| | | +} |
| | | + |
| | | + |
| | | +/* Blends stroke color over background. |
| | | + WP: Whole pixel anti aliasing. |
| | | + OT: Target ignored on input and set to opaque on output. |
| | | + For blending, alphas are in [0 .. 1.0] and R, G, B color components are in [0 .. 255] */ |
| | | + |
| | | +EXPORT(sqInt) primBlendStrokeOnlyWPOT(void) { |
| | | + uint8_t antiAliasAlphaBits; |
| | | + sqInt pixelIndex; |
| | |
| | | + pixelIndex += 1; |
| | | + antiAliasAlphaBits = alphaMaskWP[pixelIndex]; |
| | | + if (!(antiAliasAlphaBits == 0)) { |
| | | + |
| | | + /* In the stroke */ |
| | | + |
| | | + alphaMaskWP[pixelIndex] = 0; |
| | | + blendStrokeOnlyWPOTAtantiAliasAlphaByte(pixelIndex, antiAliasAlphaBits); |
| | | + } |
| | |
| | | + double yControl2; |
| | | + unsigned *otherWordArray; |
| | | + unsigned *anotherWordArray; |
| | | + float *aFloat32Array; |
| | | + |
| | | + xFrom = interpreterProxy->stackFloatValue(10); |
| | | + yFrom = interpreterProxy->stackFloatValue(9); |
| | | + xTo = interpreterProxy->stackFloatValue(8); |
| | | + yTo = interpreterProxy->stackFloatValue(7); |
| | | + xControl1 = interpreterProxy->stackFloatValue(6); |
| | | + yControl1 = interpreterProxy->stackFloatValue(5); |
| | | + xControl2 = interpreterProxy->stackFloatValue(4); |
| | | + yControl2 = interpreterProxy->stackFloatValue(3); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(2))); |
| | | + otherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(2)))); |
| | | + xFrom = interpreterProxy->stackFloatValue(9); |
| | | + yFrom = interpreterProxy->stackFloatValue(8); |
| | | + xTo = interpreterProxy->stackFloatValue(7); |
| | | + yTo = interpreterProxy->stackFloatValue(6); |
| | | + xControl1 = interpreterProxy->stackFloatValue(5); |
| | | + yControl1 = interpreterProxy->stackFloatValue(4); |
| | | + xControl2 = interpreterProxy->stackFloatValue(3); |
| | | + yControl2 = interpreterProxy->stackFloatValue(2); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(1))); |
| | | + anotherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); |
| | | + aFloat32Array = ((float *) (interpreterProxy->arrayValueOf(interpreterProxy->stackValue(0)))); |
| | | + otherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(0))); |
| | | + anotherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(0)))); |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + edgeCounts = otherWordArray; |
| | | + alphaMask = anotherWordArray; |
| | | + contour = aFloat32Array; |
| | | + pvt_cubicBezierFromXytoXycontrol1Xycontrol2Xy(xFrom, yFrom, xTo, yTo, xControl1, yControl1, xControl2, yControl2); |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(11); |
| | | + interpreterProxy->pop(10); |
| | | + return null; |
| | | +} |
| | | + |
| | |
| | | + double yControl2; |
| | | + unsigned char *otherByteArray; |
| | | + unsigned char *anotherByteArray; |
| | | + float *aFloat32Array; |
| | | + |
| | | + xFrom = interpreterProxy->stackFloatValue(10); |
| | | + yFrom = interpreterProxy->stackFloatValue(9); |
| | | + xTo = interpreterProxy->stackFloatValue(8); |
| | | + yTo = interpreterProxy->stackFloatValue(7); |
| | | + xControl1 = interpreterProxy->stackFloatValue(6); |
| | | + yControl1 = interpreterProxy->stackFloatValue(5); |
| | | + xControl2 = interpreterProxy->stackFloatValue(4); |
| | | + yControl2 = interpreterProxy->stackFloatValue(3); |
| | | + interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(2))); |
| | | + otherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(2)))); |
| | | + xFrom = interpreterProxy->stackFloatValue(9); |
| | | + yFrom = interpreterProxy->stackFloatValue(8); |
| | | + xTo = interpreterProxy->stackFloatValue(7); |
| | | + yTo = interpreterProxy->stackFloatValue(6); |
| | | + xControl1 = interpreterProxy->stackFloatValue(5); |
| | | + yControl1 = interpreterProxy->stackFloatValue(4); |
| | | + xControl2 = interpreterProxy->stackFloatValue(3); |
| | | + yControl2 = interpreterProxy->stackFloatValue(2); |
| | | + interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(1))); |
| | | + anotherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); |
| | | + aFloat32Array = ((float *) (interpreterProxy->arrayValueOf(interpreterProxy->stackValue(0)))); |
| | | + otherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); |
| | | + interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(0))); |
| | | + anotherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(0)))); |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + edgeCountsWP = otherByteArray; |
| | | + alphaMaskWP = anotherByteArray; |
| | | + contour = aFloat32Array; |
| | | + pvt_cubicBezierWPFromXytoXycontrol1Xycontrol2Xy(xFrom, yFrom, xTo, yTo, xControl1, yControl1, xControl2, yControl2); |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(11); |
| | | + interpreterProxy->pop(10); |
| | | + return null; |
| | | +} |
| | | + |
| | |
| | | + float advanceWidth; |
| | | + float x0; |
| | | + float ttControlX; |
| | | + float correction; |
| | | + float xMaxEnd; |
| | | + float startY; |
| | | + float t; |
| | |
| | | + float startX; |
| | | + float contourStartX; |
| | | + float dy; |
| | | + sqInt idx; |
| | | + float controlX; |
| | | + float f2; |
| | | + sqInt idx; |
| | | + sqInt i; |
| | | + float y; |
| | | + char *aString; |
| | |
| | | + y = startY; |
| | | + updateAlphasForXy(x, y); |
| | | + updateEdgeCountAtXy(x, y); |
| | | + |
| | | + /* But if curve is very small, there is risk of not iterating even once, completely missing a pixel, and breaking fills. |
| | | + In these cases, a larger initial estimation avoids the problem. */ |
| | | + |
| | | + increment = 0.2; |
| | | + dx = fabs(endX-startX); dy = fabs(endY-startY);; |
| | | + increment = (((0.5 / (((dx < dy) ? dy : dx))) < 0.5) ? (0.5 / (((dx < dy) ? dy : dx))) : 0.5); |
| | | + if ((dy < 2.0) && (dx < 2.0)) { |
| | | + increment = 0.5; |
| | | + } |
| | | + t = 0.0; |
| | | + while (1) { |
| | | + t0 = t; |
| | |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); |
| | | + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); |
| | | + dx = x - x0; |
| | | + |
| | | + /* Now adjust the increment to aim at the required hop length, and recompute next point. */ |
| | | + |
| | | + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); |
| | | + dx = x - x0; |
| | | + dy = y - y0; |
| | | + |
| | | + length = sqrt(dx*dx + dy*dy);; |
| | | + correction = hop / length; |
| | | + do { |
| | | + increment = (increment / length) * hop; |
| | | + t = t0 + increment; |
| | | + oneLessT = 1.0 - t; |
| | | + f1 = oneLessT * oneLessT; |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); |
| | | + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); |
| | | + dx = x - x0; |
| | | + dy = y - y0; |
| | | + |
| | | + length = sqrt(dx*dx + dy*dy);; |
| | | + correction = hop / length; |
| | | + } while(correction < 1.0); |
| | | + increment = (increment / length) * hop; |
| | | + t = t0 + increment; |
| | | + oneLessT = 1.0 - t; |
| | | + f1 = oneLessT * oneLessT; |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); |
| | | + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); |
| | | + if (!(t < 1.0)) break; |
| | | + updateAlphasForXy(x, y); |
| | | + updateEdgeCountAtXy(x, y); |
| | |
| | | + float advanceWidth; |
| | | + float x0; |
| | | + float ttControlX; |
| | | + float correction; |
| | | + float xMaxEnd; |
| | | + float startY; |
| | | + float t; |
| | |
| | | + float startX; |
| | | + float contourStartX; |
| | | + float dy; |
| | | + sqInt idx; |
| | | + float controlX; |
| | | + float f2; |
| | | + sqInt idx; |
| | | + sqInt i; |
| | | + float y; |
| | | + char *aString; |
| | |
| | | + y = startY; |
| | | + updateAlphasWPZeroStrokeForXy(x, y); |
| | | + updateEdgeCountWPAtXy(x, y); |
| | | + |
| | | + /* But if curve is very small, there is risk of not iterating even once, completely missing a pixel, and breaking fills. |
| | | + In these cases, a larger initial estimation avoids the problem. */ |
| | | + |
| | | + increment = 0.2; |
| | | + dx = fabs(endX-startX); dy = fabs(endY-startY);; |
| | | + increment = (((0.5 / (((dx < dy) ? dy : dx))) < 0.5) ? (0.5 / (((dx < dy) ? dy : dx))) : 0.5); |
| | | + if ((dy < 2.0) && (dx < 2.0)) { |
| | | + increment = 0.5; |
| | | + } |
| | | + t = 0.0; |
| | | + while (1) { |
| | | + t0 = t; |
| | |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); |
| | | + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); |
| | | + dx = x - x0; |
| | | + |
| | | + /* Now adjust the increment to aim at the required hop length, and recompute next point. */ |
| | | + |
| | | + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); |
| | | + dx = x - x0; |
| | | + dy = y - y0; |
| | | + |
| | | + length = sqrt(dx*dx + dy*dy);; |
| | | + correction = hop / length; |
| | | + do { |
| | | + increment = (increment / length) * hop; |
| | | + t = t0 + increment; |
| | | + oneLessT = 1.0 - t; |
| | | + f1 = oneLessT * oneLessT; |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); |
| | | + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); |
| | | + dx = x - x0; |
| | | + dy = y - y0; |
| | | + |
| | | + length = sqrt(dx*dx + dy*dy);; |
| | | + correction = hop / length; |
| | | + } while(correction < 1.0); |
| | | + increment = (increment / length) * hop; |
| | | + t = t0 + increment; |
| | | + oneLessT = 1.0 - t; |
| | | + f1 = oneLessT * oneLessT; |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); |
| | | + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); |
| | | + if (!(t < 1.0)) break; |
| | | + updateAlphasWPZeroStrokeForXy(x, y); |
| | | + updateEdgeCountWPAtXy(x, y); |
| | |
| | | + float advanceWidth; |
| | | + float x0; |
| | | + float ttControlX; |
| | | + float correction; |
| | | + float xMaxEnd; |
| | | + float startY; |
| | | + float t; |
| | |
| | | + float startX; |
| | | + float contourStartX; |
| | | + float dy; |
| | | + sqInt idx; |
| | | + float controlX; |
| | | + float f2; |
| | | + sqInt idx; |
| | | + sqInt i; |
| | | + float y; |
| | | + unsigned *aWordArray; |
| | |
| | | + y = startY; |
| | | + updateAlphasForXy(x, y); |
| | | + updateEdgeCountAtXy(x, y); |
| | | + |
| | | + /* But if curve is very small, there is risk of not iterating even once, completely missing a pixel, and breaking fills. |
| | | + In these cases, a larger initial estimation avoids the problem. */ |
| | | + |
| | | + increment = 0.2; |
| | | + dx = fabs(endX-startX); dy = fabs(endY-startY);; |
| | | + increment = (((0.5 / (((dx < dy) ? dy : dx))) < 0.5) ? (0.5 / (((dx < dy) ? dy : dx))) : 0.5); |
| | | + if ((dy < 2.0) && (dx < 2.0)) { |
| | | + increment = 0.5; |
| | | + } |
| | | + t = 0.0; |
| | | + while (1) { |
| | | + t0 = t; |
| | |
| | | + t = t0 + increment; oneLessT = 1.0 - t; |
| | | + f1 = oneLessT * oneLessT; f2 = 2.0 * oneLessT * t; f3 = t * t; |
| | | + x = (f1 * startX) + (f2 * controlX) + (f3 * endX); |
| | | + y = (f1 * startY) + (f2 * controlY) + (f3 * endY); |
| | | + dx = x-x0; dy = y-y0; |
| | | + length = sqrt(dx*dx + dy*dy);; |
| | | + y = (f1 * startY) + (f2 * controlY) + (f3 * endY);; |
| | | + dx = x - x0; |
| | | + |
| | | + /* Now adjust the increment to aim at the required hop length, and recompute next point. */ |
| | | + |
| | | + correction = hop / length; |
| | | + do { |
| | | + increment = (increment / length) * hop; |
| | | + t = t0 + increment; |
| | | + oneLessT = 1.0 - t; |
| | | + f1 = oneLessT * oneLessT; |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); |
| | | + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); |
| | | + dx = x - x0; |
| | | + dy = y - y0; |
| | | + |
| | | + length = sqrt(dx*dx + dy*dy);; |
| | | + correction = hop / length; |
| | | + } while(correction < 1.0); |
| | | + dy = y - y0; |
| | | + |
| | | + length = sqrt(dx*dx + dy*dy);; |
| | | + increment = (increment / length) * hop; |
| | | + t = t0 + increment; |
| | | + oneLessT = 1.0 - t; |
| | | + f1 = oneLessT * oneLessT; |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); |
| | | + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); |
| | | + if (!(t < 1.0)) break; |
| | | + updateAlphasForXy(x, y); |
| | | + updateEdgeCountAtXy(x, y); |
| | |
| | | + float advanceWidth; |
| | | + float x0; |
| | | + float ttControlX; |
| | | + float correction; |
| | | + float xMaxEnd; |
| | | + float startY; |
| | | + float t; |
| | |
| | | + float startX; |
| | | + float contourStartX; |
| | | + float dy; |
| | | + sqInt idx; |
| | | + float controlX; |
| | | + float f2; |
| | | + sqInt idx; |
| | | + sqInt i; |
| | | + float y; |
| | | + unsigned *aWordArray; |
| | |
| | | + y = startY; |
| | | + updateAlphasWPZeroStrokeForXy(x, y); |
| | | + updateEdgeCountWPAtXy(x, y); |
| | | + |
| | | + /* But if curve is very small, there is risk of not iterating even once, completely missing a pixel, and breaking fills. |
| | | + In these cases, a larger initial estimation avoids the problem. */ |
| | | + |
| | | + increment = 0.2; |
| | | + dx = fabs(endX-startX); dy = fabs(endY-startY);; |
| | | + increment = (((0.5 / (((dx < dy) ? dy : dx))) < 0.5) ? (0.5 / (((dx < dy) ? dy : dx))) : 0.5); |
| | | + if ((dy < 2.0) && (dx < 2.0)) { |
| | | + increment = 0.5; |
| | | + } |
| | | + t = 0.0; |
| | | + while (1) { |
| | | + t0 = t; |
| | |
| | | + t = t0 + increment; oneLessT = 1.0 - t; |
| | | + f1 = oneLessT * oneLessT; f2 = 2.0 * oneLessT * t; f3 = t * t; |
| | | + x = (f1 * startX) + (f2 * controlX) + (f3 * endX); |
| | | + y = (f1 * startY) + (f2 * controlY) + (f3 * endY); |
| | | + dx = x-x0; dy = y-y0; |
| | | + length = sqrt(dx*dx + dy*dy);; |
| | | + y = (f1 * startY) + (f2 * controlY) + (f3 * endY);; |
| | | + dx = x - x0; |
| | | + |
| | | + /* Now adjust the increment to aim at the required hop length, and recompute next point. */ |
| | | + |
| | | + correction = hop / length; |
| | | + do { |
| | | + increment = (increment / length) * hop; |
| | | + t = t0 + increment; |
| | | + oneLessT = 1.0 - t; |
| | | + f1 = oneLessT * oneLessT; |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); |
| | | + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); |
| | | + dx = x - x0; |
| | | + dy = y - y0; |
| | | + |
| | | + length = sqrt(dx*dx + dy*dy);; |
| | | + correction = hop / length; |
| | | + } while(correction < 1.0); |
| | | + dy = y - y0; |
| | | + |
| | | + length = sqrt(dx*dx + dy*dy);; |
| | | + increment = (increment / length) * hop; |
| | | + t = t0 + increment; |
| | | + oneLessT = 1.0 - t; |
| | | + f1 = oneLessT * oneLessT; |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); |
| | | + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); |
| | | + if (!(t < 1.0)) break; |
| | | + updateAlphasWPZeroStrokeForXy(x, y); |
| | | + updateEdgeCountWPAtXy(x, y); |
| | |
| | | + float advanceWidth; |
| | | + float x0; |
| | | + float ttControlX; |
| | | + float correction; |
| | | + float xMaxEnd; |
| | | + float startY; |
| | | + float t; |
| | |
| | | + float startX; |
| | | + float contourStartX; |
| | | + float dy; |
| | | + sqInt idx; |
| | | + float controlX; |
| | | + float f2; |
| | | + sqInt i; |
| | | + float y; |
| | | + sqInt idx; |
| | | + unsigned char *aByteArray; |
| | | + sqInt byteStartIndex; |
| | | + sqInt byteStopIndex; |
| | |
| | | + y = startY; |
| | | + updateAlphasForXy(x, y); |
| | | + updateEdgeCountAtXy(x, y); |
| | | + |
| | | + /* But if curve is very small, there is risk of not iterating even once, completely missing a pixel, and breaking fills. |
| | | + In these cases, a larger initial estimation avoids the problem. */ |
| | | + |
| | | + increment = 0.2; |
| | | + dx = fabs(endX-startX); dy = fabs(endY-startY);; |
| | | + |
| | | + /* Compute Quadratic Bezier Curve, */ |
| | | + |
| | | + increment = (((0.5 / (((dx < dy) ? dy : dx))) < 0.5) ? (0.5 / (((dx < dy) ? dy : dx))) : 0.5); |
| | | + if ((dy < 2.0) && (dx < 2.0)) { |
| | | + increment = 0.5; |
| | | + } |
| | | + t = 0.0; |
| | | + while (1) { |
| | | + t0 = t; |
| | |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); |
| | | + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); |
| | | + dx = x - x0; |
| | | + |
| | | + /* Now adjust the increment to aim at the required hop length, and recompute next point. */ |
| | | + |
| | | + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); |
| | | + dx = x - x0; |
| | | + dy = y - y0; |
| | | + |
| | | + length = sqrt(dx*dx + dy*dy);; |
| | | + correction = hop / length; |
| | | + do { |
| | | + increment = (increment / length) * hop; |
| | | + t = t0 + increment; |
| | | + oneLessT = 1.0 - t; |
| | | + f1 = oneLessT * oneLessT; |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); |
| | | + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); |
| | | + dx = x - x0; |
| | | + dy = y - y0; |
| | | + |
| | | + length = sqrt(dx*dx + dy*dy);; |
| | | + correction = hop / length; |
| | | + } while(correction < 1.0); |
| | | + increment = (increment / length) * hop; |
| | | + t = t0 + increment; |
| | | + oneLessT = 1.0 - t; |
| | | + f1 = oneLessT * oneLessT; |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); |
| | | + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); |
| | | + if (!(t < 1.0)) break; |
| | | + updateAlphasForXy(x, y); |
| | | + updateEdgeCountAtXy(x, y); |
| | |
| | | + float advanceWidth; |
| | | + float x0; |
| | | + float ttControlX; |
| | | + float correction; |
| | | + float xMaxEnd; |
| | | + float startY; |
| | | + float t; |
| | |
| | | + float startX; |
| | | + float contourStartX; |
| | | + float dy; |
| | | + sqInt idx; |
| | | + float controlX; |
| | | + float f2; |
| | | + sqInt i; |
| | | + float y; |
| | | + sqInt idx; |
| | | + unsigned char *aByteArray; |
| | | + sqInt byteStartIndex; |
| | | + sqInt byteStopIndex; |
| | |
| | | + y = startY; |
| | | + updateAlphasWPZeroStrokeForXy(x, y); |
| | | + updateEdgeCountWPAtXy(x, y); |
| | | + |
| | | + /* But if curve is very small, there is risk of not iterating even once, completely missing a pixel, and breaking fills. |
| | | + In these cases, a larger initial estimation avoids the problem. */ |
| | | + |
| | | + increment = 0.2; |
| | | + dx = fabs(endX-startX); dy = fabs(endY-startY);; |
| | | + |
| | | + /* Compute Quadratic Bezier Curve, */ |
| | | + |
| | | + increment = (((0.5 / (((dx < dy) ? dy : dx))) < 0.5) ? (0.5 / (((dx < dy) ? dy : dx))) : 0.5); |
| | | + if ((dy < 2.0) && (dx < 2.0)) { |
| | | + increment = 0.5; |
| | | + } |
| | | + t = 0.0; |
| | | + while (1) { |
| | | + t0 = t; |
| | |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); |
| | | + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); |
| | | + dx = x - x0; |
| | | + |
| | | + /* Now adjust the increment to aim at the required hop length, and recompute next point. */ |
| | | + |
| | | + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); |
| | | + dx = x - x0; |
| | | + dy = y - y0; |
| | | + |
| | | + length = sqrt(dx*dx + dy*dy);; |
| | | + correction = hop / length; |
| | | + do { |
| | | + increment = (increment / length) * hop; |
| | | + t = t0 + increment; |
| | | + oneLessT = 1.0 - t; |
| | | + f1 = oneLessT * oneLessT; |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); |
| | | + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); |
| | | + dx = x - x0; |
| | | + dy = y - y0; |
| | | + |
| | | + length = sqrt(dx*dx + dy*dy);; |
| | | + correction = hop / length; |
| | | + } while(correction < 1.0); |
| | | + increment = (increment / length) * hop; |
| | | + t = t0 + increment; |
| | | + oneLessT = 1.0 - t; |
| | | + f1 = oneLessT * oneLessT; |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); |
| | | + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); |
| | | + if (!(t < 1.0)) break; |
| | | + updateAlphasWPZeroStrokeForXy(x, y); |
| | | + updateEdgeCountWPAtXy(x, y); |
| | |
| | | + /* drawable left. Will later be refined. */ |
| | | + |
| | | + spanRight = 0; |
| | | + |
| | | + /* drawable top. Will later be refined. */ |
| | | + |
| | | + spanBottom = 0; |
| | | + prevYRounded = 0x7FFFFFFFU; |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | |
| | | + double yTo; |
| | | + unsigned *otherWordArray; |
| | | + unsigned *anotherWordArray; |
| | | + float *aFloat32Array; |
| | | + |
| | | + xFrom = interpreterProxy->stackFloatValue(6); |
| | | + yFrom = interpreterProxy->stackFloatValue(5); |
| | | + xTo = interpreterProxy->stackFloatValue(4); |
| | | + yTo = interpreterProxy->stackFloatValue(3); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(2))); |
| | | + otherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(2)))); |
| | | + xFrom = interpreterProxy->stackFloatValue(5); |
| | | + yFrom = interpreterProxy->stackFloatValue(4); |
| | | + xTo = interpreterProxy->stackFloatValue(3); |
| | | + yTo = interpreterProxy->stackFloatValue(2); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(1))); |
| | | + anotherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); |
| | | + aFloat32Array = ((float *) (interpreterProxy->arrayValueOf(interpreterProxy->stackValue(0)))); |
| | | + otherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(0))); |
| | | + anotherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(0)))); |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + edgeCounts = otherWordArray; |
| | | + alphaMask = anotherWordArray; |
| | | + contour = aFloat32Array; |
| | | + pvt_lineFromXytoXy(xFrom, yFrom, xTo, yTo); |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(7); |
| | | + interpreterProxy->pop(6); |
| | | + return null; |
| | | +} |
| | | + |
| | |
| | | + double yTo; |
| | | + unsigned char *otherByteArray; |
| | | + unsigned char *anotherByteArray; |
| | | + float *aFloat32Array; |
| | | + |
| | | + xFrom = interpreterProxy->stackFloatValue(6); |
| | | + yFrom = interpreterProxy->stackFloatValue(5); |
| | | + xTo = interpreterProxy->stackFloatValue(4); |
| | | + yTo = interpreterProxy->stackFloatValue(3); |
| | | + interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(2))); |
| | | + otherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(2)))); |
| | | + xFrom = interpreterProxy->stackFloatValue(5); |
| | | + yFrom = interpreterProxy->stackFloatValue(4); |
| | | + xTo = interpreterProxy->stackFloatValue(3); |
| | | + yTo = interpreterProxy->stackFloatValue(2); |
| | | + interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(1))); |
| | | + anotherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); |
| | | + aFloat32Array = ((float *) (interpreterProxy->arrayValueOf(interpreterProxy->stackValue(0)))); |
| | | + otherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); |
| | | + interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(0))); |
| | | + anotherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(0)))); |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + edgeCountsWP = otherByteArray; |
| | | + alphaMaskWP = anotherByteArray; |
| | | + contour = aFloat32Array; |
| | | + pvt_lineWPFromXytoXy(xFrom, yFrom, xTo, yTo); |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(7); |
| | | + interpreterProxy->pop(6); |
| | | + return null; |
| | | +} |
| | | + |
| | |
| | | +} |
| | | + |
| | | +EXPORT(sqInt) primPathSequence(void) { |
| | | + float endX; |
| | | + float control2Y; |
| | | + float startY; |
| | | + float control1X; |
| | | + sqInt commandType; |
| | | + float endX; |
| | | + float endY; |
| | | + float control2X; |
| | | + float control2Y; |
| | | + float startX; |
| | | + float startY; |
| | | + float control1X; |
| | | + float control1Y; |
| | | + sqInt i; |
| | | + float *aFloat32Array; |
| | | + sqInt size; |
| | | + unsigned *otherWordArray; |
| | | + unsigned *anotherWordArray; |
| | | + float *otherFloat32Array; |
| | | + |
| | | + aFloat32Array = ((float *) (interpreterProxy->arrayValueOf(interpreterProxy->stackValue(4)))); |
| | | + size = interpreterProxy->stackIntegerValue(3); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(2))); |
| | | + otherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(2)))); |
| | | + aFloat32Array = ((float *) (interpreterProxy->arrayValueOf(interpreterProxy->stackValue(3)))); |
| | | + size = interpreterProxy->stackIntegerValue(2); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(1))); |
| | | + anotherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); |
| | | + otherFloat32Array = ((float *) (interpreterProxy->arrayValueOf(interpreterProxy->stackValue(0)))); |
| | | + otherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(0))); |
| | | + anotherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(0)))); |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + edgeCounts = otherWordArray; |
| | | + alphaMask = anotherWordArray; |
| | | + contour = otherFloat32Array; |
| | | + i = 0; |
| | | + while (i < size) { |
| | | + commandType = ((sqInt)(aFloat32Array[i])); |
| | |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(5); |
| | | + interpreterProxy->pop(4); |
| | | + return null; |
| | | + } |
| | | + startX = aFloat32Array[i]; |
| | |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(5); |
| | | + interpreterProxy->pop(4); |
| | | + return null; |
| | | + } |
| | | + endX = aFloat32Array[i]; |
| | |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(5); |
| | | + interpreterProxy->pop(4); |
| | | + return null; |
| | | + } |
| | | + endX = aFloat32Array[i]; |
| | |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(5); |
| | | + interpreterProxy->pop(4); |
| | | + return null; |
| | | + } |
| | | + endX = aFloat32Array[i]; |
| | |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(5); |
| | | + interpreterProxy->pop(4); |
| | | + return null; |
| | | + |
| | | + } |
| | |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(5); |
| | | + interpreterProxy->pop(4); |
| | | + return null; |
| | | +} |
| | | + |
| | | +EXPORT(sqInt) primPathSequenceWP(void) { |
| | | + float endX; |
| | | + float control2Y; |
| | | + float startY; |
| | | + float control1X; |
| | | + sqInt commandType; |
| | | + float endX; |
| | | + float endY; |
| | | + float control2X; |
| | | + float control2Y; |
| | | + float startX; |
| | | + float startY; |
| | | + float control1X; |
| | | + float control1Y; |
| | | + sqInt i; |
| | | + float *aFloat32Array; |
| | | + sqInt size; |
| | | + unsigned char *otherByteArray; |
| | | + unsigned char *anotherByteArray; |
| | | + float *otherFloat32Array; |
| | | + |
| | | + aFloat32Array = ((float *) (interpreterProxy->arrayValueOf(interpreterProxy->stackValue(4)))); |
| | | + size = interpreterProxy->stackIntegerValue(3); |
| | | + interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(2))); |
| | | + otherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(2)))); |
| | | + aFloat32Array = ((float *) (interpreterProxy->arrayValueOf(interpreterProxy->stackValue(3)))); |
| | | + size = interpreterProxy->stackIntegerValue(2); |
| | | + interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(1))); |
| | | + anotherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); |
| | | + otherFloat32Array = ((float *) (interpreterProxy->arrayValueOf(interpreterProxy->stackValue(0)))); |
| | | + otherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); |
| | | + interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(0))); |
| | | + anotherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(0)))); |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + edgeCountsWP = otherByteArray; |
| | | + alphaMaskWP = anotherByteArray; |
| | | + contour = otherFloat32Array; |
| | | + i = 0; |
| | | + while (i < size) { |
| | | + commandType = ((sqInt)(aFloat32Array[i])); |
| | |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(5); |
| | | + interpreterProxy->pop(4); |
| | | + return null; |
| | | + } |
| | | + startX = aFloat32Array[i]; |
| | |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(5); |
| | | + interpreterProxy->pop(4); |
| | | + return null; |
| | | + } |
| | | + endX = aFloat32Array[i]; |
| | |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(5); |
| | | + interpreterProxy->pop(4); |
| | | + return null; |
| | | + } |
| | | + endX = aFloat32Array[i]; |
| | |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(5); |
| | | + interpreterProxy->pop(4); |
| | | + return null; |
| | | + } |
| | | + endX = aFloat32Array[i]; |
| | |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(5); |
| | | + interpreterProxy->pop(4); |
| | | + return null; |
| | | + |
| | | + } |
| | |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(5); |
| | | + interpreterProxy->pop(4); |
| | | + return null; |
| | | +} |
| | | + |
| | |
| | | +EXPORT(sqInt) pluginApiVersion(void) { |
| | | + sqInt _return_value; |
| | | + |
| | | + _return_value = interpreterProxy->integerObjectOf(5); |
| | | + _return_value = interpreterProxy->integerObjectOf(4); |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | |
| | | + if (!(fillA == 0.0)) { |
| | | + updateEdgeCountAtXy(x, y); |
| | | + } |
| | | + updateContourForXy(x, y); |
| | | + t += increment; |
| | | + } |
| | | + updateAlphasForXy(txTo, tyTo); |
| | | + if (!(fillA == 0.0)) { |
| | | + updateEdgeCountAtXy(txTo, tyTo); |
| | | + } |
| | | + updateContourForXy(txTo, tyTo); |
| | | + return null; |
| | | +} |
| | | + |
| | |
| | | + if (!(fillA == 0.0)) { |
| | | + updateEdgeCountWPAtXy(x, y); |
| | | + } |
| | | + updateContourForXy(x, y); |
| | | + t += increment; |
| | | + } |
| | | + updateAlphasWPForXy(txTo, tyTo); |
| | | + if (!(fillA == 0.0)) { |
| | | + updateEdgeCountWPAtXy(txTo, tyTo); |
| | | + } |
| | | + updateContourForXy(txTo, tyTo); |
| | | + return null; |
| | | +} |
| | | + |
| | |
| | | + if (!(fillA == 0.0)) { |
| | | + updateEdgeCountAtXy(x, y); |
| | | + } |
| | | + updateContourForXy(x, y); |
| | | + x += incrementX; |
| | | + y += incrementY; |
| | | + } |
| | |
| | | + if (!(fillA == 0.0)) { |
| | | + updateEdgeCountAtXy(txTo, tyTo); |
| | | + } |
| | | + updateContourForXy(txTo, tyTo); |
| | | + return null; |
| | | +} |
| | | + |
| | |
| | | + if (!(fillA == 0.0)) { |
| | | + updateEdgeCountWPAtXy(x, y); |
| | | + } |
| | | + updateContourForXy(x, y); |
| | | + x += incrementX; |
| | | + y += incrementY; |
| | | + } |
| | |
| | | + if (!(fillA == 0.0)) { |
| | | + updateEdgeCountWPAtXy(txTo, tyTo); |
| | | + } |
| | | + updateContourForXy(txTo, tyTo); |
| | | + return null; |
| | | +} |
| | | + |
| | |
| | | + float increment; |
| | | + float x0; |
| | | + float txControl; |
| | | + float correction; |
| | | + float xMaxEnd; |
| | | + float t; |
| | | + float tyTo; |
| | |
| | | + float dy2; |
| | | + float txTo; |
| | | + float length; |
| | | + float t0; |
| | | + float y0; |
| | | + float t0; |
| | | + float xMinEnd; |
| | | + float tyControl; |
| | | + float dy; |
| | |
| | | + if (!(fillA == 0.0)) { |
| | | + updateEdgeCountAtXy(x, y); |
| | | + } |
| | | + updateContourForXy(x, y); |
| | | + increment = (((0.5 / (((dx < dy) ? dy : dx))) < 0.5) ? (0.5 / (((dx < dy) ? dy : dx))) : 0.5); |
| | | + |
| | | + /* But if curve is very small, there is risk of not iterating even once, completely missing a pixel, and breaking fills. |
| | | + In these cases, a larger initial estimation avoids the problem. */ |
| | | + |
| | | + increment = 0.2; |
| | | + if ((dy < 2.0) && (dx < 2.0)) { |
| | | + increment = 0.5; |
| | | + } |
| | | + t = 0.0; |
| | | + while (1) { |
| | | + t0 = t; |
| | |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * txFrom) + (f2 * txControl)) + (f3 * txTo); |
| | | + y = ((f1 * tyFrom) + (f2 * tyControl)) + (f3 * tyTo); |
| | | + dx = x - x0; |
| | | + |
| | | + /* Now adjust the increment to aim at the required hop length, and recompute next point. */ |
| | | + |
| | | + y = ((f1 * tyFrom) + (f2 * tyControl)) + (f3 * tyTo); |
| | | + dx = x - x0; |
| | | + dy = y - y0; |
| | | + |
| | | + length = sqrt(dx*dx + dy*dy);; |
| | | + correction = hop / length; |
| | | + do { |
| | | + increment = (increment / length) * hop; |
| | | + t = t0 + increment; |
| | | + oneLessT = 1.0 - t; |
| | | + f1 = oneLessT * oneLessT; |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * txFrom) + (f2 * txControl)) + (f3 * txTo); |
| | | + y = ((f1 * tyFrom) + (f2 * tyControl)) + (f3 * tyTo); |
| | | + dx = x - x0; |
| | | + dy = y - y0; |
| | | + |
| | | + length = sqrt(dx*dx + dy*dy);; |
| | | + correction = hop / length; |
| | | + } while(correction < 1.0); |
| | | + increment = (increment / length) * hop; |
| | | + t = t0 + increment; |
| | | + oneLessT = 1.0 - t; |
| | | + f1 = oneLessT * oneLessT; |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * txFrom) + (f2 * txControl)) + (f3 * txTo); |
| | | + y = ((f1 * tyFrom) + (f2 * tyControl)) + (f3 * tyTo); |
| | | + if (!(t < 1.0)) break; |
| | | + updateAlphasForXy(x, y); |
| | | + if (!(fillA == 0.0)) { |
| | | + updateEdgeCountAtXy(x, y); |
| | | + } |
| | | + updateContourForXy(x, y); |
| | | + } |
| | | + updateAlphasForXy(txTo, tyTo); |
| | | + if (!(fillA == 0.0)) { |
| | | + updateEdgeCountAtXy(txTo, tyTo); |
| | | + } |
| | | + updateContourForXy(txTo, tyTo); |
| | | + return null; |
| | | +} |
| | | + |
| | |
| | | + float increment; |
| | | + float x0; |
| | | + float txControl; |
| | | + float correction; |
| | | + float xMaxEnd; |
| | | + float t; |
| | | + float tyTo; |
| | |
| | | + float dy2; |
| | | + float txTo; |
| | | + float length; |
| | | + float t0; |
| | | + float y0; |
| | | + float t0; |
| | | + float xMinEnd; |
| | | + float tyControl; |
| | | + float dy; |
| | |
| | | + if (!(fillA == 0.0)) { |
| | | + updateEdgeCountWPAtXy(x, y); |
| | | + } |
| | | + updateContourForXy(x, y); |
| | | + increment = (((0.5 / (((dx < dy) ? dy : dx))) < 0.5) ? (0.5 / (((dx < dy) ? dy : dx))) : 0.5); |
| | | + |
| | | + /* But if curve is very small, there is risk of not iterating even once, completely missing a pixel, and breaking fills. |
| | | + In these cases, a larger initial estimation avoids the problem. */ |
| | | + |
| | | + increment = 0.2; |
| | | + if ((dy < 2.0) && (dx < 2.0)) { |
| | | + increment = 0.5; |
| | | + } |
| | | + t = 0.0; |
| | | + while (1) { |
| | | + t0 = t; |
| | |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * txFrom) + (f2 * txControl)) + (f3 * txTo); |
| | | + y = ((f1 * tyFrom) + (f2 * tyControl)) + (f3 * tyTo); |
| | | + dx = x - x0; |
| | | + |
| | | + /* Now adjust the increment to aim at the required hop length, and recompute next point. */ |
| | | + |
| | | + y = ((f1 * tyFrom) + (f2 * tyControl)) + (f3 * tyTo); |
| | | + dx = x - x0; |
| | | + dy = y - y0; |
| | | + |
| | | + length = sqrt(dx*dx + dy*dy);; |
| | | + correction = hop / length; |
| | | + do { |
| | | + increment = (increment / length) * hop; |
| | | + t = t0 + increment; |
| | | + oneLessT = 1.0 - t; |
| | | + f1 = oneLessT * oneLessT; |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * txFrom) + (f2 * txControl)) + (f3 * txTo); |
| | | + y = ((f1 * tyFrom) + (f2 * tyControl)) + (f3 * tyTo); |
| | | + dx = x - x0; |
| | | + dy = y - y0; |
| | | + |
| | | + length = sqrt(dx*dx + dy*dy);; |
| | | + correction = hop / length; |
| | | + } while(correction < 1.0); |
| | | + increment = (increment / length) * hop; |
| | | + t = t0 + increment; |
| | | + oneLessT = 1.0 - t; |
| | | + f1 = oneLessT * oneLessT; |
| | | + f2 = (2.0 * oneLessT) * t; |
| | | + f3 = t * t; |
| | | + x = ((f1 * txFrom) + (f2 * txControl)) + (f3 * txTo); |
| | | + y = ((f1 * tyFrom) + (f2 * tyControl)) + (f3 * tyTo); |
| | | + if (!(t < 1.0)) break; |
| | | + updateAlphasWPForXy(x, y); |
| | | + if (!(fillA == 0.0)) { |
| | | + updateEdgeCountWPAtXy(x, y); |
| | | + } |
| | | + updateContourForXy(x, y); |
| | | + } |
| | | + updateAlphasWPForXy(txTo, tyTo); |
| | | + if (!(fillA == 0.0)) { |
| | | + updateEdgeCountWPAtXy(txTo, tyTo); |
| | | + } |
| | | + updateContourForXy(txTo, tyTo); |
| | | + return null; |
| | | +} |
| | | + |
| | |
| | | + double yControl; |
| | | + unsigned *otherWordArray; |
| | | + unsigned *anotherWordArray; |
| | | + float *aFloat32Array; |
| | | + |
| | | + xFrom = interpreterProxy->stackFloatValue(8); |
| | | + yFrom = interpreterProxy->stackFloatValue(7); |
| | | + xTo = interpreterProxy->stackFloatValue(6); |
| | | + yTo = interpreterProxy->stackFloatValue(5); |
| | | + xControl = interpreterProxy->stackFloatValue(4); |
| | | + yControl = interpreterProxy->stackFloatValue(3); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(2))); |
| | | + otherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(2)))); |
| | | + xFrom = interpreterProxy->stackFloatValue(7); |
| | | + yFrom = interpreterProxy->stackFloatValue(6); |
| | | + xTo = interpreterProxy->stackFloatValue(5); |
| | | + yTo = interpreterProxy->stackFloatValue(4); |
| | | + xControl = interpreterProxy->stackFloatValue(3); |
| | | + yControl = interpreterProxy->stackFloatValue(2); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(1))); |
| | | + anotherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); |
| | | + aFloat32Array = ((float *) (interpreterProxy->arrayValueOf(interpreterProxy->stackValue(0)))); |
| | | + otherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(0))); |
| | | + anotherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(0)))); |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + edgeCounts = otherWordArray; |
| | | + alphaMask = anotherWordArray; |
| | | + contour = aFloat32Array; |
| | | + pvt_quadraticBezierFromXytoXycontrolXy(xFrom, yFrom, xTo, yTo, xControl, yControl); |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(9); |
| | | + interpreterProxy->pop(8); |
| | | + return null; |
| | | +} |
| | | + |
| | |
| | | + double yControl; |
| | | + unsigned char *otherByteArray; |
| | | + unsigned char *anotherByteArray; |
| | | + float *aFloat32Array; |
| | | + |
| | | + xFrom = interpreterProxy->stackFloatValue(8); |
| | | + yFrom = interpreterProxy->stackFloatValue(7); |
| | | + xTo = interpreterProxy->stackFloatValue(6); |
| | | + yTo = interpreterProxy->stackFloatValue(5); |
| | | + xControl = interpreterProxy->stackFloatValue(4); |
| | | + yControl = interpreterProxy->stackFloatValue(3); |
| | | + interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(2))); |
| | | + otherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(2)))); |
| | | + xFrom = interpreterProxy->stackFloatValue(7); |
| | | + yFrom = interpreterProxy->stackFloatValue(6); |
| | | + xTo = interpreterProxy->stackFloatValue(5); |
| | | + yTo = interpreterProxy->stackFloatValue(4); |
| | | + xControl = interpreterProxy->stackFloatValue(3); |
| | | + yControl = interpreterProxy->stackFloatValue(2); |
| | | + interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(1))); |
| | | + anotherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); |
| | | + aFloat32Array = ((float *) (interpreterProxy->arrayValueOf(interpreterProxy->stackValue(0)))); |
| | | + otherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(1)))); |
| | | + interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(0))); |
| | | + anotherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(0)))); |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + edgeCountsWP = otherByteArray; |
| | | + alphaMaskWP = anotherByteArray; |
| | | + contour = aFloat32Array; |
| | | + pvt_quadraticBezierWPFromXytoXycontrolXy(xFrom, yFrom, xTo, yTo, xControl, yControl); |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(9); |
| | | + return null; |
| | | +} |
| | | + |
| | | +EXPORT(sqInt) primResetContour(void) { |
| | | + sqInt y; |
| | | + sqInt t; |
| | | + sqInt b; |
| | | + |
| | | + t = interpreterProxy->stackIntegerValue(1); |
| | | + b = interpreterProxy->stackIntegerValue(0); |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + leftAtThisY = targetWidth; |
| | | + rightAtThisY = 0; |
| | | + for (y = t; y <= b; y += 1) { |
| | | + contour[y * 2] = targetWidth; |
| | | + contour[(y * 2) + 1] = 0; |
| | | + } |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(2); |
| | | + interpreterProxy->pop(8); |
| | | + return null; |
| | | +} |
| | | + |
| | |
| | | + unsigned *aWordArray; |
| | | + unsigned *otherWordArray; |
| | | + unsigned *anotherWordArray; |
| | | + float *aFloat32Array; |
| | | + sqInt aNumber; |
| | | + sqInt otherNumber; |
| | | + |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(6))); |
| | | + aBitmap = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(6)))); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(5))); |
| | | + aWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(5)))); |
| | | + aBitmap = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(5)))); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(4))); |
| | | + otherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(4)))); |
| | | + aWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(4)))); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(3))); |
| | | + anotherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(3)))); |
| | | + aFloat32Array = ((float *) (interpreterProxy->arrayValueOf(interpreterProxy->stackValue(2)))); |
| | | + otherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(3)))); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(2))); |
| | | + anotherWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(2)))); |
| | | + aNumber = interpreterProxy->stackIntegerValue(1); |
| | | + otherNumber = interpreterProxy->stackIntegerValue(0); |
| | | + if (interpreterProxy->failed()) { |
| | |
| | | + morphIds = aWordArray; |
| | | + edgeCounts = otherWordArray; |
| | | + alphaMask = anotherWordArray; |
| | | + contour = aFloat32Array; |
| | | + targetWidth = aNumber; |
| | | + targetHeight = otherNumber; |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(7); |
| | | + interpreterProxy->pop(6); |
| | | + return null; |
| | | +} |
| | | + |
| | |
| | | + unsigned *aWordArray; |
| | | + unsigned char *otherByteArray; |
| | | + unsigned char *anotherByteArray; |
| | | + float *aFloat32Array; |
| | | + sqInt aNumber; |
| | | + sqInt otherNumber; |
| | | + |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(6))); |
| | | + aBitmap = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(6)))); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(5))); |
| | | + aWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(5)))); |
| | | + interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(4))); |
| | | + otherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(4)))); |
| | | + aBitmap = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(5)))); |
| | | + interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(4))); |
| | | + aWordArray = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(4)))); |
| | | + interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(3))); |
| | | + anotherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(3)))); |
| | | + aFloat32Array = ((float *) (interpreterProxy->arrayValueOf(interpreterProxy->stackValue(2)))); |
| | | + otherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(3)))); |
| | | + interpreterProxy->success(interpreterProxy->isBytes(interpreterProxy->stackValue(2))); |
| | | + anotherByteArray = ((unsigned char *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(2)))); |
| | | + aNumber = interpreterProxy->stackIntegerValue(1); |
| | | + otherNumber = interpreterProxy->stackIntegerValue(0); |
| | | + if (interpreterProxy->failed()) { |
| | |
| | | + morphIds = aWordArray; |
| | | + edgeCountsWP = otherByteArray; |
| | | + alphaMaskWP = anotherByteArray; |
| | | + contour = aFloat32Array; |
| | | + targetWidth = aNumber; |
| | | + targetHeight = otherNumber; |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + interpreterProxy->pop(7); |
| | | + interpreterProxy->pop(6); |
| | | + return null; |
| | | +} |
| | | + |
| | |
| | | + - we know distanceToEdge is always > erodedHalfWidth. */ |
| | | + |
| | | +static sqInt updateAlphasWPZeroStrokeForXy(float x, float y) { |
| | | + sqInt l; |
| | | + uint8_t candidateAlpha; |
| | | + sqInt pixelIndex; |
| | | + sqInt b; |
| | |
| | | + sqInt t; |
| | | + float distanceToAxisSquared; |
| | | + sqInt displayX; |
| | | + float dx; |
| | | + sqInt l; |
| | | + float dySquared; |
| | | + sqInt displayY; |
| | | + float dx; |
| | | + float dy; |
| | | + sqInt displayY; |
| | | + uint8_t alphaByte; |
| | | + |
| | | + |
| | |
| | | + } |
| | | + } |
| | | + } |
| | | + } |
| | | + return null; |
| | | +} |
| | | + |
| | | + |
| | | +/* The Contour of the current morph is the pixel area affected, but without holes. |
| | | + For each y line where a pixel is affected, record the leftmost and rightmost affected pixels. |
| | | + Note: Only includes pen trajectory, but not stroke width. */ |
| | | + |
| | | +static sqInt updateContourForXy(float x, float y) { |
| | | + sqInt thisYRounded; |
| | | + |
| | | + thisYRounded = ((sqInt)(y + 0.5)); |
| | | + if (((thisYRounded >= 0) && (thisYRounded <= (targetHeight - 1)))) { |
| | | + if (!(thisYRounded == prevYRounded)) { |
| | | + if (!(prevYRounded == 0x7FFFFFFFU)) { |
| | | + contour[prevYRounded * 2] = leftAtThisY; |
| | | + contour[(prevYRounded * 2) + 1] = rightAtThisY; |
| | | + } |
| | | + leftAtThisY = contour[thisYRounded * 2]; |
| | | + rightAtThisY = contour[(thisYRounded * 2) + 1]; |
| | | + prevYRounded = thisYRounded; |
| | | + } |
| | | + leftAtThisY = ((leftAtThisY < x) ? leftAtThisY : x); |
| | | + rightAtThisY = ((rightAtThisY < x) ? x : rightAtThisY); |
| | | + } |
| | | + return null; |
| | | +} |
| | | + |
| | | +EXPORT(sqInt) primUpdateContourLastLine(void) { |
| | | + if (!(prevYRounded == 0x7FFFFFFFU)) { |
| | | + contour[prevYRounded * 2] = leftAtThisY; |
| | | + contour[(prevYRounded * 2) + 1] = rightAtThisY; |
| | | + } |
| | | + if (interpreterProxy->failed()) { |
| | | + return null; |
| | | + } |
| | | + return null; |
| | | +} |
| | |
| | | + |
| | | +void* VectorEnginePlugin_exports[][3] = { |
| | | + {"VectorEnginePlugin", "primSpanRight", (void*)primSpanRight}, |
| | | + {"VectorEnginePlugin", "primArcWP", (void*)primArcWP}, |
| | | + {"VectorEnginePlugin", "primArc", (void*)primArc}, |
| | | + {"VectorEnginePlugin", "primDisplayUtf8", (void*)primDisplayUtf8}, |
| | | + {"VectorEnginePlugin", "pluginApiVersion", (void*)pluginApiVersion}, |
| | | + {"VectorEnginePlugin", "primResetContour", (void*)primResetContour}, |
| | | + {"VectorEnginePlugin", "primLine", (void*)primLine}, |
| | | + {"VectorEnginePlugin", "primCubicBezier", (void*)primCubicBezier}, |
| | | + {"VectorEnginePlugin", "primNewTrajectoryFragment", (void*)primNewTrajectoryFragment}, |
| | | + {"VectorEnginePlugin", "primBlendStrokeOnlyWPOT", (void*)primBlendStrokeOnlyWPOT}, |
| | | + {"VectorEnginePlugin", "primSetTargetWP", (void*)primSetTargetWP}, |
| | | + {"VectorEnginePlugin", "primDisplayUtf32WP", (void*)primDisplayUtf32WP}, |
| | | + {"VectorEnginePlugin", "setInterpreter", (void*)setInterpreter}, |
| | | + {"VectorEnginePlugin", "primSpanBottom", (void*)primSpanBottom}, |
| | | + {"VectorEnginePlugin", "primDisplayString", (void*)primDisplayString}, |
| | | + {"VectorEnginePlugin", "primDisplayUtf32", (void*)primDisplayUtf32}, |
| | | + {"VectorEnginePlugin", "primDisplayUtf8WP", (void*)primDisplayUtf8WP}, |
| | | + {"VectorEnginePlugin", "primCubicBezierWP", (void*)primCubicBezierWP}, |
| | | + {"VectorEnginePlugin", "primPathSequenceWP", (void*)primPathSequenceWP}, |
| | | + {"VectorEnginePlugin", "primLineWP", (void*)primLineWP}, |
| | | + {"VectorEnginePlugin", "primDisplayStringWP", (void*)primDisplayStringWP}, |
| | | + {"VectorEnginePlugin", "primPathSequence", (void*)primPathSequence}, |
| | | + {"VectorEnginePlugin", "primBlendFillOnlyWPOT", (void*)primBlendFillOnlyWPOT}, |
| | | + {"VectorEnginePlugin", "getModuleName", (void*)getModuleName}, |
| | | + {"VectorEnginePlugin", "primInitializePath", (void*)primInitializePath}, |
| | | + {"VectorEnginePlugin", "primStrokeWidth", (void*)primStrokeWidth}, |
| | | + {"VectorEnginePlugin", "primBlendFillOnly", (void*)primBlendFillOnly}, |
| | | + {"VectorEnginePlugin", "primCurrentMorphIdcurrentClipsSubmorphs", (void*)primCurrentMorphIdcurrentClipsSubmorphs}, |
| | | + {"VectorEnginePlugin", "primStrokeRGBA", (void*)primStrokeRGBA}, |
| | | + {"VectorEnginePlugin", "primAntiAliasingWidthsubPixelDeltaHopLength", (void*)primAntiAliasingWidthsubPixelDeltaHopLength}, |
| | | + {"VectorEnginePlugin", "primQuadraticBezier", (void*)primQuadraticBezier}, |
| | | + {"VectorEnginePlugin", "primClipLeftclipTopclipRightclipBottom", (void*)primClipLeftclipTopclipRightclipBottom}, |
| | | + {"VectorEnginePlugin", "primClipCurrentMorph", (void*)primClipCurrentMorph}, |
| | | + {"VectorEnginePlugin", "primSetTarget", (void*)primSetTarget}, |
| | | + {"VectorEnginePlugin", "primBlendStrokeOnly", (void*)primBlendStrokeOnly}, |
| | | + {"VectorEnginePlugin", "primBlendStrokeAndFillWPOT", (void*)primBlendStrokeAndFillWPOT}, |
| | | + {"VectorEnginePlugin", "primSpanTop", (void*)primSpanTop}, |
| | | + {"VectorEnginePlugin", "primQuadraticBezierWP", (void*)primQuadraticBezierWP}, |
| | | + {"VectorEnginePlugin", "primFillRGBA", (void*)primFillRGBA}, |
| | | + {"VectorEnginePlugin", "primGeometryTxSet", (void*)primGeometryTxSet}, |
| | | + {"VectorEnginePlugin", "primUpdateContourLastLine", (void*)primUpdateContourLastLine}, |
| | | + {"VectorEnginePlugin", "primBlendStrokeAndFill", (void*)primBlendStrokeAndFill}, |
| | | + {"VectorEnginePlugin", "primClipLeftclipTopclipRightclipBottom", (void*)primClipLeftclipTopclipRightclipBottom}, |
| | | + {"VectorEnginePlugin", "primSpanLeft", (void*)primSpanLeft}, |
| | | + {"VectorEnginePlugin", "primQuadraticBezierWP", (void*)primQuadraticBezierWP}, |
| | | + {"VectorEnginePlugin", "primQuadraticBezier", (void*)primQuadraticBezier}, |
| | | + {"VectorEnginePlugin", "primLine", (void*)primLine}, |
| | | + {"VectorEnginePlugin", "primPathSequenceWP", (void*)primPathSequenceWP}, |
| | | + {"VectorEnginePlugin", "primSpanBottom", (void*)primSpanBottom}, |
| | | + {"VectorEnginePlugin", "primBlendStrokeOnlyWPOT", (void*)primBlendStrokeOnlyWPOT}, |
| | | + {"VectorEnginePlugin", "primAntiAliasingWidthsubPixelDeltaHopLength", (void*)primAntiAliasingWidthsubPixelDeltaHopLength}, |
| | | + {"VectorEnginePlugin", "primPathSequence", (void*)primPathSequence}, |
| | | + {"VectorEnginePlugin", "primSetTarget", (void*)primSetTarget}, |
| | | + {"VectorEnginePlugin", "primCubicBezier", (void*)primCubicBezier}, |
| | | + {"VectorEnginePlugin", "pluginApiVersion", (void*)pluginApiVersion}, |
| | | + {"VectorEnginePlugin", "primNewTrajectoryFragment", (void*)primNewTrajectoryFragment}, |
| | | + {"VectorEnginePlugin", "primDisplayString", (void*)primDisplayString}, |
| | | + {"VectorEnginePlugin", "primCurrentMorphIdcurrentClipsSubmorphs", (void*)primCurrentMorphIdcurrentClipsSubmorphs}, |
| | | + {"VectorEnginePlugin", "primClipCurrentMorph", (void*)primClipCurrentMorph}, |
| | | + {"VectorEnginePlugin", "primBlendFillOnlyWPOT", (void*)primBlendFillOnlyWPOT}, |
| | | + {"VectorEnginePlugin", "primGeometryTxSet", (void*)primGeometryTxSet}, |
| | | + {"VectorEnginePlugin", "primBlendStrokeAndFillWPOT", (void*)primBlendStrokeAndFillWPOT}, |
| | | + {"VectorEnginePlugin", "primDisplayUtf8WP", (void*)primDisplayUtf8WP}, |
| | | + {"VectorEnginePlugin", "primArcWP", (void*)primArcWP}, |
| | | + {"VectorEnginePlugin", "primBlendFillOnly", (void*)primBlendFillOnly}, |
| | | + {"VectorEnginePlugin", "primSpanTop", (void*)primSpanTop}, |
| | | + {"VectorEnginePlugin", "primLineWP", (void*)primLineWP}, |
| | | + {"VectorEnginePlugin", "primInitializePath", (void*)primInitializePath}, |
| | | + {"VectorEnginePlugin", "getModuleName", (void*)getModuleName}, |
| | | + {"VectorEnginePlugin", "setInterpreter", (void*)setInterpreter}, |
| | | + {"VectorEnginePlugin", "primDisplayUtf8", (void*)primDisplayUtf8}, |
| | | + {"VectorEnginePlugin", "primDisplayStringWP", (void*)primDisplayStringWP}, |
| | | + {"VectorEnginePlugin", "primStrokeWidth", (void*)primStrokeWidth}, |
| | | + {"VectorEnginePlugin", "primFillRGBA", (void*)primFillRGBA}, |
| | | + {"VectorEnginePlugin", "primBlendStrokeOnly", (void*)primBlendStrokeOnly}, |
| | | + {"VectorEnginePlugin", "primCubicBezierWP", (void*)primCubicBezierWP}, |
| | | + {"VectorEnginePlugin", "primArc", (void*)primArc}, |
| | | + {"VectorEnginePlugin", "primDisplayUtf32WP", (void*)primDisplayUtf32WP}, |
| | | + {"VectorEnginePlugin", "primDisplayUtf32", (void*)primDisplayUtf32}, |
| | | + {"VectorEnginePlugin", "primSetTargetWP", (void*)primSetTargetWP}, |
| | | + {NULL, NULL, NULL} |
| | | +}; |
| | | + |