-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Launch ImageSmoothingQuality for Paint Canvas
ImageSmoothingQuality have launched for Canvas 2D and OffscreenCanvas, and it's under a flag in Paint Canvas. The flag is set to "true" by default for a long time in Paint Canvas and ImageSmoothingQuality is marked as launched. It should be launched as Paint Canvas as well. Approval reference: https://groups.google.com/a/chromium.org/g/blink-dev/c/jDvKH3Ib3ZI/m/kIrLzGioCgAJ Bug: 383575391 Change-Id: I2bb8b4a180cdc933fd5a1a10537ef95d0e25048a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6078244 Commit-Queue: Yi Xu <yiyix@chromium.org> Reviewed-by: Domenic Denicola <domenic@chromium.org> Reviewed-by: Jean-Philippe Gravel <jpgravel@chromium.org> Cr-Commit-Position: refs/heads/main@{#1405846}
- Loading branch information
1 parent
6444e51
commit f465e9f
Showing
6 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
css/css-paint-api/paint2d-imageSmoothingQuality.high-ref.html
This file contains 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,14 @@ | ||
<!DOCTYPE html> | ||
<canvas id="canvas" width="300" height="300"></canvas> | ||
<script> | ||
const canvas = document.getElementById('canvas'); | ||
const ctx = canvas.getContext('2d'); | ||
ctx.imageSmoothingQuality = 'high'; | ||
ctx.fillStyle = 'green'; | ||
ctx.fillRect(0, 0, 300, 300); | ||
const image = new Image(); | ||
image.src = './resources/html5.png'; | ||
image.onload = () => { | ||
ctx.drawImage(image, 0, 0, 200, 200); | ||
}; | ||
</script> |
33 changes: 33 additions & 0 deletions
33
css/css-paint-api/paint2d-imageSmoothingQuality.high.https.html
This file contains 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,33 @@ | ||
<!DOCTYPE html> | ||
<html class="reftest-wait"> | ||
<link rel="help" href="https://drafts.css-houdini.org/css-paint-api/"> | ||
<link rel="match" href="paint2d-imageSmoothingQuality.high-ref.html"> | ||
<style> | ||
#output { | ||
width: 300px; | ||
height: 300px; | ||
background-image: paint(image); | ||
border-image: url(./resources/html5.png); | ||
} | ||
</style> | ||
<script src="/common/reftest-wait.js"></script> | ||
<script src="/common/worklet-reftest.js"></script> | ||
<div id="output"></div> | ||
|
||
<script id="code" type="text/worklet"> | ||
registerPaint('image', class { | ||
static get inputProperties() { return [ 'border-image-source' ]; }; | ||
paint(ctx, geom, styleMap) { | ||
ctx.imageSmoothingQuality = 'high'; | ||
ctx.fillStyle = 'green'; | ||
ctx.fillRect(0, 0, geom.width, geom.height); | ||
ctx.drawImage(styleMap.get('border-image-source'), 0, 0, 200, 200); | ||
} | ||
}); | ||
</script> | ||
|
||
<script> | ||
importWorkletAndTerminateTestAfterAsyncPaint( | ||
CSS.paintWorklet, document.getElementById('code').textContent); | ||
</script> | ||
</html> |
14 changes: 14 additions & 0 deletions
14
css/css-paint-api/paint2d-imageSmoothingQuality.low-ref.html
This file contains 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,14 @@ | ||
<!DOCTYPE html> | ||
<canvas id="canvas" width="300" height="300"></canvas> | ||
<script> | ||
const canvas = document.getElementById('canvas'); | ||
const ctx = canvas.getContext('2d'); | ||
ctx.imageSmoothingQuality = 'low'; | ||
ctx.fillStyle = 'green'; | ||
ctx.fillRect(0, 0, 300, 300); | ||
const image = new Image(); | ||
image.src = './resources/html5.png'; | ||
image.onload = () => { | ||
ctx.drawImage(image, 0, 0, 200, 200); | ||
}; | ||
</script> |
33 changes: 33 additions & 0 deletions
33
css/css-paint-api/paint2d-imageSmoothingQuality.low.https.html
This file contains 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,33 @@ | ||
<!DOCTYPE html> | ||
<html class="reftest-wait"> | ||
<link rel="help" href="https://drafts.css-houdini.org/css-paint-api/"> | ||
<link rel="match" href="paint2d-imageSmoothingQuality.low-ref.html"> | ||
<style> | ||
#output { | ||
width: 300px; | ||
height: 300px; | ||
background-image: paint(image); | ||
border-image: url(./resources/html5.png); | ||
} | ||
</style> | ||
<script src="/common/reftest-wait.js"></script> | ||
<script src="/common/worklet-reftest.js"></script> | ||
<div id="output"></div> | ||
|
||
<script id="code" type="text/worklet"> | ||
registerPaint('image', class { | ||
static get inputProperties() { return [ 'border-image-source' ]; }; | ||
paint(ctx, geom, styleMap) { | ||
ctx.imageSmoothingQuality = 'low'; | ||
ctx.fillStyle = 'green'; | ||
ctx.fillRect(0, 0, geom.width, geom.height); | ||
ctx.drawImage(styleMap.get('border-image-source'), 0, 0, 200, 200); | ||
} | ||
}); | ||
</script> | ||
|
||
<script> | ||
importWorkletAndTerminateTestAfterAsyncPaint( | ||
CSS.paintWorklet, document.getElementById('code').textContent); | ||
</script> | ||
</html> |
14 changes: 14 additions & 0 deletions
14
css/css-paint-api/paint2d-imageSmoothingQuality.med-ref.html
This file contains 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,14 @@ | ||
<!DOCTYPE html> | ||
<canvas id="canvas" width="300" height="300"></canvas> | ||
<script> | ||
const canvas = document.getElementById('canvas'); | ||
const ctx = canvas.getContext('2d'); | ||
ctx.imageSmoothingQuality = 'medium'; | ||
ctx.fillStyle = 'green'; | ||
ctx.fillRect(0, 0, 300, 300); | ||
const image = new Image(); | ||
image.src = './resources/html5.png'; | ||
image.onload = () => { | ||
ctx.drawImage(image, 0, 0, 200, 200); | ||
}; | ||
</script> |
33 changes: 33 additions & 0 deletions
33
css/css-paint-api/paint2d-imageSmoothingQuality.med.https.html
This file contains 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,33 @@ | ||
<!DOCTYPE html> | ||
<html class="reftest-wait"> | ||
<link rel="help" href="https://drafts.css-houdini.org/css-paint-api/"> | ||
<link rel="match" href="paint2d-imageSmoothingQuality.med-ref.html"> | ||
<style> | ||
#output { | ||
width: 300px; | ||
height: 300px; | ||
background-image: paint(image); | ||
border-image: url(./resources/html5.png); | ||
} | ||
</style> | ||
<script src="/common/reftest-wait.js"></script> | ||
<script src="/common/worklet-reftest.js"></script> | ||
<div id="output"></div> | ||
|
||
<script id="code" type="text/worklet"> | ||
registerPaint('image', class { | ||
static get inputProperties() { return [ 'border-image-source' ]; }; | ||
paint(ctx, geom, styleMap) { | ||
ctx.imageSmoothingQuality = 'medium'; | ||
ctx.fillStyle = 'green'; | ||
ctx.fillRect(0, 0, geom.width, geom.height); | ||
ctx.drawImage(styleMap.get('border-image-source'), 0, 0, 200, 200); | ||
} | ||
}); | ||
</script> | ||
|
||
<script> | ||
importWorkletAndTerminateTestAfterAsyncPaint( | ||
CSS.paintWorklet, document.getElementById('code').textContent); | ||
</script> | ||
</html> |