Commit Graph

766 Commits

Author SHA1 Message Date
Mike Reed
568f0ae778 drawBitmap is deprecated
- update call-sites in gms
- start deleting obsolete/duplicated gms

Change-Id: I9ab5aa0a22d4603ccb43715c0583eb587bbe5c8e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358217
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-24 14:48:44 +00:00
Mike Reed
34c56a5c3d Migrate to drawImage w/ sampling
Bug: skia:7650
Change-Id: Icb99ee9f7142fe1ca22f9fa66b1467486ce576a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357598
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-22 22:38:02 +00:00
Mike Reed
e02d7f844b More hiding of legacy drawImage calls
Also cleanup some of the duplicate code in SkRecords

Bug: skia:7650
Change-Id: I4d3167a892c126c19a54002beab25c9a6c96fa5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357000
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-22 13:53:42 +00:00
Mike Reed
821a84558b remove dead code from old drawimage virtuals
Bug: skia:7650
Change-Id: Ie6bce2130519655645b7c5602d364cd0e1d6fdf3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356358
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-21 01:26:15 +00:00
Mike Reed
18aeb5731b Hide legacy drawImage methods
Migrate clients to use drawImage(... sampling)
rather than relying on paint's filter-quality.

This CL just gets started, introducing the build-flag.

Bug: skia:7650
Change-Id: I4afdd964c6f805058afee0a8f3a6887d501ad42b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356076
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2021-01-20 00:59:26 +00:00
Mike Reed
6dbeac51b4 Begin to hide drawBitmap
... now that bitmap
- converts to image with just bitmap.asImage()
- canvas *always* converts bitmaps to images before they are drawn

Bug: skia:10037
Change-Id: I24292f62e0fd072b3b810d974d0fe5c6d9b9a68d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353582
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-13 19:40:45 +00:00
Mike Reed
4f509345ab Pass sampling to drawImageSet
Bug: skia:7650
Change-Id: I93d41ca6e5beb85e9924ea2f3e0a82c18ff51369
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/349617
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-05 19:40:31 +00:00
Mike Reed
d8ff313e44 Plumb sampling to drawSpecial, drawDevice
Bug: skia:7650
Change-Id: I5bae4dec2fbbd57b2cebc4324f5344cc8769b141
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/349398
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-04 17:07:20 +00:00
Mike Reed
ee380a0c7d Remove references to drawBitmapNine
Change-Id: Ifb2ca09b5d146eca796ce0e199720e8833848e13
Docs-Preview: https://skia.org/?cl=349401
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/349401
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-01 15:23:23 +00:00
Mike Reed
4f23dec742 Reland "Add new virts, hide old ones"
This reverts commit 8f924ac0ce.

Reason for revert: suppressions landed for fuchsia images to rebaseline

Original change's description:
> Revert "Add new virts, hide old ones"
>
> This reverts commit c56e2e5aa6.
>
> Reason for revert: suspected of breaking chrome roll
>
> Original change's description:
> > Add new virts, hide old ones
> >
> > Add virtuals for the draw methods that now take sampling/filtermode.
> >
> > drawImage
> > drawImageRect
> > drawImageLattice
> > drawAtlas
> >
> > Add a flag that can remove the older virtuals, once each client has
> > stopped overriding them. In that situation, the older public methods
> > will simplify extract the sampling from the paint, and call the new
> > public methods.
> >
> > Bug: skia:11105, skia:7650
> > Change-Id: I8b0029727295caa983e8148fc743a55cfbecd043
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347022
> > Commit-Queue: Mike Reed <reed@google.com>
> > Reviewed-by: Florin Malita <fmalita@chromium.org>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,fmalita@chromium.org,reed@google.com
>
> Change-Id: I0a90952c11a180d918126ea06a630f4a0bf9b49b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:11105
> Bug: skia:7650
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348194
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Commit-Queue: Derek Sollenberger <djsollen@google.com>

TBR=djsollen@google.com,bsalomon@google.com,fmalita@chromium.org,reed@google.com

# Not skipping CQ checks because this is a reland.

