Commit Graph

10836 Commits

Author SHA1 Message Date
Mike Reed
ac9f0c9e27 Bitmap.asImage()
... and lots and lots of IWYU

Change-Id: Ie5157dcdd2e6d29b95c71b39153278ab48ef4eb3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346778
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-12-23 15:54:57 +00:00
John Stiles
7df731bcfd Reland "Add support for range-based for loops to SkTHashSet/Map."
Updated Pair type in SkTHashMap to derive from std::pair to fix C++14
issues with structured bindings.

Original change's description:
> Add support for range-based for loops to SkTHashSet/Map.
>
> This allows loops over SkTHashes to break in the middle, and also
> removes the need to use lambda captures to bring variables inside the
> loop's scope.
>
> Change-Id: Ief55d776b2c57a44b24cfe1c94493a5d514791c8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346496
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

Change-Id: I2ac5b2c59e70ed0ec3b42b32e7994d6bcdf56b40
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346502
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-12-22 20:53:53 +00:00
Michael Ludwig
a18613d120 Add halfWidth/halfHeight functions to SkRectPriv
These effectively compute width/2 or height/2, but switch operations
around so that it's less likely to overflow on finite rects that would
have overflows in width or height.

Bug: skia:1160678
Change-Id: Ic93ca0c1d12598163b3dd48a5e8ba0ac7903301f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344968
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-12-22 20:42:43 +00:00
Adlai Holler
7689319271 Revert "Yank out old reduceOpsTaskSplitting code"
This reverts commit dfc880bd9b.

Reason for revert: chromium:1146701

Original change's description:
> Yank out old reduceOpsTaskSplitting code
>
> The behavior previously triggered by this flag is reimplemented
> in review.skia.org/345168 . The current implementation isn't used
> and can't really be used safely because it may go over the
> GPU memory budget.
>
> Bug: skia:10877
> Change-Id: I2759c688aa60a618ef76dfec0a49ef5e5f0a9afc
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345477
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Auto-Submit: Adlai Holler <adlai@google.com>

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

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: skia:10877 chromium:1146701
Change-Id: I90cdd16eaf033b816f2d1830fd0ee72fdc0ec74b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346777
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-12-22 20:29:52 +00:00
John Stiles
dd690af373 Revert "Add support for range-based for loops to SkTHashSet/Map."
This reverts commit 5d00e15625.

Reason for revert: tree breakage on Chromebook standard lib

Original change's description:
> Add support for range-based for loops to SkTHashSet/Map.
>
> This allows loops over SkTHashes to break in the middle, and also
> removes the need to use lambda captures to bring variables inside the
> loop's scope.
>
> Change-Id: Ief55d776b2c57a44b24cfe1c94493a5d514791c8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346496
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

TBR=mtklein@google.com,johnstiles@google.com

Change-Id: I165872ac41f66f3b3255cf8970626392e5283412
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346500
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-12-22 15:35:03 +00:00
John Stiles
5d00e15625 Add support for range-based for loops to SkTHashSet/Map.
This allows loops over SkTHashes to break in the middle, and also
removes the need to use lambda captures to bring variables inside the
loop's scope.

Change-Id: Ief55d776b2c57a44b24cfe1c94493a5d514791c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346496
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-12-22 15:10:42 +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
Leon Scroggins III
e42716032b SkAnimatedImage: Always respect exif orientation
No known clients (CanvasKit, Android) want to ignore the exif
orientation in an animation.

A follow-on CL will deprecate SkAndroidCodec::ExifOrientation, leaving
it up to the client (e.g. SkAnimatedImage, hwui/ImageDecoder) to
handle the orientation. Add SkEncodedOriginSwapsWidthHeight to assist
clients to do so.

Update stoplight_animated_image GM. It previously showed using
SkAnimatedImage without respecting the orientation, which is no longer
supported. The new version replaces the left half of the image with the
right.

Remove assert that is no longer true. Originally, an SkAnimatedImage was
"simple" if it did not have a crop or postProcessor. This is no longer
true if has an exif orientation. Add a test that calls the simple
constructor and verifies it does not crash.

Change-Id: I421fd02700f220fb90458cd03c4431dee7daf399
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344762
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-12-21 16:39: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
e78f8cebca Starting to hide setFilterQuality
Bug: skia:7650
Change-Id: I511859e9b34af21d351db87b658dad970f0802a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345171
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-12-19 20:56:50 +00:00
Brian Salomon
7bfdb10449 Revert "Enable GrTessellationPathRenderer by default"
This reverts commit 6ea387e7c7.

Reason for revert: valgrind failing

Original change's description:
> Enable GrTessellationPathRenderer by default
>
> Moves GrTessellationPathRenderer to the end of the chain and enables
> it by default.
>
> Also updates nvpr to not draw volatile paths. The tessellator is much
> faster at these.
>
> Bug: skia:10419
> Change-Id: I97ca7d4d1dff65fc9d4040c267f9808c8c33b548
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344377
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,csmartdalton@google.com

