Commit Graph

6530 Commits

Author SHA1 Message Date
Hal Canary
21c34824dc revert changes to FontHostStreamTest
NoTry: true
Change-Id: Ida87530c1be26498508db25b6db3209612ace01a
Reviewed-on: https://skia-review.googlesource.com/c/182453
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-01-09 17:57:29 +00:00
Hal Canary
a70ae1a70f drawText Cleanup, part 5
Change-Id: I2e6cb63839ec9c6f9d5b829505472f97b076a82c
Reviewed-on: https://skia-review.googlesource.com/c/182260
Auto-Submit: Hal Canary <halcanary@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-01-09 16:10:30 +00:00
Hal Canary
3560ea702f drawText Cleanup, part 3
Change-Id: I17bdc317b2f22bb3d4c33785aa2163e8beb3b280
Reviewed-on: https://skia-review.googlesource.com/c/182201
Auto-Submit: Hal Canary <halcanary@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-01-09 16:07:03 +00:00
Michael Ludwig
c96fc37f23 Reland "Use specialized quad lists in rectangle ops"
This is a reland of 5820b0c3f3
It is updated in patchset 2 to clean up pointers passed into memcpy, and to
optimize the bounds calculation in GrPerspQuad. This should fix a performance
regression caused by the move away from caching 1/w. The Sk4f::invert() does not
always preserve 1/1 == 1, which led to bounds slightly outside of clips and
thus forced Skia to keep the scissor test enabled. The fix also restores the
optimization of skipping the 1/w division when the quad is known to be 2D.

Original change's description:
> Use specialized quad lists in rectangle ops
>
> Hopefully reduces memory footprint of GrFillRectOp and GrTextureOp
>
> The original rect code (GrAAFillRectOp) stored 2 SkMatrices (18 floats), 2
> SkRects (8 floats) an SkPMColor4f (4 floats) and a flag (1 int) for a total
> of 124 bytes per quad that was stored in the op.
>
> The first pass at the rectangle consolidation switched to storing device and
> local quads as GrPerspQuads (32 floats), an SkPMColor4f (4 floats) and a flag
> (1 int) for a total of 148 bytes per quad. After landing, several memory
> regressions appeared in Chrome and our perf monitor.
>
> Several intertwined approaches are taken here. First, GrPerspQuad no longer
> caches 1/w, which makes a quad 12 floats instead of 16. Second, a specialized
> list type is defined that allows storing the x, y, and extra metadata together
> for quads, but keeps the w components separate. When the quad type isn't
> perspective, w is not stored at all since it is implicitly 1 and can be
> reconstituted at tessellation time. This brings the total per quad to either
> 84 or 116 bytes, depending on if the op list needs perspective information.
>
> Bug: chromium:915025
> Bug: chromium:917242
> Change-Id: If37ee122847b0c32604bb45dc2a1326b544f9cf6
> Reviewed-on: https://skia-review.googlesource.com/c/180644
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

Bug: chromium:915025, chromium:917242
Change-Id: I98a1bf83fd7d393604823d567c57d7e06fad5e55
Reviewed-on: https://skia-review.googlesource.com/c/182203
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2019-01-08 21:36:31 +00:00
Hal Canary
89a644b635 sed s/drawSimpleText/drawString/
for f in $(git grep -l drawSimpleText); do
    sed -i 's/wSimpleText(\([[:alnum:]]\), strlen(\1), kUTF8_SkTextEncoding,/wString(\1,/g' "$f"
    sed -i 's/wSimpleText(\([[:alnum:]]*\)\.c_str(), \1\.size(), kUTF8_SkTextEncoding,/wString(\1,/g' "$f"
done
git checkout @~ include/core/SkCanvas.h samplecode/SampleCusp.cpp
git cl format

Change-Id: Ibc0c3afd30f86465a645fadb26177d61919f57fd
Reviewed-on: https://skia-review.googlesource.com/c/181561
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
2019-01-08 19:50:09 +00:00
Chris Dalton
aaa77c169f Reland "ccpr: Support caching of paths that span multiple tiles"
This is a reland of 6a3dc8be46

