Commit Graph

6773 Commits

Author SHA1 Message Date
Brian Osman
cf4ec506ec Convexity checker: Wait for significant x-product when walking edges
This effectively re-applies the logic from
https://codereview.chromium.org/298973004

The change to the unit test for 389050 is interesting.
The last convexity rewrite "fixed" that case by allowing
it to be detected as convex. In the process, it actually
broke the original bug, so that rendering of the HTML
failed. This CL causes us to give up and decide that the
path is concave, but we return to rendering correctly, so
that's a win.

The bug that initiated this (950508) is effectively the
exact same bug as 2235, which is why I haven't added a new
test case. The existing test case is much more concise than
the 100K data file needed for the new one.

Bugs: skia:2235 chromium:389050 chromium:950508
Change-Id: I0de65db8644f37e335c47e9d41c676b8e8b020fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209164
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-04-19 18:01:54 +00:00
Ethan Nicholas
cb0f409af4 added error detection for writing to a constant swizzle mask
Bug: oss-fuzz:14089
Change-Id: Ie5c51c2de8b9a53aebfae19373cc5a3d7d8e594b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209325
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-04-19 16:54:34 +00:00
Brian Osman
309de7904d Remove SK_TREAT_COLINEAR_DIAGONAL_POINTS_AS_CONCAVE
This was rebaselined and removed from Chrome long ago.
Planning to fix more bugs in the Convexicator, but want
to get this out of the way first.

Change-Id: I4f299d56a81be509a861d1e9c9f0e48a47170096
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209322
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-04-19 14:11:49 +00:00
Brian Osman
14ac42b280 Remove the axis-aligned vector special case to convexity checker
There are bugs in the other code path that will require more state,
and maintaining this special case in parallel is going to be tricky.

Change-Id: I0083b0aa2af16391504f0993e765faa0f5522502
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209163
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-04-18 17:50:37 +00:00
Ben Wagner
2c2240f668 Make more SkTypeface virtuals pure.
This ensures that proxy typefaces are really proxying these calls. Also,
sometimes the defaults aren't really the right thing.

Change-Id: Ifac417452136adca8152f4cd7670fd40553bd3b6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209105
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-04-18 15:38:56 +00:00
Robert Phillips
396673870c Non-substantive changes
These changes are pulled out of:

https://skia-review.googlesource.com/c/skia/+/208227 (Implement alternate method for determining recycle-ability of allocated GrSurfaces)

Change-Id: I1126f0e0c149d07f5febb352c4e86a676960409f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209103
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-04-17 20:43:33 +00:00
Greg Daniel
e6bfb7daf0 Add struct to wrap all the gpu flush options.
Bug: skia:8802
Change-Id: Ia92807034a8f54067cead59e29c233f91e11f175
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208674
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-04-17 20:03:29 +00:00
Mike Reed
64670cb1b8 Reland "Simplify SkTypeface::charsToGlyphs API to require UTF32 input"
This is a reland of fde841de44

Original change's description:
> Simplify SkTypeface::charsToGlyphs API to require UTF32 input
> 
> Change-Id: I486713c496c40103eef13fa6068ac4d69e32f606
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207865
> Commit-Queue: Ben Wagner <bungeman@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>

Change-Id: I5162c93b3ea6146d09334545744b791d993397b8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208679
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-04-17 17:56:39 +00:00
Brian Salomon
105d7c24c9 Add flag to map buffer flags in GrCaps to indicate whether mapping a
GrGpuBuffer for reading is synchronous or not.

Update transfer-from test to not call GrGpu->finishFlush() when maps
are synchronous.

Bug: skia:8962
Change-Id: I5eb003081725e5199157473faf7f916a65408dc8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208509
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-04-17 17:34:18 +00:00
Robert Phillips
33906ad1e2 Reland "Revert "Simplify SkTypeface::charsToGlyphs API to require UTF32 input""
This reverts commit 652b007a4c.

Reason for revert: Potentially causing Google3 errors

Original change's description:
> Revert "Revert "Simplify SkTypeface::charsToGlyphs API to require UTF32 input""
> 
> with legacy guard for google3
> 
> Needs this to land first: https://critique.corp.google.com/#review/243924283
> 
> This reverts commit 70ed05e53a.
> 
> Change-Id: I3e821dfcdbf3004382092338ebad7cceaf40cefd
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208668
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>
> Auto-Submit: Mike Reed <reed@google.com>

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