Change-Id: I3718ae210ebc403959d187160214cf0df895e4f5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10419
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345718
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-12-18 15:46:30 +00:00
Adlai Holler
dfc880bd9b Yank out old reduceOpsTaskSplitting code
The behavior previously triggered by this flag is reimplemented
in review.skia.org/345168 . The current implementation isn't used
and can't really be used safely because it may go over the
GPU memory budget.

Bug: skia:10877
Change-Id: I2759c688aa60a618ef76dfec0a49ef5e5f0a9afc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345477
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-12-18 01:14:20 +00:00
Chris Dalton
6ea387e7c7 Enable GrTessellationPathRenderer by default
Moves GrTessellationPathRenderer to the end of the chain and enables
it by default.

Also updates nvpr to not draw volatile paths. The tessellator is much
faster at these.

Bug: skia:10419
Change-Id: I97ca7d4d1dff65fc9d4040c267f9808c8c33b548
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344377
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-12-17 19:33:56 +00:00
Brian Osman
0a442b71b0 New SkSL code generator that emits directly to skvm
Still TODO:
- Function calls. Can do these by inlining everything (recursively).
- Additional flow control: ES2 for loops can be supported (via
  unrolling), and switch() can be implemented. (Was never done in
  ByteCode).
- Uniforms and params have been set up to work very generically (caller
  just supplies IDs, the generator collates everything into a master
  working list). Builtins should work the same way (caller supplies a
  map of builtin ID -> skvm::Val[]?), so that we don't need a special
  case for device coord.
- Figure out integer type policy. Today, it's a mix of only supporting
  signed integers, and just treating all integers as signed, even if
  they're not.
- Now that defining intrinsics is *much* simpler, stop defining so many
  of them in sksl_public.sksl, and just implement them here.

Change-Id: Id9771444ce54ccf8e6e408c44ebb3780c1170435
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341980
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-12-17 19:16:25 +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
Brian Salomon
01ff5384bf Support luminance-alpha GL format for YUVA planes
Bug: skia:10632
Change-Id: Ic91510b55644c15ee4eb5f96e7c35193b5ce49df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344761
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-12-17 14:54:25 +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
Brian Salomon
590f567291 Add GrSurfaceFillContext
This is a new base class for GrSurfaceDrawContext. It allows any
alpha-type but is restricted to non-blending fills of irects using FPs,
clears,and discards.

Bug: skia:11019

Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341680
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Change-Id: I696df3617719fcd8303faa73fb44b32b3fb4f71c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344896
2020-12-16 20:48:43 +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
Jim Van Verth
63f0354b6d Add support for directional lights.
Adds a new kDirectionLight_ShadowFlag which indicates that lightPosition
is a vector pointing towards the light, and lightRadius is the blur
radius when the occluder is at z == 1. For other values of z it will
scale linearly. The direction is specified in device space.

Bug: skia:10781
Change-Id: I14d530f006e5541ed6e22bfbeb29c7441c21fb8e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321792
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-12-16 16:58:26 +00:00
Brian Salomon
0263bff0d2 Revert "Add GrSurfaceFillContext"
This reverts commit b339bbe9dc.


Revert "Make backend allocation tests avoid alphatype conversions"

This reverts commit 177af6f410.

Bug: skia:11019
Change-Id: Id80aa7df4a15c8530a609c49ca6264bce7831852
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344569
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-12-16 14:49:56 +00:00
Chris Dalton
15f51848df Reland "Disable HW tessellation shaders by default"
This is a reland of ad8b9fa2d7

Original change's description:
> Disable HW tessellation shaders by default
>
> The GLSL backdoor for tessellation shaders is only experimental at
> this point. In order to enable the tessellation path renderer, we need
> to turn off HW tessellation and let it use the indirect draw modes.
>
> Bug: skia:10419
> Change-Id: Ic979978a331c7ad016907cf42b2562b35caab8ab
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344336
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com
Bug: skia:10419
Change-Id: I0bdf34da134a3a34a5c78b35cc0eb86d6e989bb4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344796
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-12-16 05:08:25 +00:00
Chris Dalton
1c2584d8cc Revert "Disable HW tessellation shaders by default"
This reverts commit ad8b9fa2d7.

Reason for revert: Benchmark failure

Original change's description:
> Disable HW tessellation shaders by default
>
> The GLSL backdoor for tessellation shaders is only experimental at
> this point. In order to enable the tessellation path renderer, we need
> to turn off HW tessellation and let it use the indirect draw modes.
>
> Bug: skia:10419
> Change-Id: Ic979978a331c7ad016907cf42b2562b35caab8ab
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344336
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,csmartdalton@google.com