Original change's description:
> ccpr: Support caching of paths that span multiple tiles
> 
> Adds an accumulative "hit rect" for each cache entry that tracks the
> region of the path that has been drawn during its lifetime. Now, a
> path mask can be cached once the "hit rect" covers 50% of the path.
> This allows us to cache a path that spans multiple tiles.
> 
> To guard against unnecessarily caching gigantic path masks, we also
> require that 10% of the path be visible during the draw when it is
> cached.
> 
> Bug: skia:8462
> Change-Id: Iab2c277102b7a774eaa909c9663211694554c5a5
> Reviewed-on: https://skia-review.googlesource.com/c/180700
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

Bug: skia:8462
Change-Id: Ia2b10430acd2dffac78b5abd432763ead79bc902
Reviewed-on: https://skia-review.googlesource.com/c/181983
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-01-08 16:58:58 +00:00
Robert Phillips
832c931d5b Revert "Make SkBitmap/SkPixmap::erase* do so in sRGB"
This reverts commit 6f44647e52.

Reason for revert: checking to see if this is blocking the Chrome roll

Original change's description:
> Make SkBitmap/SkPixmap::erase* do so in sRGB
> 
> We generally consider untagged colors to be sRGB, so this makes us more
> consistent with other parts of the API.
> 
> Add a test.
> 
> Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
> Change-Id: I5468c86ad92164797a65ffd9fbe471e01a97a2ca
> Reviewed-on: https://skia-review.googlesource.com/c/179245
> Commit-Queue: Leon Scroggins <scroggo@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

TBR=djsollen@google.com,mtklein@google.com,scroggo@google.com,brianosman@google.com,reed@google.com

Change-Id: Ia592adf2c790d294da1e32c1e83f9f34e81d79cc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Reviewed-on: https://skia-review.googlesource.com/c/182083
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-01-08 13:04:24 +00:00
Chris Dalton
7337dbea1a Revert "ccpr: Support caching of paths that span multiple tiles"
This reverts commit 6a3dc8be46.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> ccpr: Support caching of paths that span multiple tiles
> 
> Adds an accumulative "hit rect" for each cache entry that tracks the
> region of the path that has been drawn during its lifetime. Now, a
> path mask can be cached once the "hit rect" covers 50% of the path.
> This allows us to cache a path that spans multiple tiles.
> 
> To guard against unnecessarily caching gigantic path masks, we also
> require that 10% of the path be visible during the draw when it is
> cached.
> 
> Bug: skia:8462
> Change-Id: Iab2c277102b7a774eaa909c9663211694554c5a5
> Reviewed-on: https://skia-review.googlesource.com/c/180700
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: Ibae9d46333e3178856fd623f26317366102dd344
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:8462
Reviewed-on: https://skia-review.googlesource.com/c/181982
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-01-07 22:41:19 +00:00
Leon Scroggins III
6f44647e52 Make SkBitmap/SkPixmap::erase* do so in sRGB
We generally consider untagged colors to be sRGB, so this makes us more
consistent with other parts of the API.

Add a test.

Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Change-Id: I5468c86ad92164797a65ffd9fbe471e01a97a2ca
Reviewed-on: https://skia-review.googlesource.com/c/179245
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-01-07 22:13:39 +00:00
Chris Dalton
6a3dc8be46 ccpr: Support caching of paths that span multiple tiles
Adds an accumulative "hit rect" for each cache entry that tracks the
region of the path that has been drawn during its lifetime. Now, a
path mask can be cached once the "hit rect" covers 50% of the path.
This allows us to cache a path that spans multiple tiles.

To guard against unnecessarily caching gigantic path masks, we also
require that 10% of the path be visible during the draw when it is
cached.