Change-Id: Id2b3ed8a6157b5e33721b0c5168c5680bfac15b0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208669
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-04-17 12:03:53 +00:00
Mike Reed
652b007a4c Revert "Revert "Simplify SkTypeface::charsToGlyphs API to require UTF32 input""
with legacy guard for google3

Needs this to land first: https://critique.corp.google.com/#review/243924283

This reverts commit 70ed05e53a.

Change-Id: I3e821dfcdbf3004382092338ebad7cceaf40cefd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208668
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-04-17 03:08:40 +00:00
Mike Reed
70ed05e53a Revert "Simplify SkTypeface::charsToGlyphs API to require UTF32 input"
This reverts commit fde841de44.

Reason for revert: used in headless on google3, need to add a guard

Original change's description:
> Simplify SkTypeface::charsToGlyphs API to require UTF32 input
> 
> Change-Id: I486713c496c40103eef13fa6068ac4d69e32f606
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207865
> Commit-Queue: Ben Wagner <bungeman@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>

TBR=bungeman@google.com,herb@google.com,reed@google.com

Change-Id: I1d28ed5c31deaa76aa3c4b627454b0ad3356a6fc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208800
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-04-17 00:02:12 +00:00
Mike Reed
fde841de44 Simplify SkTypeface::charsToGlyphs API to require UTF32 input
Change-Id: I486713c496c40103eef13fa6068ac4d69e32f606
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207865
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-04-16 21:34:10 +00:00
Mike Klein
9a885b27f3 pass SkVx::Vec arguments as const&
Yet another surprising finding when looking at ARM code generation is
that passing these values to functions by const& does make a difference,
even when fully inlined.  I can only guess that the compiler's somehow
more sure that way that the values won't change?  Anyway, convert all
skvx functions that take Vec arguments to take const Vec& instead.

This tweak is enough to let the natural implementation of mull()
actually produce good code generation, so I've promoted that to SkVx.h
and added a unit test.  Notice in the NEON case we've got a base case at
N=8 and two recursive cases, one down to 8 as usual when N > 8, but also
one up to 8 when N < 8.

This also is another big speedup for ARMv7 NEON, bringing it to nearly
the same speed as ARMv8 NEON on the same device.

Bug: chromium:952502
Change-Id: I0f19bab45cf02222ccc8090053ea2a4a380f1dfe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208582
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-04-16 19:24:50 +00:00
Greg Daniel
4aa13e7da3 Remove deprecated SkSurface::prepareForExternalIO and related uses of the name.
In a future CL I intend to use prepareForExternalIO to be a specific operation
to do to an SkSurface/SkImage so this is a pre CL that removes our use of that
phrase when related to flushing.

Bug: skia:8802
Change-Id: I3efe4c4061fe962e2fc1339185feb5ded6e23005
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208223
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-04-16 14:08:09 +00:00
Brian Salomon
26de56ef09 GrSurface -> GrGpuBuffer transfer improvements:
GrCaps now only provides the offset alignment requirement. The row bytes
is always bpp * width.

GrGpu::transferPixelsFrom now just returns bool since row bytes value is
implicit. It now asserts offset is aligned with GrCap's provided value
in base class.

Implement caps for GL.

Bug: skia:8962
Change-Id: I3299b62efe9fe05bfe02f2a6a4c2704f647d0f8a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206686
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-04-16 14:05:34 +00:00
Brian Osman
6c431d5202 Towards a simpler SkSL -> GLSL pipeline (and better shader reflection)
The pretty printer didn't actually need the original (separate) strings,
so make it just operate on a single SkSL::String. Also remove the unused
line numbering, and the unit test. (Testing of test code, yay!)

With that done, cut down on passing around arrays of char* + length, and
just do the compaction to a single SkSL::String in the program builder.

Change-Id: Ieef9d9a8e3c5620c011b17477f1b0f9a9faa6273
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208226
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-04-16 13:49:17 +00:00
Mike Reed
194cab0fd3 use slope-guess for faster charToGlyph
Made up a threshold between linear and slope searching.
For a count of 100 here are the before and after timings.
The first two lines are being changed. The latter 2 are
the native look-ups for mac.