Bug: skia:11105
Bug: skia:7650
Change-Id: Ia2b4537a2d330460b7554278d2c05075cf27162a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348876
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-12-30 15:21:01 +00:00
Derek Sollenberger
8f924ac0ce Revert "Add new virts, hide old ones"
This reverts commit c56e2e5aa6.

Reason for revert: suspected of breaking chrome roll

Original change's description:
> Add new virts, hide old ones
>
> Add virtuals for the draw methods that now take sampling/filtermode.
>
> drawImage
> drawImageRect
> drawImageLattice
> drawAtlas
>
> Add a flag that can remove the older virtuals, once each client has
> stopped overriding them. In that situation, the older public methods
> will simplify extract the sampling from the paint, and call the new
> public methods.
>
> Bug: skia:11105, skia:7650
> Change-Id: I8b0029727295caa983e8148fc743a55cfbecd043
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347022
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

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

Change-Id: I0a90952c11a180d918126ea06a630f4a0bf9b49b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11105
Bug: skia:7650
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348194
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2020-12-30 13:41:52 +00:00
Mike Reed
c56e2e5aa6 Add new virts, hide old ones
Add virtuals for the draw methods that now take sampling/filtermode.

drawImage
drawImageRect
drawImageLattice
drawAtlas

Add a flag that can remove the older virtuals, once each client has
stopped overriding them. In that situation, the older public methods
will simplify extract the sampling from the paint, and call the new
public methods.

Bug: skia:11105, skia:7650
Change-Id: I8b0029727295caa983e8148fc743a55cfbecd043
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347022
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-12-29 21:36:08 +00:00
Brian Salomon
8f7d95382e Remove public getter for GrSurfaceDrawContext on SkSCanvas.
Made it private and accessible internally via SkCanvasPriv.

Update SkGpuDevice methods/variables after rename of GrDrawSurfaceContext.

Cq-Include-Trybots: luci.skia.skia.primary:Canary-G3,Canary-Flutter,Canary-Android
Change-Id: I3da64cee1de03c201243ee6c7ccd4b4c44cad8c9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346498
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-12-23 16:13:07 +00:00
Brian Salomon
f02df4db61 Remove public SkCanvas::internalGetTopLayerBounds()
Android is now using framework-only topLayerBounds()

Cq-Include-Trybots: luci.skia.skia.primary:Canary-Android
Change-Id: I40375ef1de45d3c2160dd913593326950265314e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344974
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-12-22 14:18:12 +00:00
Mike Reed
6aea078802 Don't use sprite-blit if cubic sampling
Need this to land first: https://chromium-review.googlesource.com/c/chromium/src/+/2597643

Bug: skia:7650
Change-Id: Idebecfc8a5922a937fd46ccff1eea4df53f6b0cd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345170
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-12-21 16:10:42 +00:00
Mike Reed
860d01ca8b Idea: implement drawImageNine by calling drawImageLattice
- that removes the need for onDrawImageNine
- ... that removes a whole lot of plumbing

Bug: skia:11099
Change-Id: I35e2f70320be118aec38a5c783a53c7aa90b3131
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345160
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-12-17 16:35:05 +00:00
Mike Reed
ed4108e428 Revert "Revert "Reland "Rename getTopDevice/getDevice to topDevice/baseDevice"""
Removed const Device* return

This reverts commit 9e230d8136.

Change-Id: I1151a198e857fb1b539f69fdab917668c35d147d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345285
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-12-17 16:32:23 +00:00
Mike Reed
83aef7f816 Remove obsolete dox w.r.t. filter-quality
Change-Id: Iab72a7e87445f821b887db32ee09a64700983077
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345280
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-12-17 14:33:21 +00:00
Michael Ludwig
9e230d8136 Revert "Reland "Rename getTopDevice/getDevice to topDevice/baseDevice""
This reverts commit 7839f66540.

Reason for revert: another android-framework only compiler issue, this time around 'const'-ness