Change-Id: Ia74dbcec582168870bd3ccc5e52b8dce0fb2bdfc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10419
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344698
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2020-12-15 20:45:46 +00:00
Brian Salomon
b339bbe9dc Add GrSurfaceFillContext
This is a new base class for GrSurfaceDrawContext. It allows any
alpha-type but is restricted to non-blending fills of irects using FPs,
clears,and discards.

Bug: skia:11019

Change-Id: I229ce5f452e66796e2fa5c0e7a6ddccbf23bef5c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341680
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-12-15 19:31:44 +00:00
Chris Dalton
ad8b9fa2d7 Disable HW tessellation shaders by default
The GLSL backdoor for tessellation shaders is only experimental at
this point. In order to enable the tessellation path renderer, we need
to turn off HW tessellation and let it use the indirect draw modes.

Bug: skia:10419
Change-Id: Ic979978a331c7ad016907cf42b2562b35caab8ab
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344336
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-12-15 18:36:44 +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
Mike Reed
5d8f55bfa8 Update last gm to use sampling, hide legacy api
persp_shaders_ gm expected diff (in gpu backends only), due to change
from filterquality (which gpu and cpu interpreted differently for mips)
to samplingoptions (which both backends interpret the same).

Specifically for kMedium:
- gpu treated as SkMipmapMode::kLinear
- cpu treated as SkMipmapMode::kNearest

Bug: skia: 7650
Change-Id: Idc53ad8d01d9c928b425c092b36191153714d347
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343737
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-12-13 00:36:31 +00:00
Mike Reed
82abeceef9 Bitmap should use sampling options
Change-Id: I611969d4707009411f20b74debad7655ac364eb8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343596
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-12-12 15:36:21 +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
Mike Reed
b86cd3d3f0 Use samplingoptions in imageshader
Change-Id: I7d94fe7aed702afd0626a40db201caaf7c2a7764
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342927
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-12-10 21:59:19 +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
Chris Dalton
55abaf5893 Add a stencil test for transparent tessellated strokes
Initially we restricted tessellated stroking to opaque solid colors.
This CL adds support for transparency by enabling a stencil test. The
stencil test also allows us to use mixed samples.

Bug: skia:10419
Change-Id: Ie40f3099d2b009f92ed49f7f43e5f269b1a479af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340798
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-12-10 17:12:38 +00:00
Mike Reed
ddc27d806b Remove cons_moveTo() complexity
... now that we know we can rely on reliable verb sequencing.

Follow-on to https://skia-review.googlesource.com/c/skia/+/342616

Change-Id: If32186ba8a8690812cc1fe03ea71ae29eba4765b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342760
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-12-10 14:01:28 +00:00
Mike Reed
41a98e0a50 Assert that SkPath is always internally consistent
Follow-on to https://skia-review.googlesource.com/c/skia/+/342616

Assuming this survives, we can probably simplify other code in SkPath
(e.g. Iterators) that today worry about consing up moves after close.

Change-Id: I913d6be9c20547267230c287d394fd300b985d31
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342619
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-12-09 23:56:17 +00:00
Adlai Holler
a4bd478bc2 Destroy GrRecordingContext::fAuditTrail last when
In crbug.com/1155871, the audit trail is used during destruction of the
drawing manager.

Bug: chromium:1155871
Change-Id: I74015a033c7620bdad03ac7a3cf5a7ee671482f4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342305
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-12-09 19:10:15 +00:00
Brian Salomon
c1e5fb6207 Rewrite restore_scissor_on_fbo_change
Old workaround was never used by chrome and was insufficient for
SkiaRenderer bug on Adreno 3xx.

Use same name used by Chrome.

Always set the scissor state before every draw/clear when using FBO 0.

Bug: chromium:1152831
Change-Id: Ibf0453d949fa3d5cb964411da3bcc1ec62a3d3a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342076
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-12-09 16:15:09 +00:00
Brian Salomon
8670c98875 Remove SkImage::MakeFromYUVATexturesCopyToExternal
It's no longer used by Chrome.

Inline helper that draws yuva->rgba into the now single use case.

Move yuva proxy making helper from SkImage_GpuBase to SkImage_GpuYUVA
since it is only used there now.

Remove gm that tested the API and associated helper code in YUVUtils.

Bug: skia:10632
Change-Id: If6bd49befa1d1098bb6a268b9d856794f7eb80c3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342077
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-12-09 14:50:19 +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
Mike Reed
99c944647f Add flag to hide non-sampling imageshader factories
Bug: skia:11056
Change-Id: Ic79876106c003f6061cbb50ad2f4a4bf4f446231
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341681
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-12-08 20:33:23 +00:00
Mike Klein
09a26915bd remove SK_BUILD_NO_OPTS
We added this hack years and years ago...
not something we'd do today.

Bug: skia:6592
Change-Id: Ib234dccbf98da8f1075cdcdec274c99c7cf00d78
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341398
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
2020-12-08 19:44:02 +00:00