Before

  15/15  MB	115	2.33µs	2.34µs	2.34µs	2.34µs	0%	▆▁▄█▇▇▂▄█▆	nonrendering	cmap_findcache_charToGlyph
  15/15  MB	66	3.47µs	3.48µs	3.49µs	3.55µs	1%	█▁▁▁▂▁▁▁▁▄	nonrendering	cmap_addcache_charToGlyph
  15/15  MB	1	1.1µs	1.13µs	1.21µs	1.98µs	22%	█▂▁▁▁▁▁▁▁▂	nonrendering	cmap_face_charToGlyph
  15/15  MB	190	1.09µs	1.1µs	1.19µs	1.64µs	17%	▁▁▁▆█▁▁▁▁▁	nonrendering	cmap_font_charToGlyph

After

  15/15  MB	447	448ns	449ns	448ns	449ns	0%	▂▅█▅▁▆█▂▁▆	nonrendering	cmap_findcache_charToGlyph
  15/15  MB	95	2.79µs	3.03µs	3µs	3.06µs	3%	▇▇▇▇▇███▄▁	nonrendering	cmap_addcache_charToGlyph
  15/15  MB	1	1.15µs	1.16µs	1.25µs	1.99µs	21%	█▂▁▁▁▁▁▁▁▁	nonrendering	cmap_face_charToGlyph
  15/15  MB	186	1.09µs	1.1µs	1.12µs	1.27µs	5%	█▁▁▁▂▁▁▁▁▁	nonrendering	cmap_font_charToGlyph


Bug: skia:
Change-Id: If7da4eef3cce248393815071f342607f0c8140bb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208044
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-04-15 19:35:59 +00:00
Greg Daniel
a3aa75ab29 Add callback to flush for knowing when gpu is finished work.
Bug: skia:8802
Change-Id: I093c2a4e879b635b169a849d9af3e9f7a3d84a88
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207870
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-04-15 13:52:28 +00:00
Robert Phillips
831a29341c Plumb sk_sp through the GrOpList class hierarchy
This is preparing the ground for having proxies be atomically reffed

Change-Id: Ice48c41120d4ec10a758f696a69028b6363e8a7e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207762
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-04-15 12:21:45 +00:00
Mike Reed
0c60708737 add utility for caching char2glyph
Try: out/release/nanobench --match _charToGlyph

Pseudo plan to use this:
- attach to whatever typeface backends need it (probably just freetype)
- have a purge/limiting scheme (e.g. only cache N entries)
- if we care, make the search fancier (e.g. binary, slope, etc.)

Bug: 951647
Change-Id: Ib1042ca5891d2742499faf1314579c402121a855
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207703
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-04-13 00:03:58 +00:00
Mike Reed
bb85b8b3f3 remove dead code from old factories, enum
Change-Id: I12d46c2c60539689949a08636c3a654d2298285a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207868
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-04-12 17:11:25 +00:00
Ben Wagner
f55fa0d0cf Make SkPaintFilterCanvas paints no longer COW.
The two existing external users of SkPaintFilterCanvas always end up
making a copy of the paint when the canvas is in use. As a result, the
extra overhead of doing COW is being wasted. In general, it seems easier
for users to optimize by simply not using the filter canvas when it
won't be making any changes. Also, no users are using the 'Type'.

After users are updated to this new API, the old onFilter can be
removed.

Change-Id: Iee1ce3cd22bce8c00664de078375b105abd7c866
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/149806
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-04-11 22:42:13 +00:00
Mike Klein
1dcc55b372 rewrite new SkVx unit test
- be more explicit about casting
 - general rewrite for clarity

Cq-Include-Trybots: skia.primary:Test-Win2016-MSVC-GCE-CPU-AVX2-x86_64-Debug-All-MSRTC
Change-Id: I924d6d247e6b9afcefb27c690715fdad84635a5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207721
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-04-11 19:14:04 +00:00
Mike Klein
4b44a0d01a add SkVx helpers for working with unorm8
These replicate the base logic of Sk4px::Wide::div255() and
Sk4px::approxMulDiv255(), and will come in handy replacing them.

No platform specializations yet... want to remind myself what
codegen they get from these vanilla versions first, and then
I'll fill in the platform specific stuff as needed.  The tests
should cover everything pretty exhaustively.

Change-Id: I5854d1bc0902a85cbb2351f669c4da7cc31a8775
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207683
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
2019-04-11 17:54:23 +00:00
Ben Wagner
25e371f7ee Make SkFontMgr_fontconfig respect the sysroot.
An FcConfig has the concept of a sysroot against which file names should
be resolved. Add support for this so that it is possible to use
relocatable FcConfigs. Also adds a test that this works.

