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>
As of revision 7924d9a4ae (https://skia-review.googlesource.com/c/skia/+/222277), SkTextBlob::getIntercepts no longer considers each glyph's vertical offset. So getIntercepts will only work properly if each glyph has a vertical offset of 0. This patch restores the original behavior of offsetting the bounds from each glyph's position.
Without this fix, Firefox has no way to implement proper intercepts for underlining decorations when glyphs are offset...
Change-Id: I06fc4b63bd57c9d70e3b07a95ead69f3caa8b33a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248724
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Lee Salzman <lsalzman@mozilla.com>
bug: skia:9503
Change-Id: I5b4e2434c6085d048d6d0fc42b2b928439b1066b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246296
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Previously, this test was passing only because it used the default
typeface. In deserialization code, if the typeface can't be
deserialized, it is replaced with the default typeface. I changed the
test to use a non-default typeface, which caused it to fail. I then
changed the custom typeface serializer/deserializer functions so that
the test passes.
Change-Id: I14e33f7fd18342e76a1fa624ae97fd894e010b6a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/226221
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Ben Wagner aka dogben <benjaminwagner@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Current strategy: everything from the top
Things to look at first are the manual changes:
- added tools/rewrite_includes.py
- removed -Idirectives from BUILD.gn
- various compile.sh simplifications
- tweak tools/embed_resources.py
- update gn/find_headers.py to write paths from the top
- update gn/gn_to_bp.py SkUserConfig.h layout
so that #include "include/config/SkUserConfig.h" always
gets the header we want.
No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
sk_tool_utils doesn't really fit the naming convention
the rest of code under tools/ tends to use.
Change-Id: I45326a174101c6eb4b6149e9c742f658f2fd23b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202313
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
* Remove GetTypefaceOrDefault from SkPaint and SkFont
* Remove RefTypefaceOrDefault from SkPaint and SkFont
Change-Id: I04ae777142c2bdec849508b611b844418bbaedff
Reviewed-on: https://skia-review.googlesource.com/c/185781
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This reverts commit 576633cf57.
Fix: add new version to both variants of SkReadBuffer
Bug: skia:
Change-Id: I8ba60d374860718402328398a4a09b8c97d65e33
Reviewed-on: https://skia-review.googlesource.com/c/179845
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
This reverts commit f1ae66bedd.
Reason for revert: need to guard for no-serialization builds (I think)
Original change's description:
> serialize fonts instead of paints
>
> Some changes from before:
> - we don't force serializing a typeface if the field is null
> - we don't serialize the blob bounds (don't trust them)
>
> Bug: skia:
> Change-Id: I41281b2aa63a1026de87330023346f1da5378c1f
> Reviewed-on: https://skia-review.googlesource.com/c/179735
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Reviewed-by: Herb Derby <herb@google.com>
TBR=bungeman@google.com,herb@google.com,fmalita@chromium.org,reed@google.com
Change-Id: Id891198bc683b9b5e7417a30c2f7adb0bd978e30
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/179843
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Some changes from before:
- we don't force serializing a typeface if the field is null
- we don't serialize the blob bounds (don't trust them)
Bug: skia:
Change-Id: I41281b2aa63a1026de87330023346f1da5378c1f
Reviewed-on: https://skia-review.googlesource.com/c/179735
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
This reverts commit 6bd19df9fa.
Restores original CL, but adds guards for flutter.
Bug: skia:
Change-Id: I380b4ea87d293355026d734249aa2b8c397da144
Reviewed-on: https://skia-review.googlesource.com/c/169345
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
Step 1 of many to (eventually) use SkFont to make blobs, and not paint.
Bug: skia:2664
Change-Id: Iaa0682f9d947e18afa96b448519f2f60ffe104cc
Reviewed-on: https://skia-review.googlesource.com/c/165521
Auto-Submit: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Move SkTextBlobBuilder::allocRunText* to private: for the time
being, to reduce the documented interface footprint.
No code is deleted; the functions may be restored when a
client is ready to call them.
Also, add SkTextBlob::MakeFromString to complement
SkTextBlob::MakeFromText.
R=halcanary@google.com,fmalita@google.com
TBR=reed@google.com
Bug: skia:6818
Change-Id: If09d4da4ce38b680d73f25d187e3d06eeb0ec652
Reviewed-on: https://skia-review.googlesource.com/146521
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Cary Clark <caryclark@skia.org>
Change-Id: I3fbb4d27b728e5fc5ecec9fc9d9e215dd5a83359
Reviewed-on: https://skia-review.googlesource.com/144123
Commit-Queue: Herb Derby <herb@google.com>
Commit-Queue: Cary Clark <caryclark@google.com>
Auto-Submit: Herb Derby <herb@google.com>
Reviewed-by: Cary Clark <caryclark@google.com>
The SKTextBlob serialization code that is tested by Skia is
unused by Chrome. The serialization code that is
used by Chrome is untested by Skia.
Remove the unused code; test the used code.
The code path introduced nearly a year ago,
likely for slimming paint, attempts to make
text blobs smarter by allowing the reuse of typefaces.
Maybe there needs to be a Chrome bug / feature
request to use this?
If if turns out there is no interest to do so,
This CL aligns used interfaces with tests.
R=reed@google.com,fmalita@google.com,bungeman@google.com
Bug: skia:6818
Change-Id: I9b3ec0c326495322986ba26f20f901bcb208be73
Reviewed-on: https://skia-review.googlesource.com/141542
Reviewed-by: Cary Clark <caryclark@skia.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
This reverts commit 2a2f675926.
Reason for revert: this appears to be what is holding up the Chrome roll.
Original change's description:
> SkTypes: extract SkTo
>
> Change-Id: I8de790d5013db2105ad885fa2683303d7c250b09
> Reviewed-on: https://skia-review.googlesource.com/133620
> Reviewed-by: Mike Klein <mtklein@google.com>
TBR=mtklein@google.com,halcanary@google.com
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: Iafd738aedfb679a23c061a51afe4b98a8d4cdfae
Reviewed-on: https://skia-review.googlesource.com/134504
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
This is a reland of c86c5c0144
Original change's description:
> Remove devKerning
>
> Dev kerning is not supported by any scalers. This is
> mostly removed. The remaining fields fRsbDelta and
> fLsbDelta are kept to keep Android compiling.
>
> Change-Id: If1a9ee9bb599d4e1bdf4b3751ac0c65246350809
> Reviewed-on: https://skia-review.googlesource.com/124921
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Commit-Queue: Herb Derby <herb@google.com>
Change-Id: Ibf5fac5f1442c7e62392d5146ad460da27b10d5c
Reviewed-on: https://skia-review.googlesource.com/125300
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This reverts commit c86c5c0144.
Reason for revert: 4 of 5
Original change's description:
> Remove devKerning
>
> Dev kerning is not supported by any scalers. This is
> mostly removed. The remaining fields fRsbDelta and
> fLsbDelta are kept to keep Android compiling.
>
> Change-Id: If1a9ee9bb599d4e1bdf4b3751ac0c65246350809
> Reviewed-on: https://skia-review.googlesource.com/124921
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Commit-Queue: Herb Derby <herb@google.com>
TBR=bungeman@google.com,herb@google.com,reed@google.com
Change-Id: If865f702868192a1b72cd811baa996dd1282bbce
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/125263
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Dev kerning is not supported by any scalers. This is
mostly removed. The remaining fields fRsbDelta and
fLsbDelta are kept to keep Android compiling.
Change-Id: If1a9ee9bb599d4e1bdf4b3751ac0c65246350809
Reviewed-on: https://skia-review.googlesource.com/124921
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
The original intent of this flag is now handled by SkPixelGeomety on
SkSurfaceProps on SkSurface.
BUG=skia:7515
Change-Id: I54bb1be072b5b5b2164a59196bfeacac254823c7
Reviewed-on: https://skia-review.googlesource.com/121346
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
This reverts commit 1a104bce20.
Change (from first version) is
- only signal error in readbuffer for corrupt stream, not default fonts
- change test to ensure a non-null typeface (i.e. MakeDefault())
Bug: skia:
Change-Id: I325445b56b0a402e1b89a2439df06e92314c793f
Reviewed-on: https://skia-review.googlesource.com/82687
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
SkFAIL is a legacy macro which is just SK_ABORT. This CL mechanically
changes uses of SkFAIL to SK_ABORT in preparation for its removal. The
related sk_throw macro will be changed independently, due to needing to
actually clean up its users.
Change-Id: Id70b5c111a02d2458dc60c8933f444df27d9cebb
Reviewed-on: https://skia-review.googlesource.com/35284
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
If the bounds of the blob are empty, we will request a zero-sized surface
which will fail. Just check for that.
Only expect this if the typeface is empty (e.g. faked out for testing)
Bug: skia:
Change-Id: Idcac0e9d4e2a5fe68926a33250015609b5c7e365
Reviewed-on: https://skia-review.googlesource.com/22360
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>