Commit Graph

136 Commits

Author SHA1 Message Date
Greg Daniel
719239cd69 Move all Ganesh source files into ganesh subdirectory.
Change-Id: I238d29ba0250224fa593845ae65192653f58faff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528156
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-04-07 21:06:50 +00:00
Herb Derby
4397488ce5 add testing code for serialized Slugs
By setting the compile time flag:
SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG_STRIKE_SERIALIZE
will cause all SkTextBlobs to be rendered by analyzing the Slug
to create strike cache differences and serialize the Blob to a Slug.
Then the serialized strike cache differences are used to populate
the strike cache using a different TypefaceIDs using SkTypeface_Remote
as a proxy for the real SkTypeface. This will create a hard break
between the original glyph data, and the proxied glyph data.
It will then deserialize the Slug doing TypefaceID translation to
the SkTypeface_Remote, and draw the unflattened Slug.

Bug: chromium:1278340

Change-Id: I0f1980dee966b1092a99741793aed9d138451f4d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/510228
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-03-16 19:42:16 +00:00
Herb Derby
c25fd021ed change to serialize/Deserialize API
Switch to using the public API similar to SkTextBlob for
serialize/Deserialize. Add deserializeSlug to SkStrikeClient.

Bug: chromium:1278340

Change-Id: I91b93487859c662e3bfdfba49ba4758f13529cd9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/511601
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-02-22 19:03:49 +00:00
Herb Derby
fca03fe881 fix matrix use in coversion, and update test to catch it
This failure happens when using the SkRemoteGlyphCache system
*and* serializing slugs. The problem is that the origin from the
blob conversion was applied twice causing all the sub-pixel
positions to be off. This often pass because this position often
is {0, 0}.

Change-Id: I0384cfc1de5c32851381390661d1f4a8a6595ab2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/510724
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-02-22 15:15:43 +00:00
Herb Derby
d3243f660e working serialize Slugs with DirectMask runs
Add fully functional flatten, and MakeFromBuffer functionality
for the DirectMaskSubRunSlug type. The other runs will need to come
later.

Add MakeFromBuffer stubs for all the rest of the subrun types.

This has a single unit test to check basic functionality of
flatten and MakeFromBuffer calls.

Change-Id: I379ded4609a2160170ed6a3670c7c7b6ed2c5b2e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/509137
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-02-16 19:53:17 +00:00
Herb Derby
7cb61889c5 convertToBlob added to remote glyphs cache
Have the AnalysisCanvas (also known as the diff canvas) convert
SkTextBlobs to GrSlugs and record the Strike differences. Make sure
these differences are tracked and recorded.

Bug: chromium:1278340

Change-Id: I2c8d62fa61511abd1e14d4bf595e6db1a0b5e26b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503827
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-02-03 20:36:44 +00:00
Ben Wagner
8405dfceaa Improve remote glyph caching.
A glyph cache entry is made up of metrics, an image, and a path. If an
entry does not exist then nothing is known of the glyph yet. If there is
an entry it must have at least the metrics. The image and the path may
logically be added lazily as needed. Prior to this change it was not
possible to send both the image and the path of a single glyph. The
added test fails when a given strike is used for both the image and the
path. With this change the test passes, as the image is sent and the
path is sent, and both are merged into the remote glyph. The assertions
around not creating the glyph more than once are replaced with
assertions that no part of the glyph is set more than once.

Change-Id: I2fd4047ee15e0d584b68e1180c6fe15224889310
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503347
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2022-02-03 16:49:43 +00:00
Herb Derby
72412a8672 remove drawingType simplifying code
Encapsulate the direct/SDFT decisions in the bool functions
isDirect() and isSDFT().

Encapsulate the notion of glyph approximations in:
approximateTransformedTextSize().

Use these to replace drawingType through the code.

Bug: chromium:1280180

Change-Id: I8de7ee8bc4a24e576e79eeb1ed8670179a860aa9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491448
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-01-06 21:35:40 +00:00
Herb Derby
0f2390f7fb move SkRemoteGlyphCache.h to private
Chromium has been using the remote glyph cache for a few years now.
It's time to give it a proper home.

This is an intermediate CL. The old .h file includes the new .h file.
After I change the include paths in Chromium, I will delete the old
file.