Change-Id: I523d5fb1233830434a88dc52b27728aaf83bb5a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206278
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-04-11 15:42:20 +00:00
Greg Daniel
b9990e4492 Add more general flush call to GrContext.
This is to match the current features of SkSurface::flush and to prepare
for adding additional features to flush.

Bug: skia:8802
Change-Id: I5d68272e1277b416af357e6ffaf426841ceda943
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207301
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-04-10 21:19:10 +00:00
Mike Reed
e3f17b911f remove SkMixer, since we have explicit lerps/blends in SkShader
Change-Id: I937861df9d8ae89c0587ea59dd740989bebd35a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207305
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-04-10 20:59:30 +00:00
Jim Van Verth
9896a0d790 Add mipmap generation for Metal
Bug: skia:8243
Change-Id: Id71073dffe6e2b42d099f0c92059b53c48b46c4f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206717
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-04-10 20:19:00 +00:00
Mike Klein
da7b053527 tweak SkVx to play nicely with others
Was starting to use this and ran into a few problems with clashing
symbols, namely SI and cast().  Seemed simple enough to not use SI,
and to move all the free-standing types into skvx: skvx::cast,
skvx::shuffle, etc.

Change-Id: Ia5d8ef6d0ae5375bf80d76be88d16f0c9cde56e7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207340
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-04-10 19:40:05 +00:00
Ethan Nicholas
21a9b56fc2 moved files generated from .fp files into generated/ directories
Bug: skia:
Change-Id: I8605cdfcc0b1c56c23a6075c7fe188ab7384681c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207221
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-04-10 18:02:02 +00:00
Brian Salomon
a585fe9a74 Add Vulkan implementation of transfering from GrSurface to a GrGpuBuffer
Bug: skia:8962
Change-Id: I3796bef5a9e1af741b933afc78e32effb2b57a4a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206703
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-04-10 15:28:30 +00:00
Robert Phillips
9313aa77e1 Skip flush in GrDrawingManager if the specifed proxy doesn't have any work (take 2)
This is rather ham-fisted but I would like to have a short-term fix for the "always-flush" perf regressions.

Change-Id: I508e2d725ac18f50318baf31bc3243fe932c724b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206697
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-04-10 13:55:01 +00:00
Brian Salomon
42cbedd3c7 Temporarily make TransferPixelsFromTest read BGRA as RGBA on ES.
Remove disable of transfer support on Tegra.

Longer term we want GrGLGpu to handle the swizzle to BGRA after reading
RGBA. However, deferring that work to be part of color-type/format
refactoring.

Bug: skia:8962
Change-Id: Ib1d75fe0330aaaa02330724e58a1374129274a8f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206699
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2019-04-09 19:33:30 +00:00
Mike Reed
c8bea7deb6 New factories for SkShaders
Bug: skia:8937
Change-Id: Ic253b70fbf89059321185912aa771b1c1de7d231
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206693
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-04-09 19:15:01 +00:00
Ethan Nicholas
bcd51e8e6d SkSL 'key' variables can now be controlled by 'when' expressions
Bug: skia:8880
Change-Id: I075ef57035b37250196d85bc6767eb877e445aa2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206698
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-04-09 17:46:56 +00:00
Mike Reed
b286bc2da8 Introduce new factory for SkColorFilters
Idea: transition callers to this, so we can later typedef SkColorFilter
and SkShader to the same thing.

Bug: skia:8937
Change-Id: I000c882e11622091aa44c141aa6ddd1216414f46
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206685
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-04-08 21:03:59 +00:00
Brian Salomon
e05ba5a0db Start on supporting transfer from GrSurface.
This only implements the GrGpu level functionality and is not exposed in
the public API.

Currently implemented for OpenGL only.

Bug: skia:8962

Change-Id: I8e58c1860185aa913bcdb0954908ce9e0b8e78f3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206383
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-04-08 18:28:24 +00:00
Mike Reed
50acf8f04b add makeShader() to SkBitmap, and deprecate SkShader version
Bug: skia:8937
Change-Id: I42f011e04937a751222bd8ecc6c69b45cf9626a2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206681
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2019-04-08 17:56:34 +00:00
Khushal
add8cf90b2 remote fonts: Validate format on deserialized glyph.
R=mtklein@google.com, herb@google.com

