Commit Graph

10779 Commits

Author SHA1 Message Date
Florin Malita
38921cafe1 Reland "[skottie] Add image sampling and transform options"
This reverts commit b81842aa28.

Reason for revert: reland with fixes

Original change's description:
> Revert "[skottie] Add image sampling and transform options"
>
> This reverts commit 2f24405250.
>
> Reason for revert: broke Win/shared 
>
> Original change's description:
> > [skottie] Add image sampling and transform options
> >
> > Expand the SkImageAsset API to support controlling sampling options and
> > pass an additional transform.
> >
> > Bug: skia:10944, skia:10942
> > Change-Id: I7bad0b2ab58ed40fe4b425de0eb6970a4c7d7117
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340097
> > Commit-Queue: Florin Malita <fmalita@chromium.org>
> > Commit-Queue: Florin Malita <fmalita@google.com>
> > Reviewed-by: Mike Reed <reed@google.com>
>
> TBR=fmalita@chromium.org,fmalita@google.com,reed@google.com,aparchur@google.com
>
> Change-Id: I59d4161356ffdc20588f1bd3beb33c54e44807a2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10944
> Bug: skia:10942
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340619
> Reviewed-by: Florin Malita <fmalita@google.com>
> Commit-Queue: Florin Malita <fmalita@google.com>

TBR=fmalita@chromium.org,fmalita@google.com,reed@google.com,aparchur@google.com

# Not skipping CQ checks because this is a reland.

Bug: skia:10944
Bug: skia:10942
Change-Id: I91892f4db6366ceb07d1a49a7bc54da17cea5399
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340657
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
2020-12-03 19:21:57 +00:00
Mike Reed
1a4140e598 deprecate getTotalMatrix
Change-Id: Iec7d67f4ec3fdf4d5280f3de3d6146a69a60c646
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/339995
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-12-03 17:37:35 +00:00
Florin Malita
b81842aa28 Revert "[skottie] Add image sampling and transform options"
This reverts commit 2f24405250.

Reason for revert: broke Win/shared 

Original change's description:
> [skottie] Add image sampling and transform options
>
> Expand the SkImageAsset API to support controlling sampling options and
> pass an additional transform.
>
> Bug: skia:10944, skia:10942
> Change-Id: I7bad0b2ab58ed40fe4b425de0eb6970a4c7d7117
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340097
> Commit-Queue: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Florin Malita <fmalita@google.com>
> Reviewed-by: Mike Reed <reed@google.com>

TBR=fmalita@chromium.org,fmalita@google.com,reed@google.com,aparchur@google.com

Change-Id: I59d4161356ffdc20588f1bd3beb33c54e44807a2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10944
Bug: skia:10942
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340619
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2020-12-03 17:11:00 +00:00
Florin Malita
2f24405250 [skottie] Add image sampling and transform options
Expand the SkImageAsset API to support controlling sampling options and
pass an additional transform.

Bug: skia:10944, skia:10942
Change-Id: I7bad0b2ab58ed40fe4b425de0eb6970a4c7d7117
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340097
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-12-03 16:17:24 +00:00
Mike Reed
2d8bd15588 get 4x4 initialMatrix in pictureplayback
Bug: skia:11031
Change-Id: Ib502870a43b295ad6932ee95a839128d54963019
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/339984
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-12-03 15:29:18 +00:00
Leon Scroggins III
469d67e7d9 Expose more info in SkCodec::FrameInfo
Bug: b/160984428

Add more fields to SkCodec::FrameInfo, which describes the properties of
an individual frame in an animated image. This allows a client that
wishes to seek to determine frame dependencies so that they can decode
an arbitrary frame, which in turn will allow SkCodec to remove
SkCodec::FrameInfo::fRequiredFrame. Currently, SkCodec seeks through the
stream to determine frame dependencies, but this is unnecessary work
(and storage) for a client that does not want to seek.

These fields also support the proposed APIs in go/animated-ndk.

Move SkCodecAnimation::Blend from SkCodecAnimationPriv (and delete that
file) into SkCodecAnimation.h. Rename its values to be more clear.

Merge common code for populating SkCodec::FrameInfo.

Add a test for a GIF with offsets outside the range of the image. Note
that libwebp rejects such an image.

Update libgifcodec.