Bug: skia:8462
Change-Id: Iab2c277102b7a774eaa909c9663211694554c5a5
Reviewed-on: https://skia-review.googlesource.com/c/180700
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-01-07 21:58:28 +00:00
Mike Reed
023403ba99 hide setTextEncoding
Bug: skia:
Change-Id: Ia9d3acadc1ef8a9b3c175dba501a5324179d27e9
Reviewed-on: https://skia-review.googlesource.com/c/181566
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-01-07 18:34:55 +00:00
Mike Reed
1af9b48e47 use drawstring with font
Bug: skia:
Change-Id: I102f424b0f2beaf2ec5bef0fcdc0352f5766f490
Reviewed-on: https://skia-review.googlesource.com/c/181563
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-01-07 16:29:31 +00:00
Chris Dalton
351e80cc28 Reland "ccpr: Rework the path cache to support sporadic flushing"
This is a reland of d6fa45472c

Original change's description:
> ccpr: Rework the path cache to support sporadic flushing
> 
> Removes the notion of a stashed atlas that we store from the previous
> flush. Now we just cache every atlas we ever render. Cached atlases
> can either be 16-bit or 8-bit.
> 
> The "reuse" and "animation" cases should both behave exactly the same
> as before: Where before we would copy from the stashed atlas to 8-bit
> atlases, we now copy from a cached 16-bit atlas and then invalidate
> it. Where before we would recycle the stashed atlas's backing texture
> object, we now recycle this same texture object from an invalidated
> 16-bit cached atlas.
> 
> The main difference is that cases like tiled rendering now work. If
> you draw your whole scene in one flush, you still get one big 16-bit
> cached atlas, just like the "stashed atlas" implementation. But if you
> draw your scene in tiles, you now get lots of little cached 16-bit
> atlases, which can be reused and eventually copied to 8-bit atlases.
> 
> Bug: skia:8462
> Change-Id: Ibae65febb948230aaaf1f1361eef9c8f06ebef18
> Reviewed-on: https://skia-review.googlesource.com/c/179991
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

Bug: skia:8462
Change-Id: I2f64b0c37e2cd644a202dfc786366dda5d238391
Reviewed-on: https://skia-review.googlesource.com/c/181450
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-01-07 16:14:31 +00:00
Mike Reed
c4745d6e51 use drawString with font
Bug: skia:
Change-Id: If193ce2abad59124d24478f24f2bc2fd85ac0d16
Reviewed-on: https://skia-review.googlesource.com/c/181408
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-01-07 15:03:06 +00:00
Brian Osman
82ebe04caf Reland "Add SkColorSpace factory from 3x3 row-major gamut and transfer function"
Moved named common transfer functions and gamuts to constexpr values in
SkColorSpace.h, in SkNamedTransferFn and SkNamedGamut namespaces.

Converted nearly all SkColorSpace::MakeRGB calls within Skia to use the
new factory with the named values. Multiple clients want a way to
extract named transfer function and gamut - this still doesn't provide
that, but this may be a better path forward for honestly advertising how
SkColorSpace works internally.

Originally landed as:
https://skia.googlesource.com/skia/+/a9549ab31630fc244094e6f1692371cbaf87f666

Re-landing with a new serialization format, but maintaining ability to
load old serialized color spaces, for SKP compatibility.

Bug: skia:
Change-Id: Ib84a6e1cd5d7d9816175773fdbaff2ca32658667
Reviewed-on: https://skia-review.googlesource.com/c/181176
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-01-05 20:06:51 +00:00
Chris Dalton
2e825a3c5d Revert "ccpr: Rework the path cache to support sporadic flushing"
This reverts commit d6fa45472c.

Reason for revert: Assertion failures

