It's borderline illegal to implement it there in the header with a
forward-declared SkFontData. See also cl/314969840.
Change-Id: I81e981198014cce03fa9604aada5a383a847cfeb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295640
Reviewed-by: 🤓Vy Nguyen <vyng@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Mainly rearranging the code to perform all ICU iterations once
and cache the results for the next text layouts.
Change-Id: I514d04229d04778c1f2238064acccddf6b548c00
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294400
Commit-Queue: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
This reverts commit cc6349d390.
Reason for revert: Problems with MSAN
Original change's description:
> ICU optimization
>
> Mainly rearranging the code to perform all ICU iterations once
> and cache the results for the next text layouts.
>
> Change-Id: I2c2a502c705510eb169bf62efbfcc13b658591e3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293336
> Commit-Queue: Julia Lavrova <jlavrova@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>
TBR=bungeman@google.com,jlavrova@google.com
Change-Id: I7f7f759178c10349b4c879bafc68a7f8e1065b6a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294398
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Mainly rearranging the code to perform all ICU iterations once
and cache the results for the next text layouts.
Change-Id: I2c2a502c705510eb169bf62efbfcc13b658591e3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293336
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
This is mostly about consolidating and removing use of
icu::UnicodeString. It was used mostly as an intermediary for
conversion, and the new conversions should make one fewer copy of the
data.
Change-Id: I1d0e5f0dc21c47ed7c80f456b9129c4c9a36b09a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292718
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Extending text to grapheme edges should correct glyph range
Bug: skia:10087
Change-Id: I254901aaaa40c2782d1afbd5d5390599bdd7c922
Change-Id: I1d51076656d09e4d2e35e3ddad28bfd60fc87081
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281756
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Unfortunately in clang 'deprecated' is both a set of warnings (at least
one of which we don't want) and a group of warnings (most of which we do
want). Leave the top level disabled, but re-enable all the warnings in
the group.
Most of the code changes are for the deprecated-copy diagnostic. In
C++11 implementing a copy constructor xor copy assignment operator
the default implementation of the other is still required to be the
default but is deprecated (the compiler can warn against doing this).
The idea is that if there was a need for a non-default copy constructor
or copy assignment operator then both should be implemented explicitly,
since it is unlikely that the default will do what is expected.
Note that the deprecated-copy-dtor has not yet been enabled as there
will need to be a lot more work to enable this diagnostic. Similar to
deprecated-copy, in C++11 when implementing a destructor the copy
constructor and copy assignment operator are still defaulted if not
declared, but this is also deprecated. The idea here is that if some
special handling is needed to destroy the object there is probably some
need to do something non-trivial when copying the object (or copying
should be disallowed).
Also, there are still some deprecated-declarations to clean up on
Android and Mac.
Change-Id: I5fc4b62713220e6f7d3724fd7342b4c8c74a3c67
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278916
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Mainly, simplified iteration over visual run for performance reasons.
Check for locale when comparing fonts.
Try to resolve ALL unresolved codepoints.
Change-Id: Ic126ca9bcb3970e2cbd6da9c384c493f9fd81b0d
Bug: skia:9956, skia:9970, skia:9951
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273463
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Use std::min and std::max everywhere.
SkTPin still exists. We can't use std::clamp yet, and even when
we can, it has undefined behavior with NaN. SkTPin is written
to ensure that we return a value in the [lo, hi] range.
Change-Id: I506852a36e024ae405358d5078a872e2c77fa71e
Docs-Preview: https://skia.org/?cl=269357
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269357
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
If none of the families in the requested list are available, then use the
platform default font family.
Change-Id: If0c69febb112c660f96a768cea8d3ae6b35ea68a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255311
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Jason Simmons <jsimmons@google.com>
Fixed some bugs for flutter tests
Change-Id: I43f4b4b185152a8d642127370da5f80fb96f1e9e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/239444
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
There are more parts of ParagraphStyle and TextStyle, but
this should be a bulk of the components.
Bug: skia:9469
Change-Id: I87fff6700f41cff49ecbee3a1339e84c36699c93
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244837
Reviewed-by: Julia Lavrova <jlavrova@google.com>
This repurposes much of our embedded SkFontMgr code
to take in data directly instead of from compiled-in
variables.
Also makes no_font and no_embedded_font work better.
Bug: skia:9469
Change-Id: Ibde49c9a448cfca79c5712aa9abbe15997a163d0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244510
Reviewed-by: Ben Wagner <bungeman@google.com>
These unused comparison operators are the only users of
<functional> in SkRefCnt.h, for std::less. <functional>
is an expensive header to compile, and SkRefCnt.h is popular,
so it helps to cut dependencies like this.
Mostly we just need to add #include <functional> in a few
places that were picking it up via SkRefCnt.h.
In SkPixmapPriv.h, it looked simpler to template the argument,
since everything was inline anyway.
Change-Id: I7c125bb26a04199847357c729a1b178256c6ef8d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/236942
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
<ostream> is one of the more expensive headers to include
and that's amplified by SkRefCnt.h's popularity.
We've been including <ostream> for sk_sp's operator<<. That's only
used by Chromium and while we could just sprinkle in a bunch of .get()
calls and remove operator<<, when I started going through and actually
doing that I got the feeling I was making things pointlessly harder to
read and write, and wanted to find a way to make it actually work.
My next instinct was to template it without mentioning ostreams,
template <typename OS, typename T>
auto operator<<(OS& os, const sk_sp<T>& sp) -> decltype(os << sp.get()) {
return os << sp.get();
}
but that makes this operator<< ambiguous with some other templated operator<<
in GTest. They got in first, so they win...
So ultimately, switch <ostream> to <iosfwd>. Anyone using our
operator<<() presumably has <ostream> included already, and the #include
cost for <iosfwd> is small enough that I don't think we'll mind keeping
this around indefinitely.
To repro, look at before/after of -ftime-trace:
~/chromium/src/third_party/llvm-build/Release+Asserts/bin/clang++ -I. -Os -c src/core/SkCanvas.cpp -ftime-trace
I have tested locally that Chromium builds with this change.
Change-Id: I9decc2e65b5cc8fd07d8106a5eff81901aedd7d5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237190
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
That makes layout phase 10 times faster (since the shaping takes 90% of it).
LRU cache is attached to the FontCollection object and has the same life time.
Currently it has hardcoded limit on the entry numbers (128).
One the number reached, the least recently used element is removed from the cache
to free the space for a new one.
Change-Id: I597e334422614e33715d7a9ed13acf7b1f9cd0e4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230755
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
PS2 adds a rewrite for Skia #include <...> to #include "...", letting
them be otherwise rewritten and sorted too. (We do need one exception
for the Vulkan headers, which will otherwise be rewritten to always
point to our own.) I don't think it's particularly important to
favor "" or <>, but picking one keeps things consistent.
PS3 adds a missing SkMutex.h include.
PS4 fixes a terrible readability problem.
Change-Id: Id9fe752727ef30e802b1daf755ee2ed15e267577
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229742
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Adding cache
Caching shaped results
Base+Index for referencing arrays
The very first and naive version of cache
Cache measurement, lines and picture
Added text blob cache for lines
Removed Run* from Cluster
Removed const char* from Cluster and Run
Few minor changes
Change-Id: I444a1defa950aed5999cfa1c3545fd83ccb54ce9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/227840
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Mike Reed <reed@google.com>
few minor bug fixes
Change-Id: Ibc60e972480f3503965af873f36001ed233382ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221544
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
In GrRecordingContext I moved the auditTrail onto the heap and only there
when compiling for tests. This allowed us to move a lot of files out of
include private.
Change-Id: Ib76ac211c0c6fd10bacaccf0c5f93f21a59f35d5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221344
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
This is a reland of 10ad0b9b01
Original change's description:
> SkParagraph
>
> Change-Id: I0a4be75fd0c18021c201bcc1edfdfad8556edeff
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/192100
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>
Change-Id: I46cf43eae693edf68e45345acd0eb39e04e02bfc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219863
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>