Change-Id: Ie27e0531e7d62eaae153eccb3105bf2121b5aac4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/339857
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Nigel Tao <nigeltao@google.com>
2020-12-02 22:37:20 +00:00
Mike Klein
bb1933e0d6 simplify SkSamplingOptions field names
SkSamplingOptions has no methods, so there's no need
to use an fPrefix to distinguish its fields from locals.
They'll always be accessed by foo.filter, bar->mipmap, etc.

Change-Id: Ia27ebea26d03eba60036616508731c4d2020462c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340356
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-12-02 22:30:00 +00:00
Mike Klein
dcc8960bc2 make SkSamplingOptions fields const
This lets us trust the invariants that the constructors set up,
like if fUseCubic, then fMipmap == SkMipmapMode::kNone.

Gotta be slightly sneaky and implement operator= ourselves
with placement new.

Change-Id: I043cd56cbf9f1e2fa64ab585268b2799df65c31f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340179
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-12-02 22:15:58 +00:00
Brian Salomon
07bc9a27f5 GPU clear values: just 4 floats
We previously represented these as SkPMColor4f. However, upcoming
changes will add limited support for clearing/drawing to unpremul
dst. Just store the clear values as four floats without assigned
interpretation.

Also, noticed a bug by code inspection: we weren't accounting for
write view swizzle in GrRTC. Fixed and added gm to test.

Bug: skia:11019
Change-Id: I1bce1f6c97a156c0377ebad1b166eb641362b67a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340098
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-12-02 22:04:08 +00:00
Mike Reed
387826f6f6 Remove unused SkRWBuffer
Bug: skia:10980
Change-Id: Ibbb62edcbf5a8c1bc341416aef225cae3cf1a256
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/336960
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Thiabaud Engelbrecht <thiabaud@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-12-02 15:29:06 +00:00
Ethan Nicholas
bb9fbe057a Allow SkASSERTF to take zero varargs parameters
Previously, calling SkASSERTF(test, "message") would result in an error
due to a dangling comma in its expansion. Adding '##' instructs the
preprocessor to strip the dangling comma if there are no varargs.

Change-Id: Id5dd27e770cf6cd9dec9cd62808d1821f37c9c65
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/339398
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-12-01 17:18:52 +00:00
Ben Wagner
831a5a10f4 Fix DWrite axis design parameters.
DWrite makes up a bunch of axes that don't exist, so non-variable axes
are ignored. However, the actual index of the non-variable axes was not
being updated. Update it.

Bug: skia:10928
Change-Id: Iedce5d0dd58f447821b403c38f033d214b457e9f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/338602
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-12-01 15:00:33 +00:00
Mike Reed
6affa2c2e3 move SkMipmapBuilder to private
Change-Id: I77f57b175984a5e373fae951a270a883e7e4c5d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/339216
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-11-30 20:13:15 +00:00
Robert Phillips
c4fbc8d6cf Stop overflow of windows rects in GrClipStack
Bug: skia:10989
Change-Id: I512ccbd3d95178756ae436f7c67ed53d46105ae7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/339165
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-11-30 18:12:24 +00:00
Robert Phillips
ca92424e21 Remove SkBaseDevice::flush (take 2)
Another small step in removing SkCanvas::flush

Change-Id: I6f3bec367e582754b8463b7bfe6a2542436ca829
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335647
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-11-30 14:13:03 +00:00
Mike Reed
420a9ba7b5 Switch to m44 for the rest of canvas virtuals
Guard flag has been added to clients

Change-Id: Ib61a48781f5dbd52279c8f4257ba3e22fb2704e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/338596
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-11-25 21:50:37 +00:00
Michael Ludwig
a2c40206c6 Preserve dithering for SkImageFilters::Shader
Migrating chromium code to use SkImageFilters::Shader over
SkPaintImageFilter requires dithering to be preserved for its gradient
fills.

I debated always forcing it to true, but dithering was never turned on
for the turbulence filter and it's not necessary for const color shaders
Given that, I opted to just make it a parameter to the filter factory,
which seems okay since we're unlikely to embed dithering into SkShader
itself, it's a shading-related parameter of SkPaint, and if we migrate
to always dithering, then we can remove it.

Bug: skia:9310
Change-Id: I86f14969e2446f3a84e71e687cb263bcd44cf9d9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/338156
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-11-25 19:41:37 +00:00
Michael Ludwig
51b74afb84 Reland "Move conservative bounds tracking from SkCanvas to SkNoPixelsDevice"
This reverts commit 8636e13c2d.