Original change's description:
> ccpr: Rework the path cache to support sporadic flushing
> 
> Removes the notion of a stashed atlas that we store from the previous
> flush. Now we just cache every atlas we ever render. Cached atlases
> can either be 16-bit or 8-bit.
> 
> The "reuse" and "animation" cases should both behave exactly the same
> as before: Where before we would copy from the stashed atlas to 8-bit
> atlases, we now copy from a cached 16-bit atlas and then invalidate
> it. Where before we would recycle the stashed atlas's backing texture
> object, we now recycle this same texture object from an invalidated
> 16-bit cached atlas.
> 
> The main difference is that cases like tiled rendering now work. If
> you draw your whole scene in one flush, you still get one big 16-bit
> cached atlas, just like the "stashed atlas" implementation. But if you
> draw your scene in tiles, you now get lots of little cached 16-bit
> atlases, which can be reused and eventually copied to 8-bit atlases.
> 
> Bug: skia:8462
> Change-Id: Ibae65febb948230aaaf1f1361eef9c8f06ebef18
> Reviewed-on: https://skia-review.googlesource.com/c/179991
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: Iad74a14fcb09da12f32b9b78f803b8472a5d60ae
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:8462
Reviewed-on: https://skia-review.googlesource.com/c/181444
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-01-04 22:14:31 +00:00
Mike Reed
d5cdc2cd4d paint is losing its text-related fields
Bug: skia:
Change-Id: I187c290f30259564e8ff396b54070ca305da3954
Reviewed-on: https://skia-review.googlesource.com/c/181400
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-01-04 21:54:49 +00:00
Chris Dalton
d6fa45472c ccpr: Rework the path cache to support sporadic flushing
Removes the notion of a stashed atlas that we store from the previous
flush. Now we just cache every atlas we ever render. Cached atlases
can either be 16-bit or 8-bit.

The "reuse" and "animation" cases should both behave exactly the same
as before: Where before we would copy from the stashed atlas to 8-bit
atlases, we now copy from a cached 16-bit atlas and then invalidate
it. Where before we would recycle the stashed atlas's backing texture
object, we now recycle this same texture object from an invalidated
16-bit cached atlas.

The main difference is that cases like tiled rendering now work. If
you draw your whole scene in one flush, you still get one big 16-bit
cached atlas, just like the "stashed atlas" implementation. But if you
draw your scene in tiles, you now get lots of little cached 16-bit
atlases, which can be reused and eventually copied to 8-bit atlases.

Bug: skia:8462
Change-Id: Ibae65febb948230aaaf1f1361eef9c8f06ebef18
Reviewed-on: https://skia-review.googlesource.com/c/179991
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-01-04 20:51:09 +00:00
Florin Malita
5809a4e2c3 [skjson] NaN while parsing long decimals
When parsing numbers with long decimals, the fast-path decimal factor
may collapse to zero.  Catch this condition (and defer to the slow parse
path).

Bug: skia:8499
Change-Id: I4e364402aecdcca9558d027a55ff297170e2a195
Reviewed-on: https://skia-review.googlesource.com/c/181179
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-01-04 20:41:27 +00:00
Mike Reed
74b767777c change paint serialization to exclude font-related fields
This is slightly preemptive, since paint still has getters/setters for
these fields, but skia no longer looks at them, so...

Reduces serial size by 20-bytes + size of a typeface

Bug: skia:2664
Change-Id: If1997c823db5b3d83b04cb7e1bc1d6787795b70a
Reviewed-on: https://skia-review.googlesource.com/c/181174
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-01-04 19:35:37 +00:00
Brian Osman
d4c7458f64 Revert "Add SkColorSpace factory from 3x3 row-major gamut and transfer function"
This reverts commit a9549ab316.

Reason for revert: SKPs changed?

Original change's description:
> Add SkColorSpace factory from 3x3 row-major gamut and transfer function
> 
> Moved named common transfer functions and gamuts to constexpr values in
> SkColorSpace.h, in SkNamedTransferFn and SkNamedGamut namespaces.
> 
> Converted nearly all SkColorSpace::MakeRGB calls within Skia to use the
> new factory with the named values. Multiple clients want a way to
> extract named transfer function and gamut - this still doesn't provide
> that, but this may be a better path forward for honestly advertising how
> SkColorSpace works internally.
> 
> Bug: skia:
> Change-Id: I9296d67e8f0dab5ceb49869cb3ba24e98a05f3c4
> Reviewed-on: https://skia-review.googlesource.com/c/180360
> Reviewed-by: Mike Klein <mtklein@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

