Commit Graph

30 Commits

Author SHA1 Message Date
Ben Wagner
b4aab9ae6d Replace SkFAIL with SK_ABORT.
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>
2017-08-16 15:37:54 +00:00
Mike Reed
aaa3056e46 switch away from std::function in public api
Bug: skia:
Change-Id: I181382dc1f9d8671b814134c1a787185745b90a8
Reviewed-on: https://skia-review.googlesource.com/25643
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-07-21 19:38:15 +00:00
Mike Reed
6409f84fc3 Revert "Revert "Change image encode api to return sk_sp""
This reverts commit 64778d9f27.

Bug: skia:
Change-Id: I779515ff1e16a40c33890a4bac7a8a07171aadfe
Reviewed-on: https://skia-review.googlesource.com/22261
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-07-12 15:44:35 +00:00
Mike Reed
7e49d534d7 check for null surface in test
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>
2017-07-11 19:45:04 +00:00
Mike Reed
f778eb2f51 check for default typeface for new test
Bug: skia:
Change-Id: I5e52b3259acf73875640ec172d4ff8030975b611
Reviewed-on: https://skia-review.googlesource.com/22262
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2017-07-11 16:49:21 +00:00
Mike Reed
64778d9f27 Revert "Change image encode api to return sk_sp"
This reverts commit dc799550e2.

Reason for revert: need to fix sites in Document_none

Original change's description:
> Change image encode api to return sk_sp
> 
> Bug: skia:
> Change-Id: I238289bc630be27795cb1384955dd6e887597c05
> Reviewed-on: https://skia-review.googlesource.com/22208
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>

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

Change-Id: Id7f67027e5f1405a60fdbde29863cdf8daef0cb7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/22280
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-07-11 16:00:32 +00:00
Mike Reed
dc799550e2 Change image encode api to return sk_sp
Bug: skia:
Change-Id: I238289bc630be27795cb1384955dd6e887597c05
Reviewed-on: https://skia-review.googlesource.com/22208
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2017-07-11 15:43:21 +00:00
Mike Reed
b99beddc7a Add serialize + catalog api to SkTextBlob
Bug: skia:6836
Change-Id: I858cf936b015c14f12a41a4912e19bb15de8abaa
Reviewed-on: https://skia-review.googlesource.com/21730
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2017-07-11 14:49:31 +00:00
Florin Malita
3a9a7a310c Remove run count field from SkTextBlob.
We can flag the last run record instead.  Run iteration is always
sequential, so no penalty.

As a side effect, we can no longer allow instantiation of zero-run text
blobs - but that seems like a good idea anyway.

Change-Id: I7ca80c4780623d5a188f92dfe6d6fe152f20f666
Reviewed-on: https://skia-review.googlesource.com/9149
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2017-03-13 13:36:54 +00:00
Mike Reed
bcfb8f639e Revert "Revert "Revert[2] "hide deprecated underline and strikethru"""
This reverts commit cfd3d9ff8f.

Reason for revert: derek is fixing caller

Original change's description:
> Revert "Revert[2] "hide deprecated underline and strikethru""
> 
> This reverts commit aab68c56ef.
> 
> Reason for revert: android still broken RecordingCanvasTests.cpp
> 
> Original change's description:
> > Revert[2] "hide deprecated underline and strikethru"
> > 
> > android now updated.
> > 
> > This reverts commit e005edd3a5.
> > 
> > BUG=skia:6250
> > 
> > Change-Id: If08d344cdd863fde1d9955dc3fab671a83be0f73
> > Reviewed-on: https://skia-review.googlesource.com/8815
> > Commit-Queue: Mike Reed <reed@google.com>
> > Reviewed-by: Mike Reed <reed@google.com>
> > 
> 
> TBR=reed@google.com,reviews@skia.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=skia:6250
> 
> Change-Id: I954575a0e4b9aca8414e10901a7be03a2d7e6396
> Reviewed-on: https://skia-review.googlesource.com/8900
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>
> 

TBR=reviews@skia.org,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:6250

Change-Id: Ie518b64219a0262cd343644754940774bf42faec
Reviewed-on: https://skia-review.googlesource.com/8901
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-02-23 14:19:40 +00:00
Mike Reed
cfd3d9ff8f Revert "Revert[2] "hide deprecated underline and strikethru""
This reverts commit aab68c56ef.

Reason for revert: android still broken RecordingCanvasTests.cpp

Original change's description:
> Revert[2] "hide deprecated underline and strikethru"
> 
> android now updated.
> 
> This reverts commit e005edd3a5.
> 
> BUG=skia:6250
> 
> Change-Id: If08d344cdd863fde1d9955dc3fab671a83be0f73
> Reviewed-on: https://skia-review.googlesource.com/8815
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
> 

