Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to upstream latest develop #3

Merged
merged 18 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
2840800
actions: try with Lime 8.2.1
joshtynjala Nov 13, 2024
c93b500
actions: HashLink tests with Haxe 4.3.6
joshtynjala Nov 13, 2024
76a9d3d
actions: Neko unit tests for Haxe 3 now use Lime tools like all other…
joshtynjala Nov 13, 2024
d863321
actions: use krdlab/setup-haxe@master because v1 is not ideal for mac…
joshtynjala Nov 13, 2024
75d3b7a
Revert "actions: use krdlab/setup-haxe@master because v1 is not ideal…
joshtynjala Nov 13, 2024
c2d56b5
Revert "actions: HashLink tests with Haxe 4.3.6"
joshtynjala Nov 13, 2024
8fbc2f6
actions: neko unit tests still seem to fail on Lime 8.2.1
joshtynjala Nov 13, 2024
86d931a
Revert "actions: Neko unit tests for Haxe 3 now use Lime tools like a…
joshtynjala Nov 13, 2024
d7ce901
actions: separate Haxe 3 Neko tests again because we're back to Lime …
joshtynjala Nov 13, 2024
57591ba
docs formatting fixes
joshtynjala Nov 18, 2024
fb629c5
CanvasGraphics: restore old code for SpreadMethod.PAD because the cha…
joshtynjala Nov 19, 2024
581e32f
tests: longer timeouts for new-ish file tests
joshtynjala Nov 19, 2024
9ae92d0
Make `curveTo()` and `cubicCurveTo()` update drawing position.
player-03 Oct 4, 2024
e1d19b5
BitmapDataFileIOTest: increase timeout on async test because it fails…
joshtynjala Nov 19, 2024
12718d4
CairoGraphics, CanvasGraphics: minor optimization of two ifs to if/el…
joshtynjala Nov 19, 2024
b21b1d0
OpenGLRenderer: Fix incorrect caused by Math.ceil and Math.floor in _…
rainyt Nov 19, 2024
a85b04d
Tracy profiler support added
barisyild Oct 16, 2024
439a810
merge upstream develop with funkin local
ninjamuffin99 Nov 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
haxelib install hxcpp --quiet
haxelib install format --quiet
haxelib install hxp --quiet
haxelib install lime 8.1.3 --quiet
haxelib install lime --quiet
haxelib install utest --quiet