TBR=mtklein@google.com,brianosman@google.com,reed@google.com

Change-Id: Ie888f877b3c1dba33e1a8c0f5fa92594628de7fb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/181300
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-01-04 17:07:48 +00:00
Mike Reed
60a0e87c6c remove blob iterator::applyFontToPaint
Bug: skia:
Change-Id: I4cc66e19ceab7914b8895e23c21860842c9fadbf
Reviewed-on: https://skia-review.googlesource.com/c/181164
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-01-04 16:11:27 +00:00
Kevin Lubick
13486cbf56 more extra semis
Hopefully with better grepping.

Bug: skia:
Change-Id: I434f2b1fedc2eff2d62cf80b13ebb1bd71a1c8a1
Reviewed-on: https://skia-review.googlesource.com/c/181166
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Joe Gregorio <jcgregorio@google.com>
Auto-Submit: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2019-01-04 15:35:14 +00:00
Greg Daniel
070cbafd6b Add support to gpu command buffers to wrap an external command buffer.
Bug: skia:
Change-Id: Ic679d292f42c61f9f1c36315ae605504a0283306
Reviewed-on: https://skia-review.googlesource.com/c/179521
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-01-04 15:22:27 +00:00
Michael Ludwig
23d8943e5b Revert "Use specialized quad lists in rectangle ops"
This reverts commit 5820b0c3f3.

Reason for revert: Unanticipated gold image differences and performance regressions

Original change's description:
> Use specialized quad lists in rectangle ops
> 
> Hopefully reduces memory footprint of GrFillRectOp and GrTextureOp
> 
> The original rect code (GrAAFillRectOp) stored 2 SkMatrices (18 floats), 2
> SkRects (8 floats) an SkPMColor4f (4 floats) and a flag (1 int) for a total
> of 124 bytes per quad that was stored in the op.
> 
> The first pass at the rectangle consolidation switched to storing device and
> local quads as GrPerspQuads (32 floats), an SkPMColor4f (4 floats) and a flag
> (1 int) for a total of 148 bytes per quad. After landing, several memory
> regressions appeared in Chrome and our perf monitor.
> 
> Several intertwined approaches are taken here. First, GrPerspQuad no longer
> caches 1/w, which makes a quad 12 floats instead of 16. Second, a specialized
> list type is defined that allows storing the x, y, and extra metadata together
> for quads, but keeps the w components separate. When the quad type isn't
> perspective, w is not stored at all since it is implicitly 1 and can be
> reconstituted at tessellation time. This brings the total per quad to either
> 84 or 116 bytes, depending on if the op list needs perspective information.
> 
> Bug: chromium:915025
> Bug: chromium:917242
> Change-Id: If37ee122847b0c32604bb45dc2a1326b544f9cf6
> Reviewed-on: https://skia-review.googlesource.com/c/180644
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

TBR=robertphillips@google.com,csmartdalton@google.com,michaelludwig@google.com

Change-Id: I6067b6c0e103d08787626a0a8eff753a0f0c97b6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:915025, chromium:917242
Reviewed-on: https://skia-review.googlesource.com/c/181167
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2019-01-04 14:51:48 +00:00
Brian Osman
a9549ab316 Add SkColorSpace factory from 3x3 row-major gamut and transfer function
Moved named common transfer functions and gamuts to constexpr values in
SkColorSpace.h, in SkNamedTransferFn and SkNamedGamut namespaces.

Converted nearly all SkColorSpace::MakeRGB calls within Skia to use the
new factory with the named values. Multiple clients want a way to
extract named transfer function and gamut - this still doesn't provide
that, but this may be a better path forward for honestly advertising how
SkColorSpace works internally.