Bug: 949000
Change-Id: Ib17635ea34db80987a1f2b3c0e6fcc33ab2b7a6b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206173
Commit-Queue: Khushal Sagar <khushalsagar@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Auto-Submit: Khushal Sagar <khushalsagar@chromium.org>
2019-04-05 20:07:10 +00:00
Malay Keshav
e4628b1072 Make SkRRect work with axis aligned rotation transforms
This patch allows SkRRect::trasform() work with any axis aligned matrix
transform meaning it now works with a rotation of 90 or 270 degrees.

Adds relevant unit tests.

Bug: skia:8944
Change-Id: I63678ec0e3556c181517526de55d84666afeb681
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205860
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-04-04 18:43:30 +00:00
Brian Salomon
d538d3df27 Handle promise texture image fulfill returning nullptr.
Bug: chromium:948249
Change-Id: Id5d9b732a0d9612b7ed562041fa3544fd7c39f71
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206076
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-04-04 18:04:19 +00:00
Brian Salomon
8cefa3ed35 Avoid flushing due to cache pressure when nothing will become purgeable.
Bug: skia:8927
Change-Id: I3d92868ebf133ebbf229a9349a0194a9ffe35ad0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205921
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-04-04 16:12:59 +00:00
Brian Salomon
2c791fcdf2 Track the number of resources that would become purgeable after flush
in GrResourceCache.

Bug: skia:8927
Change-Id: Ia00ba0ea541a22e29e9a8208044e1fabd5296782
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205484
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-04-03 18:06:08 +00:00
Hal Canary
0f2f522246 SkMD5 returns digest
Change-Id: I9eb9095131adb5862d286b211501bf194ef8e91e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205822
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-04-03 17:52:22 +00:00
Brian Osman
fbe2406693 Reland "Remove the NullGL interface (and associated test context)"
This reverts commit 215da624d1.

Reason for revert: Blink issues ironed out.

Original change's description:
> Revert "Remove the NullGL interface (and associated test context)"
> 
> This reverts commit de206c75c2.
> 
> Reason for revert: Chrome is having issues with the switch to Mock in blink tests.
> 
> Original change's description:
> > Remove the NullGL interface (and associated test context)
> > 
> > Bug: skia:
> > Change-Id: Ie3c9ee39fc1e0a4406de085c60d8433ffb4419df
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203708
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Brian Osman <brianosman@google.com>
> 
> TBR=bsalomon@google.com,robertphillips@google.com,brianosman@google.com
> 
> Change-Id: Iff0cbf29dcea26957efc800a8c33d0ad8285de0a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205343
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

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

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

Bug: skia:
Change-Id: I1f4fbbcb00f302c5d830cb1392badd6ec7a33c69
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205832
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-04-03 16:38:10 +00:00
Mike Reed
fae8fceb4a Use SkTileMode instead of nested enum
Add guard to transition clients

Change-Id: Ia7a3e8f95722f91e84af262168dadf89a78707da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205720
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-04-03 15:24:18 +00:00
Brian Salomon
01ceae9352 Control access to adding ref to a GrGpuResource when it's ref count is zero.
We want GrResourceCache to be able to track which resources are held by
refs (as opposed to pending IOs) so that it can track the affect of
flushing on resource purgeability. Therefore, all cases that can add the
first ref to a GrGpuResource must funnel through GrResourceCache. This
lays the groundwork by restricting initial refs.

No-Presubmit: true
No-Tree-Checks: true
No-Try: true

Bug: skia:8927
Change-Id: I1213c3db258d2412df6666e3222419211ceaa192
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205482
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-04-03 13:16:23 +00:00
Mike Reed
e25b4472cd Move SkTileModes to top level
- move shader factories to their host (e.g. picture->makeShader)

More to do to formally deprecated SkShader::TileMode

Bug: skia:8937
Change-Id: I101e42fb9fba4ab91d028a34888f1fde16fdece4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205589
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-04-03 00:18:35 +00:00
Brian Osman
4428f2c39f Remove SkScalarSinCos
This differed from the separate versions in that it snapped to zero.
It was also strictly worse than calling the two separate versions.
Most clients don't need the snapping, so just call the two existing
functions. For clients that need the snapping, call new variants of
each that do snap.

Change-Id: Ia4e09fd9651932fe15caeab1399df7f6281bdc17
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205303
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-04-02 15:46:57 +00:00