aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2017-02-07 17:01:16 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-07 22:40:13 +0000
commit5c49617f3dc24fcb10451ec8dcdf70aa058f06d6 (patch)
tree829dd82c7143c982589354ec2786d2c97dc2c85a
parent8543f4f64e1e2bd1eb340ac44ed5f71f2616fb7d (diff)
Reland "Respect canvas size and frame offset in webp decoder"
Original Change Reviewed At: https://skia-review.googlesource.com/c/7800 CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-MSAN BUG=skia:6185 Change-Id: I1a7732832d37920545c1775d7c7c65b43ed810f9 Reviewed-on: https://skia-review.googlesource.com/8157 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
-rw-r--r--infra/bots/assets/skimage/VERSION2
-rw-r--r--infra/bots/tasks.json384
-rw-r--r--resources/invalid_images/invalid-offset.webpbin0 -> 374 bytes
-rw-r--r--src/codec/SkWebpCodec.cpp201
-rw-r--r--tests/CodecTest.cpp2
5 files changed, 310 insertions, 279 deletions
diff --git a/infra/bots/assets/skimage/VERSION b/infra/bots/assets/skimage/VERSION
index dec2bf5d61..2edeafb09d 100644
--- a/infra/bots/assets/skimage/VERSION
+++ b/infra/bots/assets/skimage/VERSION
@@ -1 +1 @@
-19 \ No newline at end of file
+20 \ No newline at end of file
diff --git a/infra/bots/tasks.json b/infra/bots/tasks.json
index ba5abbe44d..09e6d5ae48 100644
--- a/infra/bots/tasks.json
+++ b/infra/bots/tasks.json
@@ -3682,7 +3682,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -3731,7 +3731,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -3780,7 +3780,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -3829,7 +3829,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -3878,7 +3878,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -3927,7 +3927,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -3976,7 +3976,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -4025,7 +4025,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -4074,7 +4074,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -4123,7 +4123,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -4172,7 +4172,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -4221,7 +4221,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -4270,7 +4270,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -4319,7 +4319,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -4368,7 +4368,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -4417,7 +4417,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -4466,7 +4466,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -4515,7 +4515,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -4564,7 +4564,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -4613,7 +4613,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -4662,7 +4662,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -4711,7 +4711,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -4760,7 +4760,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -4809,7 +4809,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -4858,7 +4858,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -4907,7 +4907,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -4956,7 +4956,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -5005,7 +5005,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -5054,7 +5054,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -5103,7 +5103,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -5152,7 +5152,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -5279,7 +5279,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -5327,7 +5327,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -5375,7 +5375,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -5424,7 +5424,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -5473,7 +5473,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -5521,7 +5521,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -5569,7 +5569,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -5617,7 +5617,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -5666,7 +5666,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -5720,7 +5720,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -5774,7 +5774,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -5823,7 +5823,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -5877,7 +5877,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -5926,7 +5926,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -5979,7 +5979,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -6032,7 +6032,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -6081,7 +6081,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -6130,7 +6130,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -6179,7 +6179,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -6278,7 +6278,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -6326,7 +6326,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -6374,7 +6374,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -6422,7 +6422,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -6470,7 +6470,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -6528,7 +6528,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -6576,7 +6576,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -6634,7 +6634,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -6682,7 +6682,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -6730,7 +6730,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -6778,7 +6778,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -6826,7 +6826,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -6874,7 +6874,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -6922,7 +6922,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -6970,7 +6970,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7018,7 +7018,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7066,7 +7066,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7114,7 +7114,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7162,7 +7162,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7210,7 +7210,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7258,7 +7258,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7306,7 +7306,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7354,7 +7354,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7402,7 +7402,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7450,7 +7450,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7498,7 +7498,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7546,7 +7546,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7594,7 +7594,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7642,7 +7642,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7690,7 +7690,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7738,7 +7738,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7786,7 +7786,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7834,7 +7834,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7882,7 +7882,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7930,7 +7930,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -7978,7 +7978,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -8026,7 +8026,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -8075,7 +8075,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -8124,7 +8124,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -8173,7 +8173,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -8222,7 +8222,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -8270,7 +8270,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -8318,7 +8318,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -8367,7 +8367,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -8416,7 +8416,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -8465,7 +8465,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -8514,7 +8514,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -8563,7 +8563,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -8612,7 +8612,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -8661,7 +8661,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -8710,7 +8710,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -8759,7 +8759,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -8808,7 +8808,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -8857,7 +8857,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -8906,7 +8906,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -8955,7 +8955,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9004,7 +9004,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9053,7 +9053,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9102,7 +9102,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9151,7 +9151,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9200,7 +9200,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9249,7 +9249,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9298,7 +9298,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9347,7 +9347,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9396,7 +9396,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9445,7 +9445,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9494,7 +9494,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9543,7 +9543,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9592,7 +9592,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9641,7 +9641,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9690,7 +9690,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9739,7 +9739,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9788,7 +9788,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9837,7 +9837,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9886,7 +9886,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9935,7 +9935,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -9984,7 +9984,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -10033,7 +10033,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -10081,7 +10081,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -10129,7 +10129,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -10178,7 +10178,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -10227,7 +10227,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -10275,7 +10275,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -10323,7 +10323,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -10371,7 +10371,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -10420,7 +10420,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -10474,7 +10474,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -10528,7 +10528,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -10577,7 +10577,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -10631,7 +10631,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -10680,7 +10680,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -10734,7 +10734,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -10787,7 +10787,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -10840,7 +10840,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -10893,7 +10893,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -10942,7 +10942,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -11066,7 +11066,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -11115,7 +11115,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -11164,7 +11164,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -11213,7 +11213,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -11261,7 +11261,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -11309,7 +11309,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -11357,7 +11357,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -11405,7 +11405,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -11463,7 +11463,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -11511,7 +11511,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -11569,7 +11569,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -11617,7 +11617,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -11665,7 +11665,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -11713,7 +11713,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -11761,7 +11761,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -11809,7 +11809,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -11857,7 +11857,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -11905,7 +11905,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -11953,7 +11953,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12001,7 +12001,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12049,7 +12049,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12097,7 +12097,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12145,7 +12145,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12193,7 +12193,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12241,7 +12241,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12289,7 +12289,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12337,7 +12337,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12385,7 +12385,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12433,7 +12433,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12481,7 +12481,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12529,7 +12529,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12577,7 +12577,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12625,7 +12625,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12673,7 +12673,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12721,7 +12721,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12769,7 +12769,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12817,7 +12817,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12865,7 +12865,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12913,7 +12913,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -12962,7 +12962,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -13011,7 +13011,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -13060,7 +13060,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -13109,7 +13109,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -13158,7 +13158,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -13207,7 +13207,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
@@ -13255,7 +13255,7 @@
{
"name": "skia/bots/skimage",
"path": "skimage",
- "version": "version:19"
+ "version": "version:20"
},
{
"name": "skia/bots/skp",
diff --git a/resources/invalid_images/invalid-offset.webp b/resources/invalid_images/invalid-offset.webp
new file mode 100644
index 0000000000..4a278d3467
--- /dev/null
+++ b/resources/invalid_images/invalid-offset.webp
Binary files differ
diff --git a/src/codec/SkWebpCodec.cpp b/src/codec/SkWebpCodec.cpp
index bd69f658e6..c602fcd784 100644
--- a/src/codec/SkWebpCodec.cpp
+++ b/src/codec/SkWebpCodec.cpp
@@ -7,9 +7,10 @@
#include "SkCodecPriv.h"
#include "SkColorSpaceXform.h"
-#include "SkWebpCodec.h"
+#include "SkSampler.h"
#include "SkStreamPriv.h"
#include "SkTemplates.h"
+#include "SkWebpCodec.h"
// A WebP decoder on top of (subset of) libwebp
// For more information on WebP image format, and libwebp library, see:
@@ -59,6 +60,21 @@ SkCodec* SkWebpCodec::NewFromStream(SkStream* stream) {
return nullptr;
}
+ const int width = WebPDemuxGetI(demux, WEBP_FF_CANVAS_WIDTH);
+ const int height = WebPDemuxGetI(demux, WEBP_FF_CANVAS_HEIGHT);
+
+ // Sanity check for image size that's about to be decoded.
+ {
+ const int64_t size = sk_64_mul(width, height);
+ if (!sk_64_isS32(size)) {
+ return nullptr;
+ }
+ // now check that if we are 4-bytes per pixel, we also don't overflow
+ if (sk_64_asS32(size) > (0x7FFFFFFF >> 2)) {
+ return nullptr;
+ }
+ }
+
WebPChunkIterator chunkIterator;
SkAutoTCallVProc<WebPChunkIterator, WebPDemuxReleaseChunkIterator> autoCI(&chunkIterator);
sk_sp<SkColorSpace> colorSpace = nullptr;
@@ -73,36 +89,15 @@ SkCodec* SkWebpCodec::NewFromStream(SkStream* stream) {
colorSpace = SkColorSpace::MakeSRGB();
}
- // Since we do not yet support animation, we get the |width|, |height|, |color|, and |alpha|
- // from the first frame. It's the only frame we will decode.
- //
- // TODO:
- // When we support animation, we'll want to report the canvas width and canvas height instead.
- // We can get these from the |demux| directly.
- // What |color| and |alpha| will we want to report though? WebP allows different frames
- // to be encoded in different ways, making the encoded format difficult to describe.
+ // Get the first frame and its "features" to determine the color and alpha types.
+ // Since we do not yet support animated webp, this is the only frame that we will
+ // decode.
WebPIterator frame;
SkAutoTCallVProc<WebPIterator, WebPDemuxReleaseIterator> autoFrame(&frame);
if (!WebPDemuxGetFrame(demux, 1, &frame)) {
return nullptr;
}
- // Sanity check for image size that's about to be decoded.
- {
- const int64_t size = sk_64_mul(frame.width, frame.height);
- if (!sk_64_isS32(size)) {
- return nullptr;
- }
- // now check that if we are 4-bytes per pixel, we also don't overflow
- if (sk_64_asS32(size) > (0x7FFFFFFF >> 2)) {
- return nullptr;
- }
- }
-
- // TODO:
- // The only reason we actually need to call WebPGetFeatures() is to get the |features.format|.
- // This call actually re-reads the frame header. Should we suggest that libwebp expose
- // the format on the |frame|?
WebPBitstreamFeatures features;
VP8StatusCode status = WebPGetFeatures(frame.fragment.bytes, frame.fragment.size, &features);
if (VP8_STATUS_OK != status) {
@@ -113,8 +108,8 @@ SkCodec* SkWebpCodec::NewFromStream(SkStream* stream) {
SkEncodedInfo::Alpha alpha;
switch (features.format) {
case 0:
- // This indicates a "mixed" format. We would see this for
- // animated webps or for webps encoded in multiple fragments.
+ // This indicates a "mixed" format. We could see this for
+ // animated webps (multiple fragments).
// I believe that this is a rare case.
// We could also guess kYUV here, but I think it makes more
// sense to guess kBGRA which is likely closer to the final
@@ -125,7 +120,7 @@ SkCodec* SkWebpCodec::NewFromStream(SkStream* stream) {
break;
case 1:
// This is the lossy format (YUV).
- if (SkToBool(features.has_alpha)) {
+ if (SkToBool(features.has_alpha) || frame.width != width || frame.height != height) {
color = SkEncodedInfo::kYUVA_Color;
alpha = SkEncodedInfo::kUnpremul_Alpha;
} else {
@@ -143,9 +138,9 @@ SkCodec* SkWebpCodec::NewFromStream(SkStream* stream) {
}
SkEncodedInfo info = SkEncodedInfo::Make(color, alpha, 8);
- SkWebpCodec* codecOut = new SkWebpCodec(features.width, features.height, info,
- std::move(colorSpace), streamDeleter.release(),
- demux.release(), std::move(data));
+ SkWebpCodec* codecOut = new SkWebpCodec(width, height, info, std::move(colorSpace),
+ streamDeleter.release(), demux.release(),
+ std::move(data));
codecOut->setUnsupportedICC(unsupportedICC);
return codecOut;
}
@@ -217,48 +212,85 @@ SkCodec::Result SkWebpCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst,
// Free any memory associated with the buffer. Must be called last, so we declare it first.
SkAutoTCallVProc<WebPDecBuffer, WebPFreeDecBuffer> autoFree(&(config.output));
- SkIRect bounds = SkIRect::MakeSize(this->getInfo().dimensions());
+ WebPIterator frame;
+ SkAutoTCallVProc<WebPIterator, WebPDemuxReleaseIterator> autoFrame(&frame);
+ // If this succeeded in NewFromStream(), it should succeed again here.
+ SkAssertResult(WebPDemuxGetFrame(fDemux, 1, &frame));
+
+ // Get the frameRect. libwebp will have already signaled an error if this is not fully
+ // contained by the canvas.
+ auto frameRect = SkIRect::MakeXYWH(frame.x_offset, frame.y_offset, frame.width, frame.height);
+ SkASSERT(this->getInfo().bounds().contains(frameRect));
+ bool frameIsSubset = frameRect.size() != this->getInfo().dimensions();
+ if (frameIsSubset) {
+ SkSampler::Fill(dstInfo, dst, rowBytes, 0, options.fZeroInitialized);
+ }
+
+ int dstX = frameRect.x();
+ int dstY = frameRect.y();
+ int subsetWidth = frameRect.width();
+ int subsetHeight = frameRect.height();
if (options.fSubset) {
- // Caller is requesting a subset.
- if (!bounds.contains(*options.fSubset)) {
- // The subset is out of bounds.
- return kInvalidParameters;
+ SkIRect subset = *options.fSubset;
+ SkASSERT(this->getInfo().bounds().contains(subset));
+ SkASSERT(SkIsAlign2(subset.fLeft) && SkIsAlign2(subset.fTop));
+ SkASSERT(this->getValidSubset(&subset) && subset == *options.fSubset);
+
+ if (!SkIRect::IntersectsNoEmptyCheck(subset, frameRect)) {
+ return kSuccess;
}
- bounds = *options.fSubset;
+ int minXOffset = SkTMin(dstX, subset.x());
+ int minYOffset = SkTMin(dstY, subset.y());
+ dstX -= minXOffset;
+ dstY -= minYOffset;
+ frameRect.offset(-minXOffset, -minYOffset);
+ subset.offset(-minXOffset, -minYOffset);
- // This is tricky. libwebp snaps the top and left to even values. We could let libwebp
- // do the snap, and return a subset which is a different one than requested. The problem
- // with that approach is that the caller may try to stitch subsets together, and if we
- // returned different subsets than requested, there would be artifacts at the boundaries.
- // Instead, we report that we cannot support odd values for top and left..
- if (!SkIsAlign2(bounds.fLeft) || !SkIsAlign2(bounds.fTop)) {
- return kInvalidParameters;
- }
+ // Just like we require that the requested subset x and y offset are even, libwebp
+ // guarantees that the frame x and y offset are even (it's actually impossible to specify
+ // an odd frame offset). So we can still guarantee that the adjusted offsets are even.
+ SkASSERT(SkIsAlign2(subset.fLeft) && SkIsAlign2(subset.fTop));
-#ifdef SK_DEBUG
- {
- // Make a copy, since getValidSubset can change its input.
- SkIRect subset(bounds);
- // That said, getValidSubset should *not* change its input, in this case; otherwise
- // getValidSubset does not match the actual subsets we can do.
- SkASSERT(this->getValidSubset(&subset) && subset == bounds);
- }
-#endif
+ SkIRect intersection;
+ SkAssertResult(intersection.intersect(frameRect, subset));
+ subsetWidth = intersection.width();
+ subsetHeight = intersection.height();
config.options.use_cropping = 1;
- config.options.crop_left = bounds.fLeft;
- config.options.crop_top = bounds.fTop;
- config.options.crop_width = bounds.width();
- config.options.crop_height = bounds.height();
+ config.options.crop_left = subset.x();
+ config.options.crop_top = subset.y();
+ config.options.crop_width = subsetWidth;
+ config.options.crop_height = subsetHeight;
}
- SkISize dstDimensions = dstInfo.dimensions();
- if (bounds.size() != dstDimensions) {
- // Caller is requesting scaling.
+ // Ignore the frame size and offset when determining if scaling is necessary.
+ int scaledWidth = subsetWidth;
+ int scaledHeight = subsetHeight;
+ SkISize srcSize = options.fSubset ? options.fSubset->size() : this->getInfo().dimensions();
+ if (srcSize != dstInfo.dimensions()) {
config.options.use_scaling = 1;
- config.options.scaled_width = dstDimensions.width();
- config.options.scaled_height = dstDimensions.height();
+
+ if (frameIsSubset) {
+ float scaleX = ((float) dstInfo.width()) / srcSize.width();
+ float scaleY = ((float) dstInfo.height()) / srcSize.height();
+
+ // We need to be conservative here and floor rather than round.
+ // Otherwise, we may find ourselves decoding off the end of memory.
+ dstX = scaleX * dstX;
+ scaledWidth = scaleX * scaledWidth;
+ dstY = scaleY * dstY;
+ scaledHeight = scaleY * scaledHeight;
+ if (0 == scaledWidth || 0 == scaledHeight) {
+ return kSuccess;
+ }
+ } else {
+ scaledWidth = dstInfo.width();
+ scaledHeight = dstInfo.height();
+ }
+
+ config.options.scaled_width = scaledWidth;
+ config.options.scaled_height = scaledHeight;
}
// Swizzling between RGBA and BGRA is zero cost in a color transform. So when we have a
@@ -274,21 +306,17 @@ SkCodec::Result SkWebpCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst,
// does not provide a row-by-row API. This is a shame particularly in the F16 case,
// where we need to allocate an extra image-sized buffer.
SkAutoTMalloc<uint32_t> pixels;
- if (kRGBA_F16_SkColorType == dstInfo.colorType()) {
- pixels.reset(dstDimensions.width() * dstDimensions.height());
- config.output.u.RGBA.rgba = (uint8_t*) pixels.get();
- config.output.u.RGBA.stride = (int) dstDimensions.width() * sizeof(uint32_t);
- config.output.u.RGBA.size = config.output.u.RGBA.stride * dstDimensions.height();
- } else {
- config.output.u.RGBA.rgba = (uint8_t*) dst;
- config.output.u.RGBA.stride = (int) rowBytes;
- config.output.u.RGBA.size = dstInfo.getSafeSize(rowBytes);
- }
-
- WebPIterator frame;
- SkAutoTCallVProc<WebPIterator, WebPDemuxReleaseIterator> autoFrame(&frame);
- // If this succeeded in NewFromStream(), it should succeed again here.
- SkAssertResult(WebPDemuxGetFrame(fDemux, 1, &frame));
+ bool isF16 = kRGBA_F16_SkColorType == dstInfo.colorType();
+ void* webpDst = isF16 ? pixels.reset(dstInfo.width() * dstInfo.height()) : dst;
+ size_t webpRowBytes = isF16 ? dstInfo.width() * sizeof(uint32_t) : rowBytes;
+ size_t totalBytes = isF16 ? webpRowBytes * dstInfo.height() : dstInfo.getSafeSize(webpRowBytes);
+ size_t dstBpp = SkColorTypeBytesPerPixel(dstInfo.colorType());
+ size_t webpBpp = isF16 ? sizeof(uint32_t) : dstBpp;
+
+ size_t offset = dstX * webpBpp + dstY * webpRowBytes;
+ config.output.u.RGBA.rgba = SkTAddOffset<uint8_t>(webpDst, offset);
+ config.output.u.RGBA.stride = (int) webpRowBytes;
+ config.output.u.RGBA.size = totalBytes - offset;
SkAutoTCallVProc<WebPIDecoder, WebPIDelete> idec(WebPIDecode(nullptr, 0, &config));
if (!idec) {
@@ -299,12 +327,12 @@ SkCodec::Result SkWebpCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst,
SkCodec::Result result;
switch (WebPIUpdate(idec, frame.fragment.bytes, frame.fragment.size)) {
case VP8_STATUS_OK:
- rowsDecoded = dstInfo.height();
+ rowsDecoded = scaledHeight;
result = kSuccess;
break;
case VP8_STATUS_SUSPENDED:
- WebPIDecGetRGB(idec, rowsDecodedPtr, nullptr, nullptr, nullptr);
- rowsDecoded = *rowsDecodedPtr;
+ WebPIDecGetRGB(idec, &rowsDecoded, nullptr, nullptr, nullptr);
+ *rowsDecodedPtr = rowsDecoded + dstY;
result = kIncompleteInput;
break;
default:
@@ -316,14 +344,15 @@ SkCodec::Result SkWebpCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst,
SkAlphaType xformAlphaType = select_xform_alpha(dstInfo.alphaType(),
this->getInfo().alphaType());
- uint32_t* src = (uint32_t*) config.output.u.RGBA.rgba;
+ uint32_t* xformSrc = (uint32_t*) config.output.u.RGBA.rgba;
+ void* xformDst = SkTAddOffset<void>(dst, dstBpp * dstX + rowBytes * dstY);
size_t srcRowBytes = config.output.u.RGBA.stride;
for (int y = 0; y < rowsDecoded; y++) {
- SkAssertResult(this->colorXform()->apply(dstColorFormat, dst,
- SkColorSpaceXform::kBGRA_8888_ColorFormat, src, dstInfo.width(),
+ SkAssertResult(this->colorXform()->apply(dstColorFormat, xformDst,
+ SkColorSpaceXform::kBGRA_8888_ColorFormat, xformSrc, scaledWidth,
xformAlphaType));
- dst = SkTAddOffset<void>(dst, rowBytes);
- src = SkTAddOffset<uint32_t>(src, srcRowBytes);
+ xformDst = SkTAddOffset<void>(xformDst, rowBytes);
+ xformSrc = SkTAddOffset<uint32_t>(xformSrc, srcRowBytes);
}
}
diff --git a/tests/CodecTest.cpp b/tests/CodecTest.cpp
index 4083cfa44b..8a4d6fc7ab 100644
--- a/tests/CodecTest.cpp
+++ b/tests/CodecTest.cpp
@@ -662,6 +662,8 @@ DEF_TEST(Codec_Empty, r) {
test_invalid(r, "empty_images/zero-height.wbmp");
// This image is an ico with an embedded mask-bmp. This is illegal.
test_invalid(r, "invalid_images/mask-bmp-ico.ico");
+ // It is illegal for a webp frame to not be fully contained by the canvas.
+ test_invalid(r, "invalid_images/invalid-offset.webp");
#if defined(SK_CODEC_DECODES_RAW) && (!defined(_WIN32))
test_invalid(r, "empty_images/zero_height.tiff");
#endif