Change-Id: Iaf00c46aa0698326c0bdec9a0eed218bcc3e334e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482700
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-12-10 20:20:56 +00:00
Robert Phillips
cc44feb654 Start using skgpu::v1 and skgpu::v2 namespaces
Bug: skia:11837
Change-Id: I042775dae34c99c20048d6d70aa6f06b2a6a268b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/424117
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-07-06 18:28:54 +00:00
Chris Dalton
89d460f27b Skip the SkRemoteGlyphCache_DrawTextAsDFT test if not supported
Change-Id: I4f4630e5b3af2531871028f75fa99e1e827dea29
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/416762
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-06-08 17:36:06 +00:00
Michael Ludwig
97f85bb7fd Remove SkTextBlobDiffCanvas, use tracking device directly with base SkCanvas
Chromium has been updated to use makeAnalysisCanvas directly and there are
no more references to SkTextBlobDiffCanvas as a type in its code base.

Since the GlyphTrackingDevice extends SkNoPixelsDevice, any SkCanvas that
uses it is effectively a "no-draw" canvas. However, by returning a base
SkCanvas the text tracking now automatically happens in the context of
the base's AutoLayerForImageFilter handling it applies on every draw. This
means that drawing a text blob with an image filter that modifies the
transform state will now be analyzed in that context automatically
(simplifying code in chrome after this lands).

Another behavioral change is that all non-text draws will still go through
the base SkCanvas' virtuals and invoke the device function. Since it's an
SkNoPixelsDevice, it'll still be a no-op, it just happens a little later.
This won't really impact performance because oop-r already inspects their
operations and only plays back text and transform related ones to the
analysis canvas, so we shouldn't really see non-text draws being invoked
anyways.

Bug: chromium:1187246
Change-Id: I83f86571300751f385b3065dfe889f218fa1edc6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/405196
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-05-06 16:11:57 +00:00
Herb Derby
bf2dd2af49 Reland "rename GrSDFTOptions to GrSDFTControl"
This is a reland of 40a9061203

Original change's description:
> rename GrSDFTOptions to GrSDFTControl
>
> Change-Id: Ie03fce7a99a9f71b18d54e3cd35e7675fb7f8912
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379616
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

Change-Id: Iba0816159a8ef99448a0040c487e56700b96be5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379845
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-03-05 15:24:35 +00:00
Mike Reed
9edff53a73 Revert "rename GrSDFTOptions to GrSDFTControl"
This reverts commit 40a9061203.

Reason for revert: breaking chrome roll (android-pie)?

Original change's description:
> rename GrSDFTOptions to GrSDFTControl
>
> Change-Id: Ie03fce7a99a9f71b18d54e3cd35e7675fb7f8912
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379616
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

TBR=herb@google.com,robertphillips@google.com

Change-Id: I0483cbada23c76bdd5ccdb51936bb20a819343cb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379839
Reviewed-by: Mike Reed <reed@google.com>
2021-03-05 11:15:22 +00:00
Herb Derby
40a9061203 rename GrSDFTOptions to GrSDFTControl
Change-Id: Ie03fce7a99a9f71b18d54e3cd35e7675fb7f8912
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379616
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-03-04 19:49:10 +00:00
Herb Derby
9ad09829f5 encapsulate GrSDFTOptions better
The logic for picking what type of sub run to create is spread
over several locations. Gather that altogether in drawingType().

Have GrSDFT close over all the data needed to calculate the
drawing type. This reduces plumbing to the processGlyphRun
routine.

The next CL should rename GrSDFTOptions to GrSDFTControl.

Change-Id: I99e74c11af6d3b3d9919e54fe1e7286fcfbf1bfb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378036
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-03-03 14:27:32 +00:00
Herb Derby
e5ed50b2c8 notify type size for SkGlyphScaler_remote
Add type size so we can check that the UWA failures are
happening on the size boundaries between direct and
SDF, and SDF small to SDF medium.

Bug=skia:11241

Change-Id: I7d0823ab1fb4c9c8db13ba884a2b2454ba4bf210
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365636
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-02-03 22:13:48 +00:00
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
Adlai Holler
a069304560 Rename GrContextPriv to GrDirectContextPriv
Change-Id: I3fccadd8a2860dbee73f93f995738146373f8a39
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326196
Commit-Queue: Adlai Holler <adlai@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-10-14 16:46:01 +00:00
Ben Wagner
ae4bb98f13 Reland "Remove use of legacy display globals."
This is a reland of c1916c34fe

As it turns out, benches are not always given a canvas.

Original change's description:
> Remove use of legacy display globals.
>
> In the ongoing effort to remove the display globals from Skia, allow
> their use only if SK_LEGACY_SURFACE_PROPS is defined. Do not define this
> in a normal Skia build and remove all use from Skia code.
>
> Change-Id: I9ff550f5db246b9024aac687a1bc01321f1be4c8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319343
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>