TBR=reed@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:6250

Change-Id: I954575a0e4b9aca8414e10901a7be03a2d7e6396
Reviewed-on: https://skia-review.googlesource.com/8900
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-02-23 14:06:19 +00:00
Mike Reed
aab68c56ef Revert[2] "hide deprecated underline and strikethru"
android now updated.

This reverts commit e005edd3a5.

BUG=skia:6250

Change-Id: If08d344cdd863fde1d9955dc3fab671a83be0f73
Reviewed-on: https://skia-review.googlesource.com/8815
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2017-02-22 21:41:26 +00:00
Leon Scroggins
e005edd3a5 Revert "hide deprecated underline and strikethru"
This reverts commit a01bf9ab74.

Reason for revert: Breaking Android merge. They access setUnderlineText on their <shudder> subclass of SkPaint.

Original change's description:
> hide deprecated underline and strikethru
> 
> BUG=skia:6250
> 
> Change-Id: I85395e4960b16ab91237a74ff35e5b7588965512
> Reviewed-on: https://skia-review.googlesource.com/8600
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Commit-Queue: Mike Reed <reed@google.com>
> 

TBR=bungeman@google.com,reed@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:6250

Change-Id: If55f69f061dc4439ca2faa62807a9c5694ebbeb4
Reviewed-on: https://skia-review.googlesource.com/8687
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2017-02-17 22:49:03 +00:00
Mike Reed
a01bf9ab74 hide deprecated underline and strikethru
BUG=skia:6250

Change-Id: I85395e4960b16ab91237a74ff35e5b7588965512
Reviewed-on: https://skia-review.googlesource.com/8600
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-02-17 17:31:33 +00:00
fmalita
37283c28aa Use sk_sp text blob APIs
SkTextBlobBuilder::build()      -> make()
SkAutoTUnref<const SkTextBlob>  -> sk_sp<SkTextBlob>
drawTextBlob(const SkTextBlob*) -> drawTextBlob(const sk_sp<SkTextBlob>&)

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2335493005

Review-Url: https://codereview.chromium.org/2335493005
2016-09-13 10:00:23 -07:00
halcanary
4f0a23a8d5 SkTextBlob: Begin implementing Extended TextBlob API
BUG=skia:5434
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2084533004

Review-Url: https://codereview.chromium.org/2084533004
2016-08-30 11:58:33 -07:00
bungeman
13b9c95295 Move SkTypeface to sk_sp.
Committed: https://skia.googlesource.com/skia/+/6296da736fbf40aae881650c239420f64e576c3f
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1933393002