Reason for revert: recording canvases with really big float bounds could
produce a non-empty integer rect bounds that became empty after mapping
it to (0,0,w,h) for the device. This meant resetForNextPictures logic of
updating QR bounds directly from the input bounds allowed state to become
inconsistent with computeDevClipBounds().

PS1->PS4 shows the 1-liner to just compute bounds from the device. This
means that, for now, we preserve the behavior of setting the QR bounds to
be actually empty. skbug.com/10997 is added to fix the underlying issue
with recorders and excessively large float bounds. If that change landed
first, I'd be able to reland this w/o any modifications, but have decided
that it's better to have all locations that modify fQuickRejectBounds use
the exact same expression.

Original change's description:
> Revert "Move conservative bounds tracking from SkCanvas to SkNoPixelsDevice"
>
> This reverts commit 11a394759a.
>
> Reason for revert: assert during google3 tests.
>
> Original change's description:
> > Move conservative bounds tracking from SkCanvas to SkNoPixelsDevice
> >
> > Change-Id: I56670b4a4159e21eaa1a58a9a3ee439298d5aa8e
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335863
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
>
> TBR=mtklein@google.com,bsalomon@google.com,reed@google.com,michaelludwig@google.com
>
> Change-Id: I7c3a8797460113d9a8ef18d82bbbd64aba2f439c
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/338316
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

TBR=mtklein@google.com,bsalomon@google.com,reed@google.com,michaelludwig@google.com

# Not skipping CQ checks because this is a reland.

Change-Id: I1b33e128b4fb4e06b8c7a6ee9b9dcc67202674d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/338322
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-11-25 17:29:47 +00:00
Michael Ludwig
8636e13c2d Revert "Move conservative bounds tracking from SkCanvas to SkNoPixelsDevice"
This reverts commit 11a394759a.

Reason for revert: assert during google3 tests.

Original change's description:
> Move conservative bounds tracking from SkCanvas to SkNoPixelsDevice
>
> Change-Id: I56670b4a4159e21eaa1a58a9a3ee439298d5aa8e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335863
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

TBR=mtklein@google.com,bsalomon@google.com,reed@google.com,michaelludwig@google.com

Change-Id: I7c3a8797460113d9a8ef18d82bbbd64aba2f439c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/338316
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-11-24 20:13:57 +00:00
Mike Reed
246fcc3895 rely on clients to guard old api
Change-Id: Iaac2e7da034b7fc20d23d44c814485a068f26f1c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/337943
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-11-24 17:33:36 +00:00
Michael Ludwig
11a394759a Move conservative bounds tracking from SkCanvas to SkNoPixelsDevice
Change-Id: I56670b4a4159e21eaa1a58a9a3ee439298d5aa8e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335863
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-11-24 17:00:25 +00:00
Chris Dalton
4c1fb1c27a Return the contour's final point from SkPath::RangeIter in kClose
This point is located at fPoints[-1]. We might as well provide it
since it's free, and the stroke iterators for indirect tessellation
will be able to use it.

Bug: skia:10419
Change-Id: If0161a18a9a5a0f3b118a99d7c090d79d424f9db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/337637
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-11-24 03:24:43 +00:00
Mike Reed
ce0c876ce2 hide legacy scalePixels and makeShader
Change-Id: Idae1e44aa0417adb943fd20112fb4f1fa81167f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/337719
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-11-24 00:41:33 +00:00
Mike Klein
cd74dea856 macro hygiene in SkVx.h
These macros are not meant to leak out of the file.

Change-Id: I7e24f65a3053785410c7fac760fd3af46c5c1f1c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/337739
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2020-11-23 22:49:33 +00:00
Michael Ludwig
f9334e918f Reland "Simplify layer bounds syncing and no-device error handling in SkCanvas::internalSaveLayer"
This reverts commit 6c1191d749.