Change-Id: I61a2ac058fafc99653e3304876cf4b97350dac8b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322490
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-10-05 19:13:58 +00:00
Jim Van Verth
bd0881cb58 Revert "Remove use of legacy display globals."
This reverts commit c1916c34fe.

Reason for revert: Bots unhappy

Original change's description:
> Remove use of legacy display globals.
>
> In the ongoing effort to remove the display globals from Skia, allow
> their use only if SK_LEGACY_SURFACE_PROPS is defined. Do not define this
> in a normal Skia build and remove all use from Skia code.
>
> Change-Id: I9ff550f5db246b9024aac687a1bc01321f1be4c8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319343
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>

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

Change-Id: I365d2b1d19241a90130bc1b59663651817966f63
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322400
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-10-05 16:34:15 +00:00
Ben Wagner
c1916c34fe Remove use of legacy display globals.
In the ongoing effort to remove the display globals from Skia, allow
their use only if SK_LEGACY_SURFACE_PROPS is defined. Do not define this
in a normal Skia build and remove all use from Skia code.

Change-Id: I9ff550f5db246b9024aac687a1bc01321f1be4c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319343
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-10-05 15:53:10 +00:00
Herb Derby
80f6e4e558 air gap SkStrikeServer API from implementation
This is the second CL for isolating the Chrome
remote glyph cache API from the implementation.

See CL/320074 for the first CL, which handles
SkStrikeClient.

Pull out the rest of the tracing functionality.

Change-Id: I4d6aa4bf648a0d2d55cecedbe445a05c27e3a986
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320256
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-09-28 20:43:33 +00:00
John Stiles
ec9b4aab87 Enable ClangTidy check readability-const-return-type.
https://clang.llvm.org/extra/clang-tidy/checks/readability-const-return-type.html

`const` on a non-pointer/reference return type typically doesn't add
value and can have negative side effects. (i.e., returning a
`const std::string` isn't meaningfully different from returning a
`std::string`, but can sometimes inhibit move-related optimizations.)

In Skia's case, the priv() functions are a notable exception where const
return types are intentional and valuable. These calls have been marked
with NOLINT to exclude them from the check.

This check does not affect pointer and reference returns, where
constness is important.

Change-Id: I86cab92332f164e5ab710b4127182eec99831d7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308564
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-07 17:42:38 +00:00
Robert Phillips
e94b4e1b49 Update more tests to use the GrDirectContext/GrRecordingContext pair
This should be the last batch of tests. All the remaining uses of
GrContext should be resolved when SkImage no longer requires a context.

Change-Id: I47eeb3b74c28f483c20d9bec4daecbdb6d2cb982
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305541
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-27 15:08:31 +00:00
Robert Phillips
6d344c3069 Update unit tests to accept GrDirectContext
This CL makes it explicit that the unit tests always get a direct context.

It is mainly a mechanical CL.

Change-Id: I49e0628851d9c81eb47386ef978edf905c6469d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299866
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-06 15:45:12 +00:00
Herb Derby
a08bde606a GrTextContext::Options -> GrSDFTOptions
Rename GrTextContext::Options to GrSDFTOptions. Remove GrTextContext.

TBR=reed@google.com

Change-Id: Ic89966cfe630cc6ee757977a6d63ae1da9e39ef0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296176
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-06-15 17:14:04 +00:00
Herb Derby
45fe2e8a99 move methods to options class
Change-Id: I5e4abcec1b9f99997cd68b433490e13eaa76f3f9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296123
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-06-12 21:03:34 +00:00
Herb Derby
3d6bf04366 make options robust
Options used to rely on an external call to SanitizeOptions to
ensure they were correct. Now that defaults are set directly,
make sure that the values coming in make sense.

Change-Id: If6cfc027722b6a7717a920b482ec5be8f7526367
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296040
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-06-12 17:05:22 +00:00
Herb Derby
082232b142 simplify option flow
The GrTextContext::options would flow from the GrRecordingContext to
the GrDrawingManager to the GrTextContext, and finally to the
GrRenderTargetContext.

Just find them on the GrRecording context off the GrRenderTargetContext.

Change-Id: I902481d20072c2470905261ab81c2b6456f25343
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295559
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-06-11 18:05:36 +00:00
Mike Reed
1f60733fb3 Revert "Revert "move onto new factories for SkMatrix""
This reverts commit c80ee456ad.

fix: update flutter's gn file to add guard