Bug: skia:
Change-Id: I9296d67e8f0dab5ceb49869cb3ba24e98a05f3c4
Reviewed-on: https://skia-review.googlesource.com/c/180360
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-01-04 14:32:06 +00:00
Michael Ludwig
5820b0c3f3 Use specialized quad lists in rectangle ops
Hopefully reduces memory footprint of GrFillRectOp and GrTextureOp

The original rect code (GrAAFillRectOp) stored 2 SkMatrices (18 floats), 2
SkRects (8 floats) an SkPMColor4f (4 floats) and a flag (1 int) for a total
of 124 bytes per quad that was stored in the op.

The first pass at the rectangle consolidation switched to storing device and
local quads as GrPerspQuads (32 floats), an SkPMColor4f (4 floats) and a flag
(1 int) for a total of 148 bytes per quad. After landing, several memory
regressions appeared in Chrome and our perf monitor.

Several intertwined approaches are taken here. First, GrPerspQuad no longer
caches 1/w, which makes a quad 12 floats instead of 16. Second, a specialized
list type is defined that allows storing the x, y, and extra metadata together
for quads, but keeps the w components separate. When the quad type isn't
perspective, w is not stored at all since it is implicitly 1 and can be
reconstituted at tessellation time. This brings the total per quad to either
84 or 116 bytes, depending on if the op list needs perspective information.

Bug: chromium:915025
Bug: chromium:917242
Change-Id: If37ee122847b0c32604bb45dc2a1326b544f9cf6
Reviewed-on: https://skia-review.googlesource.com/c/180644
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-01-03 21:31:52 +00:00
Mike Reed
1a88dd52d7 hide drawpostext etc.
Bug: skia:
Change-Id: I918f732072af9a1f6f2ebd94cc53eeb5d6a0d5b8
Reviewed-on: https://skia-review.googlesource.com/c/180361
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-01-02 21:29:06 +00:00
Mike Reed
191e64b6c6 pass a font to GlyphRunBuilder
- avoid using legacy paint->font converter
- call out that drawText exists just for testing
- simplify drawText to assume UTF8

Bug: skia:
Change-Id: Ide14d8581d4744827d2282e7983cc5e19070b21e
Reviewed-on: https://skia-review.googlesource.com/c/180641
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-01-02 21:02:33 +00:00
Hal Canary
dd9003afda SkPDF: wait for jobs to complete on abort()
Before, we could only wait for all reserved objects to serialize.

The new unit test `SkPDF_abort_jobs` crashed before this change.

Change-Id: Ia2fcb33251c6c32c125f631ed3eeb619f616bef3
Reviewed-on: https://skia-review.googlesource.com/c/179856
Auto-Submit: Hal Canary <halcanary@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-01-02 12:15:05 +00:00
Mike Reed
212e9060ed don't use drawPosText
Skia can now build if we mark drawPosText as private,
Will hide/remove next (after Chrome CL)

Bug: skia:
Change-Id: I156560b025c119af302545bb5bd60678f7b8e8f7
Reviewed-on: https://skia-review.googlesource.com/c/179985
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2018-12-25 23:07:35 +00:00
Mike Reed
0951cc212c Revert "Reland "Revert "serialize fonts instead of paints"""
This reverts commit f4dd96c6b8.

Fix: restore flattening bounds (cc_unittests fail w/o this)
     not sure why this should matter...

Bug: skia:
Change-Id: I37c532b0e5e0c7be3c4cd0d272faa7109f12a5d9
Reviewed-on: https://skia-review.googlesource.com/c/179883
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-12-21 21:44:52 +00:00
Mike Reed
f4dd96c6b8 Reland "Revert "serialize fonts instead of paints""
This reverts commit 9803b8f1d1.

Reason for revert: break cc/paint/oop_pixeltest.cc ?

Original change's description:
> Revert "Revert "serialize fonts instead of paints""
> 
> 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>

TBR=reed@google.com