Reason for revert:
 - the lowest-level issue is fixed in https://skia-review.googlesource.com/c/skia/+/337076
   which prevents bad replaceClips from going beyond the device bounds
 - but this also updates the original CL so that we don't call
   replaceClip in these problematic situations. The old behavior of
   effectively downgrading a saveLayer to a save when the new device
   fails to allocate is better behavior.
 - now the bounds tracking is still consolidated as before, but only
   applied when the kNoLayer_Strategy is used, or the layer should be
   empty (in which case replaceClip() is passed an empty rect and
   everything works out).

 - when the layer fails to allocate, we add a clipRegion to restrict
   nested draw calls to what would have been the layers bounds, while
   still respecting the old clip (that normally would have been applied
   on the layer restore, but won't because there's no layer). This is
   somewhat pedantic, and is probably a rare case in the wild, but it
   makes some of our SkCanvas tests easier to deal with.
 - This is because, if you just make an SkCanvas(width, height) directly
   you get an SkNoPixelsDevice but also use the kFullLayer_Strategy.
   SkNoPixelsDevice always fails to create a layer (since it's meant to
   be used with subclasses of SkCanvas that return kNoLayer_Strategy,
   like SkNoDrawCanvas).
 - applying the failed layer bounds as a clip keeps the canvas' reported
   bounds as accurate as possible in this case.
     - in the future, it may be worth updating how SkCanvas can be
       constructed to avoid this, and overhauling the unit tests but
       I didn't want to further delay these changes.

 - it's important that replaceClip() is still used for the kNoLayer case
   because it allows image-filtered layers to expand the clip bounds
   until the restore. This keeps any virtual canvas or recording canvas
   completely in-sync with the base canvas or eventual real canvas that
   is backed by a device that actually draws.

Original change's description:
> Revert "Simplify layer bounds syncing and no-device error handling in SkCanvas::internalSaveLayer"
>
> This reverts commit b27ba538ec.
>
> Reason for revert: causes invalid memory accesses due to replaceClip use, and replaceClip() is probably not the right operation to use
> to emulate a layer when no layer was the strategy or failed to allocate.
>
> Original change's description:
> > Simplify layer bounds syncing and no-device error handling in SkCanvas::internalSaveLayer
> >
> > This corrects some subtle bugs that can occur with recording canvas or
> > if a device fails to be created for a new layer, where the stashed
> > matrix would not be restored properly. Since no new DeviceCM would get
> > added in those cases, the canvas' total matrix wouldn't get fixed in the
> > paired onRestore() and it would remain dirty for the remainder of the
> > canvas's lifetime.
> >
> > After this change, the underlying SkDevice's bounds are also kept in
> > sync with the intent of the saveLayer when kNoLayer_Strategy is used.
> > Previously, the bounds would be applied to the canvas' conservative clip
> > and quick reject bounds, but the device would remain un-updated. As we
> > move towards SkNoPixelsDevice taking over the conservative clip bounds,
> > this ensures bounds remain up to date within a saveLayer/restore pair
> > even if no layer was allocated.
> >
> > Change-Id: I5ca389bdd624ea7278106da863a96e9d8f90e2d1
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335861
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
>
> TBR=mtklein@google.com,bsalomon@google.com,reed@google.com,michaelludwig@google.com
>
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:1151195, chromium:1151270, chromium:1151294, chromium:1151320, chromium:1151322
> Change-Id: I9db07916ffc450cc6ecc9188d72bb7c35770a974
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/337117
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

TBR=mtklein@google.com,bsalomon@google.com,reed@google.com,michaelludwig@google.com

# Not skipping CQ checks because this is a reland.

Change-Id: Idcab9084c7f19d8f31b11231fd9b52292fc397a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/337157
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-11-23 19:49:03 +00:00
Mike Reed
ee9c4c71f6 remove legacy SkFilterOptions
Prerequisite:
https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/native/+/13103845

Change-Id: Ic89937b2fffa2e81b5e38ac7082134bc0a90c4de
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/337399
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-11-23 17:42:21 +00:00
Mike Reed
a03f8bf837 other ways to organize samplingoptions?
do not land

Change-Id: I5fa7b2a0d1eb7e893d9b333f850a2f515d7ce065
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/336956
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-11-21 02:00:26 +00:00
Robert Phillips
10089c6a42 Revert "Remove legacy SkImage::MakeFromYUVATextures."
This reverts commit df29db4c41.

Reason for revert: blocking the G3 roll

Original change's description:
> Remove legacy SkImage::MakeFromYUVATextures.
>
> Bug: skia:10632
> Change-Id: Iad8989e0ae5aa6921e8e2e27ba375221f2af0262
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/336959
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Auto-Submit: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

TBR=jvanverth@google.com,bsalomon@google.com,robertphillips@google.com