Change-Id: Iac5171c8475d9a862d06255dab1c6f38f10de2f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291361
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-05-21 16:58:39 +00:00
Mike Reed
c80ee456ad Revert "move onto new factories for SkMatrix"
This reverts commit 046c2b7d90.

Reason for revert: need to update/guard flutter

Original change's description:
> move onto new factories for SkMatrix
> 
> Just rename, no functional changes expected.
> 
> Change-Id: Id77ab1cf6b1cab35087a7c56000750912cf47383
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290831
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>

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

Change-Id: Ic74f177128913374b8c60b4df88f04cf72fbacb3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291359
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-05-21 16:05:20 +00:00
Mike Reed
046c2b7d90 move onto new factories for SkMatrix
Just rename, no functional changes expected.

Change-Id: Id77ab1cf6b1cab35087a7c56000750912cf47383
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290831
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-05-21 15:04:09 +00:00
Herb Derby
bcd65f1970 Reland "Multi-threaded strike cache"
This is a reland of a6cd7c0b1f

Original change's description:
> Multi-threaded strike cache
>
> Allow multiple threads to share the same strike. The old
> system of removing the cache from the linked list is no longer.
> The strikes stay in the list and can be found by other threads.
>
> * Removed strike size verification. There was no way to get the
> locks to work out. The whole point of the change was to have multiple
> threads muting the structure at the same time.
>
> * Strikes are now refed instead of being checked out. Therefore,
> ExclusiveStrikePtr is now just wraps an sk_sp, and should be renamed
> in a future CL.
>
> Change-Id: I832642332a3106e30745f9cdd3156ae72d41fd0b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272057
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Commit-Queue: Herb Derby <herb@google.com>

Change-Id: Id02381de93ff82bca58f09e07a457883d57d5565
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272436
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-02-21 21:01:12 +00:00
Herb Derby
5e5e848770 Revert "Multi-threaded strike cache"
This reverts commit a6cd7c0b1f.

Reason for revert: Introduced nullptr de-ref in last patch

Original change's description:
> Multi-threaded strike cache
> 
> Allow multiple threads to share the same strike. The old
> system of removing the cache from the linked list is no longer.
> The strikes stay in the list and can be found by other threads.
> 
> * Removed strike size verification. There was no way to get the
> locks to work out. The whole point of the change was to have multiple
> threads muting the structure at the same time.
> 
> * Strikes are now refed instead of being checked out. Therefore,
> ExclusiveStrikePtr is now just wraps an sk_sp, and should be renamed
> in a future CL.
> 
> Change-Id: I832642332a3106e30745f9cdd3156ae72d41fd0b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272057
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Commit-Queue: Herb Derby <herb@google.com>

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

Change-Id: Ie1acd9b42e614c17cb63bda1b3fd4dd9827a8fa6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272378
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-02-20 18:30:13 +00:00
Herb Derby
a6cd7c0b1f Multi-threaded strike cache
Allow multiple threads to share the same strike. The old
system of removing the cache from the linked list is no longer.
The strikes stay in the list and can be found by other threads.

* Removed strike size verification. There was no way to get the
locks to work out. The whole point of the change was to have multiple
threads muting the structure at the same time.

* Strikes are now refed instead of being checked out. Therefore,
ExclusiveStrikePtr is now just wraps an sk_sp, and should be renamed
in a future CL.

Change-Id: I832642332a3106e30745f9cdd3156ae72d41fd0b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272057
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-02-20 18:10:43 +00:00
Herb Derby
81e84a6e7f Make SkStrikeCache::Node be SkStrike.
SkStrike becomes SkScalerCache. It will eventually externalize
the memory accounting to SkStrikeCache::Node because the amount of
memory used by the scaler cache, and the overall strike cache memory
usage must be kept in sync.

Change-Id: Ia889f057d8138ec7f22f996e7ebb9d2441dea4ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271018
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-02-15 16:37:58 +00:00
Herb Derby
b444ec4d1f Remove unneeded test, and support code
The SkRemoteGlyphCache_ReWriteGlyph checked that glyphs of
desparation were not overwritten by glyphs coming from the
Renderer. Since the search of desparation is no longer, this
test is not needed.

In addition:
* Remove unused call prepareForDrawingPathsCPU.
* Cleanup some comments

Change-Id: I1fbc3f84363c9093f5301985e8052f49bbb9356e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270996
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-02-14 19:36:49 +00:00
herb
660317f6a7 Move scaler context fallback to GDI
The GDI Typeface is the only one that can fail to make a
scaler context. Move all the logic to the GDI specific code.

