-
-
Notifications
You must be signed in to change notification settings - Fork 26
Crate: switch to premultiplied alpha rendering pipeline #623
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
Merged
Merged
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
b546156
Crate: use more tiny-skia
kane50613 c50d5ef
remove debugs
kane50613 0e46cef
qualified path
kane50613 ef6818a
move `extractResourceUrls` to helpers package
kane50613 87672a8
fix clippy
kane50613 b1a7fc1
update fixtures
kane50613 98469fe
custom color burn blend path
kane50613 c80a171
separated all mix blending modes
kane50613 b174f4a
fix color burn
kane50613 040da85
fix color burn
kane50613 d8cdefb
fix color burn
kane50613 cb42383
try float path
kane50613 235957f
make blend fixture use gradients instead
kane50613 c18a78d
do not use opaque color for fixture
kane50613 940829d
integer math
kane50613 5341fd0
use solid colors
kane50613 aa302db
fix missing demultiplied
kane50613 23a2bad
fix panic
kane50613 ec90d0d
nitpick
kane50613 8e03566
add resourcesOptions
kane50613 9f0cd17
update examples
kane50613 a170cfd
fix
kane50613 c2d3ec5
fix tests
kane50613 990e496
re-export `extractResourceUrls`
kane50613 989c9ee
changeset
kane50613 27edbf7
nitpick
kane50613 a5e383d
fix bounds check
kane50613 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@takumi-rs/helpers": minor | ||
| --- | ||
|
|
||
| Add `extractResourceUrls` in pure JS to avoid extra roundtrip to native bindings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| "@takumi-rs/core": patch | ||
| "@takumi-rs/wasm": patch | ||
| --- | ||
|
|
||
| Replaced native `extractResourceUrls` with JS version to avoid roundtrip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "takumi": minor | ||
| --- | ||
|
|
||
| Rework on internal rendering pipeline to be performant |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import { describe, expect, test } from "bun:test"; | ||
| import { container, image } from "../../src/helpers"; | ||
| import { extractResourceUrls } from "../../src/utils"; | ||
|
|
||
| describe("extractResourceUrls", () => { | ||
| test("extracts remote image and style urls without duplicates", () => { | ||
| const remoteImageUrl = "https://example.com/image.png"; | ||
| const backgroundUrl = "https://example.com/background.png"; | ||
| const maskUrl = "https://example.com/mask.png"; | ||
| const node = container({ | ||
| children: [ | ||
| image({ | ||
| src: remoteImageUrl, | ||
| width: 100, | ||
| height: 100, | ||
| }), | ||
| image({ | ||
| src: "data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' />", | ||
| width: 100, | ||
| height: 100, | ||
| }), | ||
| container({ | ||
| style: { | ||
| backgroundImage: `linear-gradient(#fff, #000), url("${backgroundUrl}")`, | ||
| maskImage: `url(${maskUrl}) url(${backgroundUrl})`, | ||
| }, | ||
| }), | ||
| ], | ||
| }); | ||
|
|
||
| expect(extractResourceUrls(node)).toEqual([remoteImageUrl, backgroundUrl, maskUrl]); | ||
| }); | ||
|
|
||
| test("ignores malformed css url values", () => { | ||
| const node = container({ | ||
| style: { | ||
| backgroundImage: "url(https://example.com/good.png) url(", | ||
| }, | ||
| }); | ||
|
|
||
| expect(extractResourceUrls(node)).toEqual(["https://example.com/good.png"]); | ||
| }); | ||
|
|
||
| test("ignores non-fetchable css url values", () => { | ||
| const validUrl = "https://example.com/background.png"; | ||
| const node = container({ | ||
| style: { | ||
| backgroundImage: `url(background), url("${validUrl}")`, | ||
| }, | ||
| }); | ||
|
|
||
| expect(extractResourceUrls(node)).toEqual([validUrl]); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,3 +117,7 @@ harness = false | |
| [[bench]] | ||
| name = "gradient" | ||
| harness = false | ||
|
|
||
| [[bench]] | ||
| name = "fixtures" | ||
| harness = false | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.