Change-Id: Id77c1679a96ad9c1be93e6e29449cc4785a3983b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10632
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/337183
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-11-20 21:51:40 +00:00
Michael Ludwig
6c1191d749 Revert "Simplify layer bounds syncing and no-device error handling in SkCanvas::internalSaveLayer"
This reverts commit b27ba538ec.

Reason for revert: causes invalid memory accesses due to replaceClip use, and replaceClip() is probably not the right operation to use
to emulate a layer when no layer was the strategy or failed to allocate.

Original change's description:
> Simplify layer bounds syncing and no-device error handling in SkCanvas::internalSaveLayer
>
> This corrects some subtle bugs that can occur with recording canvas or
> if a device fails to be created for a new layer, where the stashed
> matrix would not be restored properly. Since no new DeviceCM would get
> added in those cases, the canvas' total matrix wouldn't get fixed in the
> paired onRestore() and it would remain dirty for the remainder of the
> canvas's lifetime.
>
> After this change, the underlying SkDevice's bounds are also kept in
> sync with the intent of the saveLayer when kNoLayer_Strategy is used.
> Previously, the bounds would be applied to the canvas' conservative clip
> and quick reject bounds, but the device would remain un-updated. As we
> move towards SkNoPixelsDevice taking over the conservative clip bounds,
> this ensures bounds remain up to date within a saveLayer/restore pair
> even if no layer was allocated.
>
> Change-Id: I5ca389bdd624ea7278106da863a96e9d8f90e2d1
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335861
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

TBR=mtklein@google.com,bsalomon@google.com,reed@google.com,michaelludwig@google.com

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1151195, chromium:1151270, chromium:1151294, chromium:1151320, chromium:1151322
Change-Id: I9db07916ffc450cc6ecc9188d72bb7c35770a974
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/337117
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-11-20 17:10:58 +00:00
Brian Salomon
df29db4c41 Remove legacy SkImage::MakeFromYUVATextures.
Bug: skia:10632
Change-Id: Iad8989e0ae5aa6921e8e2e27ba375221f2af0262
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/336959
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-11-20 16:48:16 +00:00
Michael Ludwig
b27ba538ec Simplify layer bounds syncing and no-device error handling in SkCanvas::internalSaveLayer
This corrects some subtle bugs that can occur with recording canvas or
if a device fails to be created for a new layer, where the stashed
matrix would not be restored properly. Since no new DeviceCM would get
added in those cases, the canvas' total matrix wouldn't get fixed in the
paired onRestore() and it would remain dirty for the remainder of the
canvas's lifetime.

After this change, the underlying SkDevice's bounds are also kept in
sync with the intent of the saveLayer when kNoLayer_Strategy is used.
Previously, the bounds would be applied to the canvas' conservative clip
and quick reject bounds, but the device would remain un-updated. As we
move towards SkNoPixelsDevice taking over the conservative clip bounds,
this ensures bounds remain up to date within a saveLayer/restore pair
even if no layer was allocated.

Change-Id: I5ca389bdd624ea7278106da863a96e9d8f90e2d1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335861
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-11-19 21:24:40 +00:00
Jim Van Verth
9e64047a04 Add MTLBinaryArchive support to iOS Metal build
Change-Id: I7a4f58e4fc1fc18c42de372dd480e0681000e2f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/333758
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Chinmay Garde <chinmaygarde@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
2020-11-19 20:00:30 +00:00
Michael Ludwig
466e7e88d3 Hide SkCanvas::AutoValidateClip in cpp file
Bug: skia:9283
Change-Id: I1f808ec9d004f228b17a139dff7a2f44676baf50
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335856
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-11-18 20:56:15 +00:00
Michael Ludwig
5013d957f3 Rename fDeviceClipBounds to fQuickRejectBounds
This better differentiates it from device clip bounds, and the fact that
the stored bounds have been outset by 1 to account for AA, and are only
used for quick reject purposes.

Bug: skia:9283
Change-Id: I47420f23b74e47626596f978c78f01d7d97ae808
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335828
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-11-18 20:37:55 +00:00
Brian Salomon
94584f4574 Remove unused macros from GrGLConfig.h, GrGLConfig_chrome.h, and scripts
Change-Id: I5a9e7d490fd71f326ac37a72eb942fc64f557733
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335666
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-11-18 20:23:35 +00:00
Herb Derby
90f211f46b calculate glyph offset using (0,0) mapping
This code has rotted a bit. The glyph off set is now calculated
by mapping (0,0) through the current matrix, and the initial
matrix, and taking the vector difference. Residual is no longer
needed and all the plumbing can be removed.