Original change's description:
> Reland "Rename getTopDevice/getDevice to topDevice/baseDevice"
>
> This reverts commit d8b939e0b4.
>
> Reason for revert: fix SkAndroidFrameworkUtils getDevice() reference
>
> Original change's description:
> > Revert "Rename getTopDevice/getDevice to topDevice/baseDevice"
> >
> > This reverts commit 632a23afa4.
> >
> > Reason for revert: breaking android roll
> >
> > Original change's description:
> > > Rename getTopDevice/getDevice to topDevice/baseDevice
> > >
> > > This addresses nit from https://skia-review.googlesource.com/c/skia/+/344663
> > > and also moves topDevice() to be private, since it's not really meant
> > > for arbitrary subclasses to access anyways. Classes outside of SkCanvas
> > > that need topDevice/baseDevice are already friended anyways.
> > >
> > > Bug: skia:10987
> > > Change-Id: Ib0b0dffb5b1c35d5a0c78aeb8903e4cf0b8810a9
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344960
> > > Reviewed-by: Mike Klein <mtklein@google.com>
> > > Reviewed-by: Mike Reed <reed@google.com>
> > > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> >
> > TBR=mtklein@google.com,reed@google.com,michaelludwig@google.com
> >
> > Change-Id: I9b70230f7db5d31cede2ea03e7abc7c154021204
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: skia:10987
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345158
> > Reviewed-by: Derek Sollenberger <djsollen@google.com>
> > Commit-Queue: Derek Sollenberger <djsollen@google.com>
>
> TBR=djsollen@google.com,mtklein@google.com,reed@google.com,michaelludwig@google.com
>
> # Not skipping CQ checks because this is a reland.
>
> Bug: skia:10987
> Change-Id: Ibf6397b54655c25ef3d348210de5eb6dab416723
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345165
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

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

Change-Id: Ib97ee3c349eee90d27bf22f4d43d29d24ca68f27
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10987
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345282
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-12-17 14:23:16 +00:00
Michael Ludwig
7839f66540 Reland "Rename getTopDevice/getDevice to topDevice/baseDevice"
This reverts commit d8b939e0b4.

Reason for revert: fix SkAndroidFrameworkUtils getDevice() reference

Original change's description:
> Revert "Rename getTopDevice/getDevice to topDevice/baseDevice"
>
> This reverts commit 632a23afa4.
>
> Reason for revert: breaking android roll
>
> Original change's description:
> > Rename getTopDevice/getDevice to topDevice/baseDevice
> >
> > This addresses nit from https://skia-review.googlesource.com/c/skia/+/344663
> > and also moves topDevice() to be private, since it's not really meant
> > for arbitrary subclasses to access anyways. Classes outside of SkCanvas
> > that need topDevice/baseDevice are already friended anyways.
> >
> > Bug: skia:10987
> > Change-Id: Ib0b0dffb5b1c35d5a0c78aeb8903e4cf0b8810a9
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344960
> > Reviewed-by: Mike Klein <mtklein@google.com>
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
>
> TBR=mtklein@google.com,reed@google.com,michaelludwig@google.com
>
> Change-Id: I9b70230f7db5d31cede2ea03e7abc7c154021204
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10987
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345158
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Commit-Queue: Derek Sollenberger <djsollen@google.com>

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

# Not skipping CQ checks because this is a reland.

Bug: skia:10987
Change-Id: Ibf6397b54655c25ef3d348210de5eb6dab416723
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345165
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-12-17 01:14:53 +00:00
Mike Reed
85fa75616d Add filtermode to drawnine
Bug: skia:7650, skia:11099
Change-Id: I1e603099d30bd4672cbb6783209bacf4678fa0f3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345156
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-12-16 22:05:43 +00:00
Derek Sollenberger
d8b939e0b4 Revert "Rename getTopDevice/getDevice to topDevice/baseDevice"
This reverts commit 632a23afa4.

Reason for revert: breaking android roll

Original change's description:
> Rename getTopDevice/getDevice to topDevice/baseDevice
>
> This addresses nit from https://skia-review.googlesource.com/c/skia/+/344663
> and also moves topDevice() to be private, since it's not really meant
> for arbitrary subclasses to access anyways. Classes outside of SkCanvas
> that need topDevice/baseDevice are already friended anyways.
>
> Bug: skia:10987
> Change-Id: Ib0b0dffb5b1c35d5a0c78aeb8903e4cf0b8810a9
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344960
> Reviewed-by: Mike Klein <mtklein@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

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