Change-Id: I50a0a58529bb44625068244e6ae27e54bccd9f67
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269913
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-02-11 19:50:27 +00:00
Herb Derby
653d2a4eee Remove search of desperation
Change-Id: Id862057ad5b853e979a9e93fc43a559360b400d9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268842
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
2020-02-05 20:04:58 +00:00
Herb Derby
cb443a5928 Force single glyph calls through bulk interface
Enance SkBulkGlyphMetrics, SkBulkGlyphMetricsAndPaths, and SkBulkGlyphMetricsAndImages
with single glyph calls. In addtion, add calls needed to have the rest of the system
work with these interfaces.

As a resulte move the glyph, prepareImage, and preparePath calls to private.

Change-Id: I8d383b649390e45f621dcb9d62fb8367a55cee02
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254056
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-11-12 22:38:14 +00:00
herb
252cdb7824 One glyph() to rule them all!!!
Change-Id: Icb8d9653b5037921648a6c20ff21d26375301b65
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253381
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-11-07 18:03:34 +00:00
Herb Derby
f5e9b42ef0 Change from single prepareForDrawing to prepare[Mask|SDFT|Path]ForDrawing
This produces much simpler logic, and sets up for a massive simplification
of the diff canvas. You can see the ultimate changes in:

https://skia-review.googlesource.com/c/skia/+/238196

Change-Id: I92100bdccb80d0b6f7864435213c29a159e0caaf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250039
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-10-25 19:35:09 +00:00
Herb Derby
95ea4c4c9e Change code() to glyphID() on SkGlyph.
Change-Id: Id13cd5039df7ff3042858c8c89a2dc629b589d3c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244998
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-10-24 20:00:29 +00:00
Hal Canary
e107faa062 SkRemoteGlyphCache Add tracing to diff canvas
Use `extra_cflags=["-DSK_CAPTURE_DRAW_TEXT_BLOB"]` to enable.

Change-Id: I1d6db478ee91696cdce090647b889c17a83a2718
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250259
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-10-24 17:09:31 +00:00
Jim Van Verth
ce3cf804f1 Draw perspective text as paths.
Perspective glyphs can vary in screen size so it's unclear which SDF
level is best, and even if we choose one for an entire subrun it's
possible that a given glyph will have artifacts if it's too big.
Instead we fall back to paths unless specifically requested to
support perspective SDF.

Bug: skia:9515
Change-Id: I75ac1d60f2eaa0e63de201b5db36fe0485fff463
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247398
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-10-10 15:35:51 +00:00
Herb Derby
d543fbbd6f Revert "Draw perspective text as paths."
This reverts commit 76826fc91c.

Reason for revert: Missing some characters

Original change's description:
> Draw perspective text as paths.
> 
> Perspective glyphs can vary in screen size so it's unclear which SDF
> level is best, and even if we choose one for an entire subrun it's
> possible that a given glyph will have artifacts if it's too big.
> Instead we fall back to paths.
> 
> Bug: skia:9515
> Change-Id: I88f03b25651df0222459f5dbd03eee9465b97487
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247437
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Jim Van Verth <jvanverth@google.com>

TBR=jvanverth@google.com,herb@google.com

Change-Id: I5e39566c35b49323913eb72ff89ecbc91faac8ce
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9515
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247462
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-10-09 23:46:28 +00:00
Jim Van Verth
76826fc91c Draw perspective text as paths.
Perspective glyphs can vary in screen size so it's unclear which SDF
level is best, and even if we choose one for an entire subrun it's
possible that a given glyph will have artifacts if it's too big.
Instead we fall back to paths.

Bug: skia:9515
Change-Id: I88f03b25651df0222459f5dbd03eee9465b97487
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247437
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2019-10-09 20:53:20 +00:00
Khushal
498a9b2449 Reland: Only send the RemoteStrikes that have pending glyphs.
This reverts commit 94c6647556. The issue
was that we were not clearing the set of locked strikes, if there is no
data to send. As a result the client was assuming strikes are locked
even after they were purged on the service side.

R=herb@google.com

Bug:999682
Change-Id: I767dd0cab81e085123058201dab042628ac4e241
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/239343
Auto-Submit: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-09-05 20:39:12 +00:00
Herb Derby
a4c7883c56 Cleanups around fRemoteGlyphStateMap
* Rename fRemoteGlyphStateMap -> fDescTorRemoteStrike
* Move map operations to be local
* Other cleanups

Change-Id: Ia5c4309e849d018903623f70595ae7238ceaec8c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237496
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-08-28 13:56:35 +00:00