Review-Url: https://codereview.chromium.org/1933393002
2016-05-12 10:09:31 -07:00
scroggo
9a9a7b29e5 Revert of Move SkTypeface to sk_sp. (patchset #5 id:80001 of https://codereview.chromium.org/1933393002/ )
Reason for revert:
fontmgr_iterAndroid failing to draw emoji. E.g. https://gold.skia.org/search2?blame=6296da736fbf40aae881650c239420f64e576c3f&unt=true&head=true&query=source_type%3Dgm

Original issue's description:
> Move SkTypeface to sk_sp.
>
> Committed: https://skia.googlesource.com/skia/+/6296da736fbf40aae881650c239420f64e576c3f

TBR=reed@google.com,fmalita@chromium.org,tomhudson@google.com,bungeman@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review-Url: https://codereview.chromium.org/1974783002
2016-05-12 06:22:30 -07:00
bungeman
6296da736f Move SkTypeface to sk_sp.
Review-Url: https://codereview.chromium.org/1933393002
2016-05-11 12:38:18 -07:00
fmalita
32d6b87616 SkTextBlob should store per-run text alignment
SkPaint::Align is only observed for kDefault_Positioning AFAICT, but
part of the run logical font nevertheless.

BUG=skia:4567
R=mtklein@google.com,halcanary@google.com

Review URL: https://codereview.chromium.org/1447403003
2015-11-17 11:39:32 -08:00
halcanary
337797580d Make SkTextBlob::RunIterator public.
Motivation: This will be easier than adding a friend every time I want
to create a one-off SkCanvas subclass or SkRemote::Encoder subclass.

See also: SkPath::Iter.

Review URL: https://codereview.chromium.org/1411723005
2015-10-27 14:01:05 -07:00
fmalita
0b01da7bca Fix TextBlobTest valgrind error
When converting text to glyph IDs, the paint needs to reflect the actual
text encoding.

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

Review URL: https://codereview.chromium.org/1404153002
2015-10-14 08:11:40 -07:00
fmalita
9ae8fe1c60 [SkTextBlob] Remove incorrect builder assert
At the end of TightRunBounds, glyphPosX cannot exceed the start of the
next run.  But glyphPosY is running ahead of glyphPosX (for
kFull_Positioning) => the glyphPosY assert is incorrect.

Since the two pointers advance in lock-step, there isn't much value in
the glyphPosY assert anyway - we might as well remove it.

BUG=chromium:542643
R=reed@google.com,bungeman@google.com

Review URL: https://codereview.chromium.org/1405463004
2015-10-13 08:59:23 -07:00
halcanary
96fcdcc219 Style Change: NULL->nullptr
DOCS_PREVIEW= https://skia.org/?cl=1316233002

Review URL: https://codereview.chromium.org/1316233002
2015-08-27 07:41:16 -07:00
fmalita
3c196def91 Souped-up SkTextBlob.
Refactored text blob backend for improved performance: instead of using
separate buffers for runs/positions/glyphs, everything is now packed in
a consolidated slab (including the SkTextBlob object itself!).

Benefits:

 * number of allocations per blob construction reduced from ~4 to 1
   (also minimizes internal fragmentation)
 * run record size reduced by 8 bytes

This takes the blob construction overhead down to negligible levels
(for the current Blink uncached textblob implementation).

Unfortunately, the code is much more finicky (run merging in
particular) -- hence the assert spree.

Multi-run blobs are vulnerable to realloc storms but this is not a
problem at the moment because Blink is using one-run blobs 99% of the
time. Will be addressed in the future.

R=mtklein@google.com, reed@google.com, robertphillips@google.com

Committed: https://skia.googlesource.com/skia/+/13645ea0ea87038ebd71be3bd6d53b313069a9e4

Author: fmalita@chromium.org

Review URL: https://codereview.chromium.org/581173003
2014-09-20 05:40:22 -07:00
fmalita
e50215e598 Revert of Souped-up SkTextBlob. (patchset #3 id:40001 of https://codereview.chromium.org/581173003/)
Reason for revert:
Broke the new blobshader gm.

Original issue's description:
> Souped-up SkTextBlob.
>
> Refactored text blob backend for improved performance: instead of using
> separate buffers for runs/positions/glyphs, everything is now packed in
> a consolidated slab (including the SkTextBlob object itself!).
>
> Benefits:
>
>  * number of allocations per blob construction reduced from ~4 to 1
>    (also minimizes internal fragmentation)
>  * run record size reduced by 8 bytes
>
> This takes the blob construction overhead down to negligible levels
> (for the current Blink uncached textblob implementation).
>
> Unfortunately, the code is much more finicky (run merging in
> particular) -- hence the assert spree.
>
> Multi-run blobs are vulnerable to realloc storms but this is not a
> problem at the moment because Blink is using one-run blobs 99% of the
> time. Will be addressed in the future.
>
>
> R=reed@google.com,mtklein@google.com,robertphillips@google.com
>
> Committed: https://skia.googlesource.com/skia/+/13645ea0ea87038ebd71be3bd6d53b313069a9e4

R=mtklein@google.com, reed@google.com, robertphillips@google.com
TBR=mtklein@google.com, reed@google.com, robertphillips@google.com
NOTREECHECKS=true
NOTRY=true

Author: fmalita@chromium.org

Review URL: https://codereview.chromium.org/588853002
2014-09-19 19:03:06 -07:00
fmalita
13645ea0ea Souped-up SkTextBlob.
Refactored text blob backend for improved performance: instead of using
separate buffers for runs/positions/glyphs, everything is now packed in
a consolidated slab (including the SkTextBlob object itself!).

Benefits:

 * number of allocations per blob construction reduced from ~4 to 1
   (also minimizes internal fragmentation)
 * run record size reduced by 8 bytes

This takes the blob construction overhead down to negligible levels
(for the current Blink uncached textblob implementation).

Unfortunately, the code is much more finicky (run merging in
particular) -- hence the assert spree.

Multi-run blobs are vulnerable to realloc storms but this is not a
problem at the moment because Blink is using one-run blobs 99% of the
time. Will be addressed in the future.

R=mtklein@google.com, reed@google.com, robertphillips@google.com

Author: fmalita@chromium.org

Review URL: https://codereview.chromium.org/581173003
2014-09-19 18:37:00 -07:00
bsalomon
49f085dddf "NULL !=" = NULL
R=reed@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/544233002
2014-09-05 13:34:00 -07:00
fmalita
51bf9573b8 Add some text blob bounds unit tests.
R=robertphillips@google.com

Author: fmalita@chromium.org

Review URL: https://codereview.chromium.org/498693002
2014-08-22 07:50:46 -07:00
fmalita
c6765d69e3 Add some SkTextBlob builder tests.
R=reed@google.com, robertphillips@google.com

Author: fmalita@chromium.org

Review URL: https://codereview.chromium.org/493443004
2014-08-21 15:03:04 -07:00