Bug: 769134
readByteArray can fail (due to not having enough available or due to the
wrong alignment). If it does, do not return an uninitialized block of
memory.
Further, drop the initial size check, which is covered by readByteArray.
Add a test.
Change-Id: Ia101697c5bb1ca3ae3df1795f37a74b2f602797d
Reviewed-on: https://skia-review.googlesource.com/52742
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
It's too inexact as-is. If the caller wants tolerance they can do
their own with knowledge of the pixel grid. The homogeneous math
is stable with infinities so it's really unnecessary here.
Bug: skia:7073
Change-Id: I4dc34ad96b859a138714b6d4f8804fec4f89f17a
Reviewed-on: https://skia-review.googlesource.com/51182
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This reverts commit 88757dacd4.
Reason for revert: Still seems to be failing Chromium "telemetry_perf_unittests (with patch) on Android" on android_n5x_swarming_rel.
Original change's description:
> guard old apis for querying byte-size of a bitmap/imageinfo/pixmap
>
> Now with legacy behavior for allocpixels
>
> This was reverted, so the current CL is a "fix" on top of ...
> https://skia-review.googlesource.com/c/skia/+/50980
>
> Related update to Chrome (in preparation for this change)
> https://chromium-review.googlesource.com/c/chromium/src/+/685719
>
> Bug: skia:
> Change-Id: I4b370ee7e95083ab27421f008132219c9c7b86e9
> Reviewed-on: https://skia-review.googlesource.com/51341
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>
TBR=fmalita@chromium.org,reed@google.com
Change-Id: I827a0ca1d1e3909e648fde3342cdb8601d34da8d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/52381
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Other browsers (including old Chrome) treat invalid palette indices as
transparent for gifs. And there are gifs in the wild which rely on this.
As an example, if the palette only has 64 entries (0-63) then index 64
is treated as transparent.
BUG=skia:7069
Change-Id: I15e8919a953387506c9ac5945c3ae6a2b90189ab
Reviewed-on: https://skia-review.googlesource.com/51100
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Chris Blume <cblume@google.com>
Bug: b/65290323
If a webp file is truncated such that no rows can be decoded,
WebPIDecGetRGB does not initialize its "last_y" parameter. We use
rowsDecoded (passed as last_y) to determine which remaining rows to
fill.
Check the return value of WebPIDecGetRGB. If it fails (returns null),
or rowsDecoded is <= 0 (matching Chromium's check), return
kInvalidInput, since there is nothing to draw.
Note that this is a change in behavior for Android. Previously we
would decode an empty webp to just a transparent/black rectangle,
whereas now we simply fail. I think this is a change for the better.
Add a test which truncates a file to have 0 rows available and attempts
to decode it. msan verifies that we no longer depend on the
uninitialized value.
Stop attempting to test decoding subsets from an incomplete webp (in
CodecTest.cpp). Unless we have decoded the portion covered by the
subset, this will fail.
Remove test images inc0.webp (from both dm/ and colorspace/) and
inc1.webp. These just decode to transparent rectangles. Replace them
with inc2.webp and inc3.webp, which decode part of the image and then
have to fill with transparent.
Change-Id: I64d40be91c574b45963f9a43d8dd8f4929dd2939
Reviewed-on: https://skia-review.googlesource.com/50303
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: James Zern <jzern@google.com>
Bug: skia:
Change-Id: Id6808734df2335c521d4a563122ceeca906b7601
Reviewed-on: https://skia-review.googlesource.com/52002
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This reverts commit 98a6216b18.
Reason for revert: breaking the chrome roll. Looks like they may be writing data to create an image across all the row bytes and thus writing to unalloced data on the last row. Link to example failing bot:
https://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/539960
Original change's description:
> guard old apis for querying byte-size of a bitmap/imageinfo/pixmap
>
> Previously we had size_t and uint64_t variations.
>
> The new (simpler) API always..
> - returns size_t, or 0 if the calculation overflowed
> - returns the trimmed size (does not include rowBytes padding for the last row)
>
> Bug: skia:
> Change-Id: I05173e877918327c7b207d2f7f1ab0db36892e2e
> Reviewed-on: https://skia-review.googlesource.com/50980
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Reviewed-by: Leon Scroggins <scroggo@google.com>
TBR=mtklein@google.com,herb@google.com,scroggo@google.com,fmalita@chromium.org,reed@google.com
Change-Id: I726f6ab1b36b14979ba6f37105e0a469b3f0dbc0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/51262
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Bug: skia:
Change-Id: Icfc2f1bd57c0cf7be54469b6d86cbd436b59155d
Reviewed-on: https://skia-review.googlesource.com/51201
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Previously we had size_t and uint64_t variations.
The new (simpler) API always..
- returns size_t, or 0 if the calculation overflowed
- returns the trimmed size (does not include rowBytes padding for the last row)
Bug: skia:
Change-Id: I05173e877918327c7b207d2f7f1ab0db36892e2e
Reviewed-on: https://skia-review.googlesource.com/50980
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Leon Scroggins <scroggo@google.com>
For this to work, we need access to the "original" path,
before any style was applied. To that end, add an original
path to GrShape (and unit tests of that functionality).
Then add a version of addGenIDChangeListener to GrShape,
that propagates to the original path, and use that in
tessellating path renderer.
Includes unit tests of caching behavior in the PR, all
of which failed without this change.
Bug: skia:
Change-Id: I98bb505f521e8ff07184f5c3fbd3c5fd1a22d3d5
Reviewed-on: https://skia-review.googlesource.com/50300
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This relands commit cb4d587666
which was reverted by commit b6d2be1330
because the original CL broke some blink layout tests, and the first
reland was reverted by commit because it broke filterfastbounds gm.
This reland let SkImageSource::onFilterNodeBounds() return the dst rect
with ctm applied when mapping forward or otherwise the default value.
Original description:
> Previously SkImageSource::filterBounds() uses the default
> SkImageFilter::onFilterNodeBounds() which returns the input rect.
>
> Now override onFilterNodeBounds() in SkImageSource to return src
> or dst rect (with transform applied).
Change-Id: I4548981142b9a96beda8339d394cf9943c9f4c0f
Reviewed-on: https://skia-review.googlesource.com/50420
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
All three image tile modes go through exclusive_clamp() and then a
gather today, so we can move the work of exclusive_clamp() into eac
gather_ stage, eliminating the need for clamp_{x,y} stages.
Luckily, we've got a convenient place to bottleneck this, ptr_and_ix(),
which works out the pointer and vector of indices to load for gathers.
This deletes SkRasterPipeline_repeat_tiling unit test, which now
no longer exactly makes sense. It tests that repeat_x does that
clamp, but that's now done automatically outside that stage.
Change-Id: I24637ef60921bec7aa00082984c0c6a49dd86ca9
Reviewed-on: https://skia-review.googlesource.com/50260
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Change-Id: I1d6aebcd679a406a13911f4b91f72f4198fc8dc1
Reviewed-on: https://skia-review.googlesource.com/49461
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Removes SkString-related malloc from DM crash handler, and adds null check in ProxyRefTest.
Bug: skia:3550
Change-Id: I143c532b5d231a426b1a96b854e1effd6379b673
Reviewed-on: https://skia-review.googlesource.com/48440
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This moves closer to ensuring that all SkRRects are valid. It also checks for validity of deserialized SkRRects and sets the SkRRect to empty if the serialized data is invalid rather than asserting.
It is still possible to use mutators to create invalid SkRRects (e.g. outset() by large number, translate() so that type changes due to fp precision).
Bug: skia:
Change-Id: Ice5f73a020e99739ef4b3ce362181d3dbb35701c
Reviewed-on: https://skia-review.googlesource.com/49220
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Bug: skia:6173
Change-Id: I21042d484d9a7b3eee04aa3301d9793d00ad6908
Reviewed-on: https://skia-review.googlesource.com/48183
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This reverts commit bf12c07970.
Reason for revert: broke the filterfastbounds GM (2nd column, 5th & 7th rows)
Original change's description:
> Reland "Fix SkImageSource::filterBounds()"
>
> This relands commit cb4d587666
> which was reverted by commit b6d2be1330
> because the original CL broke some blink layout tests.
>
> This reland let SkImageSource::filterBounds() return the dst rect with
> ctm applied regardless of direction.
>
> Original description:
>
> > Previously SkImageSource::filterBounds() uses the default
> > SkImageFilter::onFilterNodeBounds() which returns the input rect.
> >
> > Now override onFilterNodeBounds() in SkImageSource to return src
> > or dst rect (with transform applied).
>
> Change-Id: I915b7889ff59829ddbc4479cd66d75a0bb581e54
> Reviewed-on: https://skia-review.googlesource.com/47501
> Commit-Queue: Stephen White <senorblanco@chromium.org>
> Reviewed-by: Stephen White <senorblanco@chromium.org>
TBR=senorblanco@chromium.org,reed@google.com,wangxianzhu@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I698433de66cf3de145b9319e09cb9ec9e30d2fa9
Reviewed-on: https://skia-review.googlesource.com/48160
Reviewed-by: Florin Malita <fmalita@chromium.org>
The added unit test shows that we'll trigger SkASSERT failure if we
forgot to check that the edges are lines (instead of quads or cubics).
Similar to skia:7015, this bug is not triggered in our production
because we don't use DAA for convex paths by default. The skipRect is
an optimization just for convex paths.
Bug: skia:7051
Change-Id: Id87ce2d452ede0db9a48425541f473af19ee0572
Reviewed-on: https://skia-review.googlesource.com/48045
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
This reverts commit f953523224.
Reason for revert: Re-landing now that gold has settled.
Original change's description:
> Revert "Don't ignore degenerates when deciding if a path is convex"
>
> This reverts commit 53cd6c4331.
>
> Reason for revert: Temporary to limit gold cross-talk with other CLs.
>
> Original change's description:
> > Don't ignore degenerates when deciding if a path is convex
> >
> > This ensures that a path with a second contour will always be marked
> > concave. GrDefaultPathRenderer was incorrectly drawing paths of this type
> > (thinking that it could fill them with simple triangulation).
> >
> > Bug: skia:7020 skia:1460
> > Change-Id: I62bfd72e4c61da427687acf53c552357b57707aa
> > Reviewed-on: https://skia-review.googlesource.com/47082
> > Reviewed-by: Cary Clark <caryclark@google.com>
> > Commit-Queue: Brian Osman <brianosman@google.com>
>
> TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,reed@google.com
>
> Change-Id: Id7d121633faeb8a43dbd334409408ba51db43d68
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:7020 skia:1460
> Reviewed-on: https://skia-review.googlesource.com/47343
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,reed@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: skia:7020 skia:1460
Change-Id: I45ff90a54b66ce9ea068f246d066cc24b310c966
Reviewed-on: https://skia-review.googlesource.com/47820
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This reverts commit 05d5a13fea.
Reason for revert: looks like it broke filterfastbounds
Original change's description:
> Revert "Revert "Switched highp float to highfloat and mediump float to half.""
>
> This reverts commit 1d816b92bb.
>
> Bug: skia:
> Change-Id: I388b5e5e9bf619db48297a80c9a80c039f26c9f1
> Reviewed-on: https://skia-review.googlesource.com/46464
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
TBR=bsalomon@google.com,ethannicholas@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: skia:
Change-Id: Iddf6aef2ab084aa73da7ceebdfc303a1d2b80cde
Reviewed-on: https://skia-review.googlesource.com/47441
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This relands commit cb4d587666
which was reverted by commit b6d2be1330
because the original CL broke some blink layout tests.
This reland let SkImageSource::filterBounds() return the dst rect with
ctm applied regardless of direction.
Original description:
> Previously SkImageSource::filterBounds() uses the default
> SkImageFilter::onFilterNodeBounds() which returns the input rect.
>
> Now override onFilterNodeBounds() in SkImageSource to return src
> or dst rect (with transform applied).
Change-Id: I915b7889ff59829ddbc4479cd66d75a0bb581e54
Reviewed-on: https://skia-review.googlesource.com/47501
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
This makes loading into 16-bit channels more natural in _lowp.cpp.
Update a unit test to stop using out-of-range "colors".
Change-Id: I494687aac87948b60a40de447aa1527cf7167b2d
Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-UBSAN_float_cast_overflow
Reviewed-on: https://skia-review.googlesource.com/47580
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
- load_565 allows 565-src sprite blits
- scale_565 / lerp_565 allow subpixel text
- luminance_to_alpha is a color filter, and lets us write grey 8
And update CachedDecodingPixelRefTest with a yet more robust color.
Change-Id: I8af499c43f0f28093744d9c2993af553e36c9526
Reviewed-on: https://skia-review.googlesource.com/47021
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
This reverts commit 49f1f34438.
Reason for revert: broke win-chrome
../../third_party/skia/src/ports/SkFontMgr_win_dw.cpp(89): error C2228: left of '.release' must have class/struct/union
../../third_party/skia/src/ports/SkFontMgr_win_dw.cpp(89): note: type is 'SkStreamAsset *'
../../third_party/skia/src/ports/SkFontMgr_win_dw.cpp(89): note: did you intend to use '->' instead?
Original change's description:
> use unique_ptr for stream api
>
> Bug: skia:6888
> Change-Id: I3459b4913982a7cae1c0061697c82cc65ad9a2d8
> Reviewed-on: https://skia-review.googlesource.com/26740
> Reviewed-by: Mike Klein <mtklein@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>
TBR=mtklein@chromium.org,mtklein@google.com,bungeman@google.com,reed@google.com
Change-Id: Ic1e4af557317abd06b7f6b7f5056645df7e469f0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:6888
Reviewed-on: https://skia-review.googlesource.com/47440
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This reverts commit 53cd6c4331.
Reason for revert: Temporary to limit gold cross-talk with other CLs.
Original change's description:
> Don't ignore degenerates when deciding if a path is convex
>
> This ensures that a path with a second contour will always be marked
> concave. GrDefaultPathRenderer was incorrectly drawing paths of this type
> (thinking that it could fill them with simple triangulation).
>
> Bug: skia:7020 skia:1460
> Change-Id: I62bfd72e4c61da427687acf53c552357b57707aa
> Reviewed-on: https://skia-review.googlesource.com/47082
> Reviewed-by: Cary Clark <caryclark@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,reed@google.com
Change-Id: Id7d121633faeb8a43dbd334409408ba51db43d68
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:7020 skia:1460
Reviewed-on: https://skia-review.googlesource.com/47343
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This ensures that a path with a second contour will always be marked
concave. GrDefaultPathRenderer was incorrectly drawing paths of this type
(thinking that it could fill them with simple triangulation).
Bug: skia:7020 skia:1460
Change-Id: I62bfd72e4c61da427687acf53c552357b57707aa
Reviewed-on: https://skia-review.googlesource.com/47082
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Bug: skia:6888
Change-Id: I3459b4913982a7cae1c0061697c82cc65ad9a2d8
Reviewed-on: https://skia-review.googlesource.com/26740
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Previously SkImageSource::filterBounds() uses the default
SkImageFilter::onFilterNodeBounds() which returns the input rect.
Now override onFilterNodeBounds() in SkImageSource to return src
or dst rect (with transform applied).
Change-Id: I6681e1ba97affb09ef1ca5bc03b3d0f66c10f149
Reviewed-on: https://skia-review.googlesource.com/46741
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>