Change-Id: I9b70230f7db5d31cede2ea03e7abc7c154021204
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10987
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345158
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2020-12-16 21:42:05 +00:00
Michael Ludwig
632a23afa4 Rename getTopDevice/getDevice to topDevice/baseDevice
This addresses nit from https://skia-review.googlesource.com/c/skia/+/344663
and also moves topDevice() to be private, since it's not really meant
for arbitrary subclasses to access anyways. Classes outside of SkCanvas
that need topDevice/baseDevice are already friended anyways.

Bug: skia:10987
Change-Id: Ib0b0dffb5b1c35d5a0c78aeb8903e4cf0b8810a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344960
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-12-16 18:31:06 +00:00
Michael Ludwig
887ac49f9e Always use AutoLayerForImageFilter
This definitely simplifies the drawing code, but always copies the input
SkPaint so that it can be modified if necessary. If we get perf hits, we
can just revert this. We could keep it using a copy-on-write, but with
this change, I believe we've removed the majority of instances of
SkCopyOnWrite<SkPaint> inside SkCanvas. There's just one LatticePaint
struct that's overly complex for what it does that I can clean up next.

A middle ground would be to keep the copy-on-write behavior, but drop
the branch on image-filter. Given the lack of perf needle movement on
some of the other simplifications that avoided technically unnecessary
paint copies, I doubt it's worth the complexity.

As part of this change, since the draw calls no longer branch based on
the presence of an image filter, the AutoLayerForImageFilter takes over
calling predrawNotify() in its various forms. We don't have to follow
through with that, if we'd rather have the notification be called out
explicitly within the draw call itself. I've found it easy to forget to
call predrawNotify(), or keep it in the right place while updating draws
so I may be biased.

Bug: skia:10987
Change-Id: I5204c175aae691f82cc45f3d9a04ef64dee5d80f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342920
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-12-15 15:38:19 +00:00
Michael Ludwig
f79b298b9d Remove UPDATE_DEVICE_CLIP macro
Folds the update of fQuickRejectBounds into the destructor of the Auto
object. So it's still a little magical, but less so than a macro.

Bug: skia:10987
Change-Id: I275b21718291c353e889da77e1e56ee6a0dbb72c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342922
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-12-14 20:04:07 +00:00
Brian Salomon
bdbfcd2374 Revert "Revert "Add new SkCanvas methods for Android Framework WebView queries.""
This reverts commit f760258654.

This version doesn't assume SK_BUILD_FOR_ANDROID_FRAMEWORK implies SK_SUPPORT_GPU

Cq-Include-Trybots: luci.skia.skia.primary:Canary-Android
Change-Id: Ib1d983d76f3258ed84aa2d6ef4a5cddf7f342cf3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343578
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-12-14 17:54:13 +00:00
Brian Salomon
f760258654 Revert "Add new SkCanvas methods for Android Framework WebView queries."
This reverts commit 14a25eff99.

Reason for revert: breaking android roll.

Original change's description:
> Add new SkCanvas methods for Android Framework WebView queries.
>
> Existing queries will be deleted after Android framework update.
>
> This puts the queries behind SK_BUILD_FOR_ANDROID_FRAMEWORK and
> removes the need for the framework to hop through multiple levels
> of abstraction to get to the FBO info.
>
> Change-Id: Ia016b0d3044c803603e36bc1c5e1a644f50a7eaf
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343417
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Stan Iliev <stani@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=egdaniel@google.com,bsalomon@google.com,reed@google.com,stani@google.com

Change-Id: I40ac3b7eec101c246cc41a40d930b9a03ece3264
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343519
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-12-11 20:25:11 +00:00
Brian Salomon
14a25eff99 Add new SkCanvas methods for Android Framework WebView queries.
Existing queries will be deleted after Android framework update.

This puts the queries behind SK_BUILD_FOR_ANDROID_FRAMEWORK and
removes the need for the framework to hop through multiple levels
of abstraction to get to the FBO info.