- name: Setup environment
Expand Down
13 changes: 7 additions & 6 deletions src/openfl/display/BitmapData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ import openfl.display._internal.stats.DrawCallContext;
@see `openfl.display.Graphics.beginBitmapFill()`
@see `openfl.display.Graphics.lineBitmapStyle()`
**/
#if !openfl_debug
@:fileXml('tags="haxe,release"')
@:noDebug
#end
@:access(lime.graphics.opengl.GL)
@:access(lime.graphics.Image)
@:access(lime.graphics.ImageBuffer)
Expand All @@ -127,9 +131,6 @@ import openfl.display._internal.stats.DrawCallContext;
@:access(openfl.geom.Matrix)
@:access(openfl.geom.Point)
@:access(openfl.geom.Rectangle)
#if !openfl_debug
@:fileXml('tags="haxe,release"') @:noDebug
#end
@:autoBuild(openfl.utils._internal.AssetsMacro.embedBitmap())
class BitmapData implements IBitmapDrawable
{
Expand Down Expand Up @@ -618,16 +619,16 @@ class BitmapData implements IBitmapDrawable
the new channel data is placed. To copy only
channel data from one area to a different area in
the destination image, specify a point other than
(0,0).
(0,0).
@param sourceChannel The source channel. Use a value from the
BitmapDataChannel class
(`BitmapDataChannel.RED`,
(`BitmapDataChannel.RED`,
`BitmapDataChannel.BLUE`,
`BitmapDataChannel.GREEN`,
`BitmapDataChannel.ALPHA`).
@param destChannel The destination channel. Use a value from the
BitmapDataChannel class
(`BitmapDataChannel.RED`,
(`BitmapDataChannel.RED`,
`BitmapDataChannel.BLUE`,
`BitmapDataChannel.GREEN`,
`BitmapDataChannel.ALPHA`).
Expand Down
24 changes: 12 additions & 12 deletions src/openfl/display/Graphics.hx
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ import js.html.CanvasRenderingContext2D;
example, you can use the following matrix to rotate a bitmap
by 45 degrees(pi/4 radians):

```haxe
matrix = new openfl.geom.Matrix();
matrix.rotate(Math.PI / 4);
```
```haxe
matrix = new openfl.geom.Matrix();
matrix.rotate(Math.PI / 4);
```

@param repeat If `true`, the bitmap image repeats in a tiled
pattern. If `false`, the bitmap image does not
Expand Down Expand Up @@ -605,7 +605,7 @@ import js.html.CanvasRenderingContext2D;
/**
Draws an ellipse. Set the line style, fill, or both before you call the
`drawEllipse()` method, by calling the
`linestyle()`, `lineGradientStyle()`,
`lineStyle()`, `lineGradientStyle()`,
`beginFill()`, `beginGradientFill()`, or
`beginBitmapFill()` method.

Expand Down Expand Up @@ -943,7 +943,7 @@ import js.html.CanvasRenderingContext2D;

/**
Draws a rectangle. Set the line style, fill, or both before you call the
`drawRect()` method, by calling the `linestyle()`,
`drawRect()` method, by calling the `lineStyle()`,
`lineGradientStyle()`, `beginFill()`,
`beginGradientFill()`, or `beginBitmapFill()`
method.
Expand All @@ -956,7 +956,7 @@ import js.html.CanvasRenderingContext2D;
@param height The height of the rectangle (in pixels).
@throws ArgumentError If the `width` or `height`
parameters are not a number
(`Number.NaN`).
(`Number.NaN`).

@see [Drawing shapes using built-in methods](https://books.openfl.org/openfl-developers-guide/using-the-drawing-api/drawing-shapes-using-built-in-methods.html)
**/
Expand All @@ -978,7 +978,7 @@ import js.html.CanvasRenderingContext2D;
/**
Draws a rounded rectangle. Set the line style, fill, or both before you
call the `drawRoundRect()` method, by calling the
`linestyle()`, `lineGradientStyle()`,
`lineStyle()`, `lineGradientStyle()`,
`beginFill()`, `beginGradientFill()`, or
`beginBitmapFill()` method.

Expand All @@ -987,7 +987,7 @@ import js.html.CanvasRenderingContext2D;
object(in pixels).
@param y A number indicating the vertical position relative to
the registration point of the parent display object
(in pixels).
(in pixels).
@param width The width of the round rectangle (in pixels).
@param height The height of the round rectangle (in pixels).
@param ellipseWidth The width of the ellipse used to draw the rounded
Expand Down Expand Up @@ -1341,7 +1341,7 @@ import js.html.CanvasRenderingContext2D;
@param color A hexadecimal color value of the line; for example,
red is 0xFF0000, blue is 0x0000FF, and so on. If a
value is not indicated, the default is 0x000000
(black). Optional.
(black). Optional.
@param alpha A number that indicates the alpha value of the color
of the line; valid values are 0 to 1. If a value is
not indicated, the default is 1 (solid). If the value
Expand All @@ -1360,7 +1360,7 @@ import js.html.CanvasRenderingContext2D;
rectangles that are identical, except that the
`pixelHinting` parameter used in the
`lineStyle()` method is set differently
(the images are scaled by 200%, to emphasize the
(the images are scaled by 200%, to emphasize the
difference):

![pixelHinting false and pixelHinting true](/images/lineStyle_pixelHinting.jpg)
Expand All @@ -1373,7 +1373,7 @@ import js.html.CanvasRenderingContext2D;

* `LineScaleMode.NORMAL` - Always
scale the line thickness when the object is scaled
(the default).
(the default).
* `LineScaleMode.NONE` - Never scale
the line thickness.
* `LineScaleMode.VERTICAL` - Do not
Expand Down
19 changes: 9 additions & 10 deletions src/openfl/display/GraphicsStroke.hx
Original file line number Diff line number Diff line change
Expand Up @@ -99,24 +99,23 @@ import openfl.display._internal.GraphicsDataType;
/**
Specifies the stroke thickness scaling. Valid values are:

* `LineScaleMode.NORMAL` - Always scale the line thickness
* `LineScaleMode.NORMAL` - Always scale the line thickness
when the object is scaled (the default).
* `LineScaleMode.NONE` - Never scale the line thickness.
* `LineScaleMode.NONE` - Never scale the line thickness.

* `LineScaleMode.VERTICAL` - Do not scale the line
* `LineScaleMode.VERTICAL` - Do not scale the line
thickness if the object is scaled vertically _only_. For example,
consider the following circles, drawn with a one-pixel line, and each with
the `scaleMode` parameter set to
`LineScaleMode.VERTICAL`. The circle on the left is scaled
vertically only, and the circle on the right is scaled both vertically and
horizontally:
* `LineScaleMode.HORIZONTAL` - Do not scale the line
* `LineScaleMode.HORIZONTAL` - Do not scale the line
thickness if the object is scaled horizontally _only_. For example,
consider the following circles, drawn with a one-pixel line, and each with
the `scaleMode` parameter set to
`LineScaleMode.HORIZONTAL`. The circle on the left is scaled
horizontally only, and the circle on the right is scaled both vertically
and horizontally:
the `scaleMode` parameter set to `LineScaleMode.HORIZONTAL`. The circle
on the left is scaled horizontally only, and the circle on the right is
scaled both vertically and horizontally:

**/
public var scaleMode:LineScaleMode;
Expand Down Expand Up @@ -147,7 +146,7 @@ import openfl.display._internal.GraphicsDataType;
rounded rectangles that are identical, except that the
`pixelHinting` parameter used in the
`lineStyle()` method is set differently
(the images are scaled by 200%, to emphasize the
(the images are scaled by 200%, to emphasize the
difference):

If a value is not supplied, the line does not use
Expand All @@ -157,7 +156,7 @@ import openfl.display._internal.GraphicsDataType;

* `LineScaleMode.NORMAL` - Always
scale the line thickness when the object is scaled
(the default).
(the default).
* `LineScaleMode.NONE` - Never scale
the line thickness.
* `LineScaleMode.VERTICAL` - Do not
Expand Down
2 changes: 1 addition & 1 deletion src/openfl/display/MovieClip.hx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import openfl.events.MouseEvent;
stop the playhead in any child MovieClip objects of that MovieClip
object.

**Note:**Flash Lite 4 supports the MovieClip.opaqueBackground
**Note:** Flash Lite 4 supports the MovieClip.opaqueBackground
property only if FEATURE_BITMAPCACHE is defined. The default configuration
of Flash Lite 4 does not define FEATURE_BITMAPCACHE. To enable the
MovieClip.opaqueBackground property for a suitable device, define
Expand Down
17 changes: 9 additions & 8 deletions src/openfl/display/OpenGLRenderer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -991,17 +991,18 @@ class OpenGLRenderer extends DisplayObjectRenderer
{
if (clipRect != null)
{
var x = Math.floor(clipRect.x);
var y = Math.floor(clipRect.y);
var width = (clipRect.width > 0 ? Math.ceil(clipRect.right) - x : 0);
var height = (clipRect.height > 0 ? Math.ceil(clipRect.bottom) - y : 0);
var x = Math.ffloor(clipRect.x);
var y = Math.ffloor(clipRect.y);
var width = (clipRect.width > 0 ? Math.fceil(clipRect.right) - x : 0);
var height = (clipRect.height > 0 ? Math.fceil(clipRect.bottom) - y : 0);
#if !openfl_dpi_aware
if (__context3D.__backBufferWantsBestResolution)
{
x = Math.floor(clipRect.x / __pixelRatio);
y = Math.floor(clipRect.y / __pixelRatio);
width = (clipRect.width > 0 ? Math.ceil(clipRect.right / __pixelRatio) - x : 0);
height = (clipRect.height > 0 ? Math.ceil(clipRect.bottom / __pixelRatio) - y : 0);
var uv = 1.5 / __pixelRatio;
x = clipRect.x / __pixelRatio;
y = clipRect.y / __pixelRatio;
width = (clipRect.width > 0 ? (clipRect.right / __pixelRatio) - x + uv : 0);
height = (clipRect.height > 0 ? (clipRect.bottom / __pixelRatio) - y + uv : 0);
}
#end

Expand Down
6 changes: 5 additions & 1 deletion src/openfl/display/Stage.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2162,7 +2162,11 @@ class Stage extends DisplayObjectContainer #if lime implements IModule #end
Telemetry.__endTiming(TelemetryCommandName.RENDER);
Telemetry.__rewindStack(stack);
#end


#if HXCPP_TRACY
cpp.vm.tracy.TracyProfiler.frameMark();
#end

return cancelled;
}

Expand Down
8 changes: 7 additions & 1 deletion src/openfl/display/_internal/CairoGraphics.hx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class CairoGraphics

ratio = ratios[i] / 0xFF;
if (ratio < 0) ratio = 0;
if (ratio > 1) ratio = 1;
else if (ratio > 1) ratio = 1;

pattern.addColorStopRGBA(ratio, r, g, b, alpha);
}
Expand Down Expand Up @@ -533,11 +533,17 @@ class CairoGraphics
c.anchorY
- offsetY);

positionX = c.anchorX;
positionY = c.anchorY;

case CURVE_TO:
var c = data.readCurveTo();
hasPath = true;
quadraticCurveTo(c.controlX - offsetX, c.controlY - offsetY, c.anchorX - offsetX, c.anchorY - offsetY);

positionX = c.anchorX;
positionY = c.anchorY;

case DRAW_CIRCLE:
var c = data.readDrawCircle();
hasPath = true;
Expand Down
57 changes: 41 additions & 16 deletions src/openfl/display/_internal/CanvasGraphics.hx
Original file line number Diff line number Diff line change
Expand Up @@ -137,34 +137,53 @@ class CanvasGraphics
{
ratio = ratios[i] / 0xFF;
if (ratio < 0) ratio = 0;
if (ratio > 1) ratio = 1;
else if (ratio > 1) ratio = 1;

gradientFill.addColorStop(ratio, getRGBA(colors[i], alphas[i]));
}

case LINEAR:
var gradientScale:Float = spreadMethod == PAD ? 1.0 : 25.0;
var dx = 0.5 * (gradientScale - 1.0) * 1638.4;
var canvas:CanvasElement = cast Browser.document.createElement("canvas");
var context2 = canvas.getContext("2d");
if (point != null) Point.__pool.release(point);
if (point2 != null) Point.__pool.release(point2);
if (releaseMatrix) Matrix.__pool.release(matrix);

var dimensions:Dynamic = getDimensions(matrix);
return cast(gradientFill);

canvas.width = context.canvas.width;
canvas.height = context.canvas.height;
gradientFill = context.createLinearGradient(-819.2 - dx, 0, 819.2 + dx, 0);
case LINEAR:
if (spreadMethod == PAD)
{
gradientFill = context.createLinearGradient(-819.2, 0, 819.2, 0);

pendingMatrix = matrix.clone();
inversePendingMatrix = matrix.clone();
inversePendingMatrix.invert();

for (i in 0...colors.length)
{
ratio = ratios[i] / 0xFF;
if (ratio < 0) ratio = 0;
if (ratio > 1) ratio = 1;
else if (ratio > 1) ratio = 1;

gradientFill.addColorStop(ratio, getRGBA(colors[i], alphas[i]));
}

if (point != null) Point.__pool.release(point);
if (point2 != null) Point.__pool.release(point2);
if (releaseMatrix) Matrix.__pool.release(matrix);

return cast(gradientFill);
}
else if (spreadMethod == REFLECT)

var gradientScale:Float = spreadMethod == PAD ? 1.0 : 25.0;
var dx = 0.5 * (gradientScale - 1.0) * 1638.4;
var canvas:CanvasElement = cast Browser.document.createElement("canvas");
var context2 = canvas.getContext("2d");

var dimensions:Dynamic = getDimensions(matrix);

canvas.width = context.canvas.width;
canvas.height = context.canvas.height;
gradientFill = context.createLinearGradient(-819.2 - dx, 0, 819.2 + dx, 0);
if (spreadMethod == REFLECT)
{
var t:Float = 0;
var step:Float = 1 / 25;
Expand All @@ -176,7 +195,7 @@ class CanvasGraphics
ratio = ratios[i] / 0xFF;
ratio = t + ratio * step;
if (ratio < 0) ratio = 0;
if (ratio > 1) ratio = 1;
else if (ratio > 1) ratio = 1;

gradientFill.addColorStop(ratio, getRGBA(colors[i], alphas[i]));
}
Expand All @@ -187,7 +206,7 @@ class CanvasGraphics
ratio = ratios[a] / 0xFF;
ratio = t + (1.0 - ratio) * step;
if (ratio < 0) ratio = 0;
if (ratio > 1) ratio = 1;
else if (ratio > 1) ratio = 1;
gradientFill.addColorStop(ratio, getRGBA(colors[a], alphas[a]));
a--;
}
Expand All @@ -206,14 +225,14 @@ class CanvasGraphics
ratio = ratios[i] / 0xFF;
ratio = t + ratio * step;
if (ratio < 0) ratio = 0;
if (ratio > 1) ratio = 1 - 0.001;
else if (ratio > 1) ratio = 1 - 0.001;

gradientFill.addColorStop(ratio, getRGBA(colors[i], alphas[i]));
}

ratio = t + 0.001;
if (ratio < 0) ratio = 0;
if (ratio > 1) ratio = 1;
else if (ratio > 1) ratio = 1;
gradientFill.addColorStop(ratio - 0.001, getRGBA(colors[colors.length - 1], alphas[alphas.length - 1]));
gradientFill.addColorStop(ratio, getRGBA(colors[0], alphas[0]));

Expand Down Expand Up @@ -686,11 +705,17 @@ class CanvasGraphics
c.anchorY
- offsetY);

positionX = c.anchorX;
positionY = c.anchorY;

case CURVE_TO:
var c = data.readCurveTo();
hasPath = true;
context.quadraticCurveTo(c.controlX - offsetX, c.controlY - offsetY, c.anchorX - offsetX, c.anchorY - offsetY);

positionX = c.anchorX;
positionY = c.anchorY;

case DRAW_CIRCLE:
var c = data.readDrawCircle();
hasPath = true;
Expand Down
4 changes: 1 addition & 3 deletions src/openfl/media/Sound.hx
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,7 @@ class Sound extends EventDispatcher
these security limitations.

For more information related to security, see the Flash Player
Developer Center Topic: <a
href="http://www.adobe.com/go/devnet_security_en"
scope="external">Security</a>.
Developer Center Topic: [Security](http://www.adobe.com/go/devnet_security_en).
**/
public var id3(get, never):ID3Info;

Expand Down
Loading
Loading