Change-Id: I20b56afc6749fd26fe283a7ff22f38951da0e6f5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335823
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-11-18 17:18:45 +00:00
Brian Salomon
fcc4e85f3c Remove SkYUVAInfo::PlanarConfig
Bug: skia:10632
Change-Id: I72b4379c82fd7dc4c7169387014f8fffbb86e23f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334161
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-11-18 14:26:14 +00:00
Brian Salomon
98e17bf01a Remove deprecated DDL promise texture image factories.
Bug: skia:10632
Change-Id: I218281256ea5ab4a5a5a7ea7bf209350082f8dc7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335038
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-11-17 17:28:23 +00:00
Ben Wagner
c634fc4a66 Remove FCLocker::Suspend.
It's a bad idea, difficult to reason about, and may be causing
deadlocks.

Change-Id: Id9749661f4f3f942ee983e9c1fdab2bd7f287edb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335242
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-11-17 17:11:03 +00:00
Leon Scroggins
da3d8c2471 Reland "SkAnimatedImage: Use fSampleSize"
This is a reland of 4fdf9f9ce5

No change from the original, which was just reverted to be able to
cleanly revert its parent, which has now been relanded with a fix.

Original change's description:
> SkAnimatedImage: Use fSampleSize
>
> Bug: b/163595585
>
> This will allow using less memory when decoding an animated GIF by
> sampling at decode time. This is tested by the animated_image GMs.
>
> Change-Id: I748b2180827623e4ca1fc0fd4d6dd02733b3b5f2
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/333226
> Commit-Queue: Leon Scroggins <scroggo@google.com>
> Reviewed-by: Derek Sollenberger <djsollen@google.com>

Bug: b/163595585
Change-Id: I3249bd04b64750a50a4c5c787db3e80ac4d85e67
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335279
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-11-17 14:07:03 +00:00
Robert Phillips
b7c1310834 Revert "Remove SkBaseDevice::flush"
This reverts commit 971b19d0c6.

Reason for revert: See if this CL was causing the Perf-Win10-Clang-ShuttleA-GPU-GTX660-x86_64-Release-All issue

Original change's description:
> Remove SkBaseDevice::flush
>
> Another small step in removing SkCanvas::flush
>
> Change-Id: I6f17edcd1996e1009dad7cc96a97be3b0c4664f4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334417
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,adlai@google.com

Change-Id: I0b9116f8ce4eed3a0d49ccf1cc55d8d89675617e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335216
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-11-16 18:46:19 +00:00
Leon Scroggins
1340dbde91 Reland "SkAndroidCodec: Support decoding all frames"
This is a reland of fc4fdc5b25

Original change's description:
> SkAndroidCodec: Support decoding all frames
>
> Bug: b/160984428
> Bug: b/163595585
>
> Add support to SkAndroidCodec for decoding all frames with an
> fSampleSize, so that an entire animation can be decoded to a smaller
> size.
>
> dm/:
> - Test scaled + animated decodes
>
> SkAndroidCodec:
> - Make AndroidOptions inherit from SkCodec::Options. This allows
>   SkAndroidCodec to use fFrameIndex. (It also combines the two versions
>   of fSubset, which is now const for both.)
> - Respect fFrameIndex, and call SkCodec::handleFrameIndex to decode
>   the required frame.
> - Disallow decoding with kRespect + fFrameIndex > 0 if there is a
>   non-default orientation. As currently written (except without
>   disabling this combination), SkPixmapPriv::Orient would draw the new
>   portion of the frame on top of uninitialized pixels, instead of the
>   prior frame. This could be fixed by
>   - If SkAndroidCodec needs to decode the required frame, it could do so
>     without applying the orientation, then decode fFrameIndex, and then
>     apply the orientation.
>   - If the client provided the required frame, SkAndroidCodec would need
>     to un-apply the orientation to get the proper starting state, then
>     decode and apply.
>   I think it is simpler to force the client to handle the orientation
>   externally.
>
> SkCodec:
> - Allow SkAndroidCodec to call its private method handleFrameIndex. This
>   method handles decoding a required frame, if necessary. When called by
>   SkAndroidCodec, it now uses the SkAndroidCodec to check for/decode the
>   required frame, so that it will scale properly.
> - Call rewindIfNeeded inside handleFrameIndex. handleFrameIndex calls a
>   virtual method which may set some state (e.g. in SkJpegCodec). Without
>   this change, that state would be reset by rewindIfNeeded.
> - Simplify handling a kRestoreBGColor frame. Whether provided or not,
>   take the same path to calling zero_rect.
> - Updates to zero_rect:
>   - Intersect after scaling, which will also check for empty.
>   - Round out instead of in - this ensures we don't under-erase
>   - Use kFill_ScaleToFit, which better matches the intent.
>
> Change-Id: Ibe1951980a0dca8f5b7b1f20192432d395681683
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/333225
> Commit-Queue: Leon Scroggins <scroggo@google.com>
> Reviewed-by: Derek Sollenberger <djsollen@google.com>