Change-Id: Ic20b22ae305f9b22863f6f441d45457c4e565f66
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/179882
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-12-21 20:49:58 +00:00
Cary Clark
9d6049a96f fix pathops bug 8380
Paths to intersect have two nearly coincident cubics. Where they
cross, the intersection error makes the curves start at slightly
different points. To sort the intersection, one curve is translated
to the start of the opposite point, moving it from one side to the
other, introducing a winding error.

The fix looks for that error in a very tiny range (enlarging that
range causes other tests that now pass to fail). This fix is very
fragile and points to the need for a better approach than sorting
angles to find winding values, as documented in the bug.

Also renamed some angle functions to show that they operate only
on lines and not general curves.

All tests pass with this fix:
./out/release/pathops_unittest -V -x
./out/debug/pathops_unittest -V -x

TBR=reed@google.com
Bug: skia:8380
Change-Id: I04e53d4c6a96035f661a4c9f31a17055ce13e3eb
Reviewed-on: https://skia-review.googlesource.com/c/179241
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-12-21 19:15:54 +00:00
Mike Reed
9803b8f1d1 Revert "Revert "serialize fonts instead of paints""
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>
2018-12-21 16:13:57 +00:00
Mike Reed
576633cf57 Revert "serialize fonts instead of paints"
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>
2018-12-21 15:35:57 +00:00
Mike Reed
f1ae66bedd 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>
2018-12-21 14:59:17 +00:00
Hal Canary
d104cc4730 SkPDF: debugging flag SK_PDF_BASE85_BINARY applies to JPEG
Change-Id: I16e21d492df7de5d17fcce6070642e3e732b7d96
Reviewed-on: https://skia-review.googlesource.com/c/179727
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2018-12-21 14:34:58 +00:00
Mike Reed
df3d225e80 use SkFont for measuring and paths
Bug: skia:
Change-Id: I1810edfef6e04be0380bac0eeab5450fe302e078
Reviewed-on: https://skia-review.googlesource.com/c/179728
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-12-20 22:43:05 +00:00
Jim Van Verth
578b089986 Revert "Tweak Plot size to try to get better perf."
This reverts commit fdcbe206f5.

Reason for revert: Produced a further perf regression.

Original change's description:
> Tweak Plot size to try to get better perf.
> 
> Large plots allow tighter packing of large glyphs, but smaller plots
> take less time to update. Trying a size in between for the largest
> A8 size.
> 
> Bug: skia:8642
> Change-Id: Ib6d7651b70fe3a2101a3bfc5b367c433123cb914
> Reviewed-on: https://skia-review.googlesource.com/c/179242
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

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

Bug: skia:8642
Change-Id: I9bc32abfae1fb4a6380b2fd5c0a1ea269447c534
Reviewed-on: https://skia-review.googlesource.com/c/179726
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2018-12-20 21:16:54 +00:00
Mike Reed
30cf62bf48 add rsxform runs to textblobs
Bug: skia:
Change-Id: I72a1921a0300dfdac567e25acbdf20cc168ac0be
Reviewed-on: https://skia-review.googlesource.com/c/175834
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-12-20 16:46:09 +00:00
Hal Canary
748015840e SkPDF: SkPDFObject no longer reference-counted!
* sed 's/sk_sp<SkPDF\(Object\|Array\|Dict\)>/std::unique_ptr<SkPDF\1>/g'
  * Added SkPDFMakeDict()
  * Let SkPDFMakeArray() take zero arguments.

Bug: skia:8630

Change-Id: I08dc11e974f1d71e09a33af6bdbcb5f01b07d186
Reviewed-on: https://skia-review.googlesource.com/c/179063
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
2018-12-19 22:45:06 +00:00
Brian Salomon
614c1a838a Add idle texture callback mechanism.
A proc can be registered with a GrTexture. The proc will be called when
it is safe to delete the texture is "idle." Idle means it referred to
outside of GrResourceCache and that the I/O operations on the GPU are
completed (this latter part applieas to Vulkan only).

The intended use case for this is to call promise image texture release
procs once we start caching GrTextures for deinstantiated promise
images.

Bug= skia:8613

