Skip to content

Commit

Permalink
Launch ImageSmoothingQuality for Paint Canvas
Browse files Browse the repository at this point in the history
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
yiyix authored and chromium-wpt-export-bot committed Jan 14, 2025
1 parent 6444e51 commit f465e9f
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 0 deletions.
14 changes: 14 additions & 0 deletions css/css-paint-api/paint2d-imageSmoothingQuality.high-ref.html
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 css/css-paint-api/paint2d-imageSmoothingQuality.high.https.html
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 css/css-paint-api/paint2d-imageSmoothingQuality.low-ref.html
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 css/css-paint-api/paint2d-imageSmoothingQuality.low.https.html
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 css/css-paint-api/paint2d-imageSmoothingQuality.med-ref.html
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 css/css-paint-api/paint2d-imageSmoothingQuality.med.https.html
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>

0 comments on commit f465e9f

Please sign in to comment.