Change-Id: Ia016b0d3044c803603e36bc1c5e1a644f50a7eaf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343417
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Stan Iliev <stani@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-12-11 17:47:40 +00:00
Mike Reed
f7cce2b243 Remove dead code (from old flags)
"SK_SUPPORT_LEGACY_CANVASMATRIX33",
  "SK_SUPPORT_LEGACY_MATRIX_FACTORIES",
  "SK_SUPPORT_LEGACY_SCALEPIXELS_PARAM",

Change-Id: I6e20ba7c553317ce0c2c0c3a6d6706a3555dd51c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343112
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-12-11 02:35:49 +00:00
Brian Salomon
eebe735dea GrRenderTargetContext->GrSurfaceDrawContext
Just the class/files. variable names and additional comments to follow.

Change-Id: Ic03d07fd5009eaf3d706c2536486a117328963fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342617
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-12-10 18:51:19 +00:00
Michael Ludwig
31dd1f8de8 Remove SkDrawIter entirely
SkDrawIter goes away, as well as the DRAW_BEGIN, DRAW_END, and
FOR_EACH_TOP_DEVICE macros. A new macro TOP_DEVICE is added that
simplifies checking for a null device (which is currently only possible
if SkCanvas::init() was called with null). The intent is that this will
be replaced with just "this->getTopDevice()->" in the future.

The rest of the auto-layer magic that happened in DRAW_BEGIN is now
explicitly written out in the draw functions. Additionally, it has
been updated to check for an image filter. When there's no image
filter, it completely bypasses the construction of the AutoLayer object.

This extra check maybe isn't worth the code complexity, but some draw
methods had previously followed this pattern, so presumably stack
allocating the AutoLayer had some overhead in tight draw loops.

Bug: skia:10986, skia:10987
Change-Id: I9c48fe4645a6d2b46e1d0006a669fd073c0e1478
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341161
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-12-10 18:33:39 +00:00
Michael Ludwig
9a6cece5a8 Simplify layer management in SkCanvas
This pares back SkDrawIter (will go further in follow-up CL) to take
advantage of no more unclipped layers. The canvas no longer needs to
maintain its own inline DeviceCM, but MCRec can point to a hidden
Layer struct. The first MCRec doesn't have a Layer (since there's
nothing to restore to), but gets its device from the explicitly
represented base device of the SkCanvas.

Bug: skia:10987, skia:10986
Change-Id: Ib004dfca42e4ccabe5f43b756d80f8eaa3f64e19
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341160
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-12-09 01:03:23 +00:00
Michael Ludwig
f639a24c50 Consolidate quick reject / paint bounds logic into helper function
Bug: skia:10987
Change-Id: I149bbe33b79848e010c35c94482131fd301f7837
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/339992
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-12-08 01:41:50 +00:00
Mike Reed
198e6ea3f9 add new entry-points for drawImage[rect] with samplingoptions
Change-Id: Icc2c2e4affbf4c4dba1983b069351f33487af81b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/339116
Reviewed-by: Florin Malita <fmalita@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-12-07 19:39:30 +00:00
Michael Ludwig
f326e4faef Remove SkCanvas::LayerIter used in SkCanvasStateUtils
The LayerIter existed to iterate over the top-most device and any
unclipped layers connected to it. With unclipped layers gone,
SkCanvasStateUtils can just access the top-most device using other
APIs.

Bug: skia:10986
Change-Id: I260ec37fcc8e39d1ec2972a3297521d714649cb5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/339991
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2020-12-05 17:21:53 +00:00
Michael Ludwig
e0dee01043 Remove support for deprecated kDontClipToLayer_SaveLayerFlag
This removes the conditional behavior based on #defines, and the private
flag definitions. It removes GMs and updates tests that tested the
feature. Follow-up CLs will go through and simplify the internals of
SkCanvas to take advantage of this support removal.

Bug: skia:10986
Change-Id: Id42c9e7d134dd06507fabf6577e7872942ef9077
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/339988
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-12-05 00:00:13 +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
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
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
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
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
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
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
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
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
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
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