Change-Id: Idce9a4292fef7b15370a053060d8878a9d6828fa
Reviewed-on: https://skia-review.googlesource.com/c/178937
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-12-19 21:12:42 +00:00
Jim Van Verth
fdcbe206f5 Tweak Plot size to try to get better perf.
Large plots allow tighter packing of large glyphs, but smaller plots
take less time to update. Trying a size in between for the largest
A8 size.

Bug: skia:8642
Change-Id: Ib6d7651b70fe3a2101a3bfc5b367c433123cb914
Reviewed-on: https://skia-review.googlesource.com/c/179242
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2018-12-19 20:43:03 +00:00
Ethan Nicholas
92e01cfc82 added SPIR-V persistent cache support for Vulkan
Bug: skia:
Change-Id: Iec9053655f6ec2cc49a90c4b686995feaff6e488
Reviewed-on: https://skia-review.googlesource.com/c/178923
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2018-12-19 18:42:18 +00:00
Mike Reed
148b7fd3ad add saveBehind to canvas
Bug: skia:
Change-Id: I62e48b116b2d7efef585d4f465441f24ae4d2b29
Reviewed-on: https://skia-review.googlesource.com/c/177892
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-12-19 14:44:09 +00:00
Hal Canary
f34131ae9b SkPDF: even more PDFIndirectRefs
* SkPDFUnion.h hidden.
  * SkPDFObjectSerializer::serializeObject gone.
  * SkPDFDocument::serialize gone
  * SkPDFMetadata::MakeXMPObject return PDFIndirectRef
  * SkPDFTag rewritten from scratch.
  * SkPDFObject::addResources virtual gone.
  * SkPDFObject::drop virtual gone.
  * SkPDFArray::appendObjRef gone.
  * SkPDFDict::insertObjRef gone.
  * SkPDFDict::Record becomes std::pair
  * SkPDFObjNumMap gone;
  * SkPDFObject::fIndirectReference gone;

Bug: skia:8630
Change-Id: I7425eef30548b54f10fbfe96dd502800cb150caf
Reviewed-on: https://skia-review.googlesource.com/c/178935
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2018-12-19 03:20:42 +00:00
Mike Klein
dac694dbaf draw big images (with raster pipeline)
It's probably nicer to draw these images than not draw them.

Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Change-Id: I9f8df081c8256d345ad2d8bbbb30dbad982ad94e
Reviewed-on: https://skia-review.googlesource.com/c/178981
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-12-18 22:41:30 +00:00
Hal Canary
9a3f554154 SkPDF: refactor streams, experimental threading
All PDF Streams are immediatly serialized, and are never long-lived
    in memory.

    if EXPERIMENTAL fExecutor is set on the Document, streams are
    compressed in parallel.

    Results for PDFBigDocBench:

        without patch                    1807885.01 μs
        with    patch without executor   1802808.35 μs
        with    patch with    executor    246313.72 μs

    SkPDFStreamOut() function replaces SkPDFStream classes.

    Page resources are all serialized early.

    Several Document-level objects are serialzied early.

    SkUUID introduced as top-level object.

    Many {insert|append}ObjRef() converted to memory efficient
    {insert|append}Ref().

Bug: skia:8630
Change-Id: Ic336917d0c8b9ac1c2423b43bfe9b49a3533fbff
Reviewed-on: https://skia-review.googlesource.com/c/176588
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2018-12-18 20:48:25 +00:00
Mike Klein
7dfe6d9ea7 minor Sk4px cleanup
I've removed a bunch of unused code,
inlined routines that are only used once,
removed platform code where a portable code works fine,
and renamed methods and updated comments.

I'm thinking about getting rid of Sk4px entirely, and boiling it down
instead to a couple helper methods on Sk16b/Sk16h.  This is a start.

Change-Id: I35b6c44710aa2cefe8c1e07fc2cb877a4042e8a5
Reviewed-on: https://skia-review.googlesource.com/c/178985
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2018-12-18 20:46:25 +00:00