Bug: b/160984428
Bug: b/163595585
Change-Id: I7c1e79e0f92c75b4840eef65c8fc2b8497189e81
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334842
Auto-Submit: Leon Scroggins <scroggo@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2020-11-16 16:55:48 +00:00
Robert Phillips
971b19d0c6 Remove SkBaseDevice::flush
Another small step in removing SkCanvas::flush

Change-Id: I6f17edcd1996e1009dad7cc96a97be3b0c4664f4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334417
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-11-16 15:26:06 +00:00
Brian Salomon
9f94f31cc0 Add convenience method SkYUVAInfo::makeSubsampling.
Will be used Chrome to convert subsampled info to k444.

Bug: skia:10632
Change-Id: Ife9bdf3a28aeb6db1de063539a8b1664bdcbdb5e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334958
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
2020-11-16 14:28:34 +00:00
Michael Ludwig
4757a60871 Accept SkFilterQuality in SkImageFilters::Shader
This is needed to help ease the migration from SkImageFilters::Paint,
until image shaders always force you to embed sampling options.

Change-Id: Id8dc8c3196a7935073677a5fbb8d35c3bd22f9ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/333757
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-11-13 22:46:20 +00:00
Mike Reed
cae335d5b1 Add temporary Make for SkSamplingOptions
To help stage clients away from SkFilterQuality

Change-Id: Icf9d192880caa16a82f9774cc99c97e096f8e678
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334162
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-11-13 20:12:53 +00:00
Brian Salomon
a29ed26cfc Remove unused copy-to-external YUV SkImage factories.
Also inline some helper functions into newer factory method
that are no longer shared.

Bug: skia:10632
Change-Id: I466c59f668d882802087acad1ec1f229505a3377
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334596
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-11-13 19:24:15 +00:00
Leon Scroggins III
267a8589d3 Revert "SkAndroidCodec: Support decoding all frames"
This reverts commit fc4fdc5b25.

Reason for revert: Google3 and ASAN failures

Change-Id: I890cd76109c0375391637f879550837d01e650f9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334840
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-11-13 16:20:39 +00:00
Leon Scroggins
efd628a1a9 Revert "SkAnimatedImage: Use fSampleSize"
This reverts commit 4fdf9f9ce5.

Reason for revert: Google3 and ASAN failures caused by the prior
change, which this depends on.

Original change's description:
> SkAnimatedImage: Use fSampleSize
>
> Bug: b/163595585
>
> This will allow using less memory when decoding an animated GIF by
> sampling at decode time. This is tested by the animated_image GMs.
>
> Change-Id: I748b2180827623e4ca1fc0fd4d6dd02733b3b5f2
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/333226
> Commit-Queue: Leon Scroggins <scroggo@google.com>
> Reviewed-by: Derek Sollenberger <djsollen@google.com>

TBR=djsollen@google.com,scroggo@google.com

Change-Id: I0d30ada4eba2302ce0c5f85b1174d0618ae0f589
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: b/163595585
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334839
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2020-11-13 15:28:00 +00:00
Leon Scroggins
4fdf9f9ce5 SkAnimatedImage: Use fSampleSize
Bug: b/163595585

This will allow using less memory when decoding an animated GIF by
sampling at decode time. This is tested by the animated_image GMs.

Change-Id: I748b2180827623e4ca1fc0fd4d6dd02733b3b5f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/333226
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2020-11-12 22:30:51 +00:00