Commit Graph

6563 Commits

Author SHA1 Message Date
Brian Salomon
35ba614dc5 Remove GrGpuResource::abandon from the public API.
Bug: skia:7966
Change-Id: I222db4f4bc765fad3e5f1461f3a8f3c663bb9429
Reviewed-on: https://skia-review.googlesource.com/c/186545
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-01-25 15:37:20 +00:00
Brian Salomon
9bc76d96f9 Change the meaning of GrBudgetedType::kUnbudgetedUncacheable.
kUnbudgetedCacheable now means that the resource is never purged
until its unique key is removed.

This fixes an issue where a cached texture for a promise image
might get purged by cache pressure. This in turn could cause
Skia to call the promise image's Fulfill proc multiple times with
no intervening Release calls. The balancing Release calls would
occur, but the policy is that each Fulfill should be balanced by
Release *before* another Fulfill.

Update/add unit tests.

Bug: chromium:922851
Change-Id: I6411e413b3104721ca4bb6e7f07b3b73d14cbcf9
Reviewed-on: https://skia-review.googlesource.com/c/186361
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-01-25 14:13:00 +00:00
Brian Salomon
aa6ca0a8bf Require explicit GrWrapCacheable specification in more places.
Make all wrapped resources be kUnbudgetedUncacheable except those
created by AHardwareBuffer image generators and as backings for promise
images.

Make all non-wrapped unbudgeted resources be kUnbudgetedUncacheable.

Update unit tests to mostly use GrWrapCacheable::kNo except where they
are testing the distinction.

Update unit tests for new expectations.
Bug: chromium:922851
Change-Id: I4d3bdaa161ffc76390f26334bcb7e2b47dd9319d
Reviewed-on: https://skia-review.googlesource.com/c/185004
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-01-25 00:29:27 +00:00
Brian Salomon
fa2ebeaf33 Replace bool purgeImmediately with enum GrWrapCacheable.
Store budgeted status as a tri-state enum on GrGpuResource:
kBudgeted
kUnbudgetedCacheable
kUnbudgetedUncacheable

Uncacheable vs. Cacheable captures the current distinction between
wrapped resources created with purgeImmediately or !purgeImmediately.

Non-wrapped and unbudgeted resources are all kUnbudgetedCacheable to
match current behavior.

This change just introduces the new types. No behavior is changed.

Bug: chromium:922851

Change-Id: Ic2387bf321cf9b56b4c9ffd9dbef8ade60f9cb98
Reviewed-on: https://skia-review.googlesource.com/c/185003
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-01-24 21:26:24 +00:00
Brian Osman
5deadca8fe Remove nearly all use of SkColorSpaceTransferFn
Most interfaces had migrated to skcms_TransferFunction. Having both was
awkward in several places, so this (almost) finishes the migration. Some
clients are calling SkICC::WriteToICC, so that's left intact. After this
CL, those clients can switch to using SkWriteICCProfile directly, and
WriteToICC can be deleted.

Bug: skia:
Change-Id: I46ebaeb1f5b20bf0c620e8a620e73ee323a1de31
Reviewed-on: https://skia-review.googlesource.com/c/186541
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-01-24 17:45:19 +00:00
Herb Derby
087fad7900 Add getTypefaceOrDefault and refTypefaceOrDefault
* 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>
2019-01-23 18:52:09 +00:00
Chris Dalton
945ee652d7 Enforce non-overlap constraint from GrRenderTargetOpList
Enforces this constraint from one central location, rather than
relying on each Op to remember to check if overlap is allowed from its
onCombineIfPossible method.

Fixes an issue where we need to check the total bounds of both chains
for overlap (not the bounds of individual Ops).

Bug: skia:8671
Change-Id: I163651c868847884459acfc00d13ffdfca3a27c3
Reviewed-on: https://skia-review.googlesource.com/c/185815
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-01-23 16:48:15 +00:00
Mike Reed
77f94ea72b Move more utils into SkFontPriv, IWYU
Fissioned from https://skia-review.googlesource.com/c/skia/+/185460

Bug: skia:
Change-Id: Iaf980e931c17196f917602fc58fc39ab51e3d248
Reviewed-on: https://skia-review.googlesource.com/c/185840
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-01-22 22:24:03 +00:00
Brian Osman
02518801df Remove SkGammaNamed / gammaNamed() from SkColorSpace
Note: This removes from the public API. The two most commonly
checked values from gammaNamed can still be tested with
gammaCloseToSRGB and gammaIsLinear.

Others can be tested for (exact or approximate) equality by
calling isNumericalTransferFn, and testing the resulting
skcms_TransferFunction in any method the client wants.

Bug: skia:
Change-Id: I9b63ffea81bba461795cad946050c7083b02eec8
Reviewed-on: https://skia-review.googlesource.com/c/185684
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-01-22 20:52:35 +00:00
Hal Canary
02738a86e5 Revert "hide hinting and flag enums with PAINT_FLAGS"
This reverts commit 5d052dac3a.

Reason for revert: BREAKS CHROMIUM ROLL.

https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/fonts/win/font_platform_data_win.cc?l=49
|   FAILED: obj/third_party/blink/renderer/platform/platform/font_platform_data_win.obj
|   ../../third_party/blink/renderer/platform/fonts/win/font_platform_data_win.cc(49,29):
|     error: no member named 'kLCDRenderText_Flag' in 'SkPaint'
|     if (text_flags & SkPaint::kLCDRenderText_Flag) {
|                      ~~~~~~~~~^
|   ../../third_party/blink/renderer/platform/fonts/win/font_platform_data_win.cc(51,36):
|     error: no member named 'kAntiAlias_Flag' in 'SkPaint'
|     } else if (text_flags & SkPaint::kAntiAlias_Flag) {
|                             ~~~~~~~~~^
|   ../../third_party/blink/renderer/platform/fonts/win/font_platform_data_win.cc(56,52):
|     error: no member named 'kSubpixelText_Flag' in 'SkPaint'
|     font->setSubpixel(SkToBool(text_flags & SkPaint::kSubpixelText_Flag));
|                                             ~~~~~~~~~^
|   ../../third_party/blink/renderer/platform/fonts/win/font_platform_data_win.cc(64,29):
|     error: no member named 'kAntiAlias_Flag' in 'SkPaint'
|     if (text_flags & SkPaint::kAntiAlias_Flag)
|                      ~~~~~~~~~^
|   ../../third_party/blink/renderer/platform/fonts/win/font_platform_data_win.cc(85,27):
|     error: no member named 'kAntiAlias_Flag' in 'SkPaint'
|                  ? SkPaint::kAntiAlias_Flag
|                    ~~~~~~~~~^
|   ../../third_party/blink/renderer/platform/fonts/win/font_platform_data_win.cc(91,35):
|     error: no member named 'kLCDRenderText_Flag' in 'SkPaint'
|                          ? SkPaint::kLCDRenderText_Flag
|                            ~~~~~~~~~^
|   ../../third_party/blink/renderer/platform/fonts/win/font_platform_data_win.cc(93,27):
|     error: no member named 'kAntiAlias_Flag' in 'SkPaint'
|       text_flags = SkPaint::kAntiAlias_Flag | lcd_flag;
|                    ~~~~~~~~~^
|   ../../third_party/blink/renderer/platform/fonts/win/font_platform_data_win.cc(101,28):
|     error: no member named 'kAntiAlias_Flag' in 'SkPaint'
|       text_flags |= SkPaint::kAntiAlias_Flag;
|                     ~~~~~~~~~^
|   8 errors generated.

Original change's description:
> hide hinting and flag enums with PAINT_FLAGS
> 
> A preflight for https://skia-review.googlesource.com/c/skia/+/185460
> 
> Bug: skia:2664
> Change-Id: I83f7f9cd500e8507b559462835477ba8ae7c11ab
> Reviewed-on: https://skia-review.googlesource.com/c/185540
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>
> Auto-Submit: Mike Reed <reed@google.com>

TBR=reed@google.com

Change-Id: I4d1581a7e29267ad459ed31d4885b823fa00066f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:2664
Reviewed-on: https://skia-review.googlesource.com/c/185680
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-01-21 18:51:39 +00:00
Mike Reed
5d052dac3a hide hinting and flag enums with PAINT_FLAGS
A preflight for https://skia-review.googlesource.com/c/skia/+/185460

Bug: skia:2664
Change-Id: I83f7f9cd500e8507b559462835477ba8ae7c11ab
Reviewed-on: https://skia-review.googlesource.com/c/185540
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-01-21 15:45:37 +00:00
Hal Canary
3026d4b1b8 SkDocument: use auto for MakeDocument().
A later CL will make this return a unique_ptr<SkDocument>.

Bug: skia:5972
Change-Id: Ie10d6c07d5f2524ecb71d906db0d37427827225d
Reviewed-on: https://skia-review.googlesource.com/c/181660
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-01-17 19:16:28 +00:00
Brian Salomon
1bf0ed8584 Make GrTexture caching for SkPromiseImageTexture work when same texture
fulfills a different SkImage.

Bug: skia:8613
Change-Id: I7ee14112c69f8aaef223a37dda455259b501a2bf
Reviewed-on: https://skia-review.googlesource.com/c/184440
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-01-16 22:06:53 +00:00
Chris Dalton
4b62aed973 Return GrProcessorSet::Analysis from GrDrawOp::finalize
Bug: skia:8671
Change-Id: Ib35d1642659021419f408bf19b1b0dc0066e8df2
Reviewed-on: https://skia-review.googlesource.com/c/184160
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-01-16 21:22:38 +00:00
Herb Derby
5fd955e36d Rename SkGlyphCache -> SkStrike
Change-Id: I51ca9f61feb0d4f7352ed634b7070327f31ccf05
Reviewed-on: https://skia-review.googlesource.com/c/184400
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-01-16 18:28:28 +00:00
Jim Van Verth
1676cb9282 Restore ETC1 compressed texture support.
Brings back GL ETC1 support and adds Vulkan support as well.

Bug: skia:8684
Change-Id: Ie65da0a3172793081f0e4072f161bfb9b14678bc
Reviewed-on: https://skia-review.googlesource.com/c/179724
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-01-15 19:56:28 +00:00
Chris Dalton
330b08511d Remove "canCombineOverlappedStencilAndCover"
This looks like a relic from nvpr text.

Bug: skia:8671
Change-Id: I417c7b4565208e3bf91a3891fa59ba50308a8139
Reviewed-on: https://skia-review.googlesource.com/c/183884
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-01-15 02:15:25 +00:00
Mike Reed
31ba6feaf6 unflatten directly to font for legacy skps
All of this extra code/parameter-passing for fonts to the paint unflattener
can go away when we can drop support for older skps

Bug: skia:
Change-Id: I4d626f0925a54564b7c386ed80953a0291c8bc1a
Reviewed-on: https://skia-review.googlesource.com/c/183863
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2019-01-15 01:25:55 +00:00
Hal Canary
4ca9fa30ba SkPDF: unify Canon and Document
motivation:  The Document has become intrusive enough that we almost
always have a pointer to the Document on hand anyways.

Also: update document.

Also: forward declare more things in headers.

Also, don't try to clean up resources when abort() or close() is called.
It is easy enough for the client to delete the Document when done.

Change-Id: I21aeed37f26ba16d68af041d9317adf00e9a61f2
Reviewed-on: https://skia-review.googlesource.com/c/180646
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-01-14 17:56:14 +00:00
Brian Salomon
3f4cd774e6 Make SkPromiseImageTexture ref counted.
This makes the API easier to use in Chrome.

It is no longer required to pass the SkPromiseImageTexture to the
release proc.

Bug: skia:
Change-Id: I6636401f6a7915d3ad15e890718638bc91a58cc4
Reviewed-on: https://skia-review.googlesource.com/c/183383
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-01-14 16:19:01 +00:00
Michael Ludwig
a21d196602 Move clear-as-draw caps into GrCaps
Bug: skia:
Change-Id: Ib029f337f5e61366e2550e77dc99310b44d03f84
Reviewed-on: https://skia-review.googlesource.com/c/182970
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2019-01-14 15:27:44 +00:00
Ethan Nicholas
a7ceb50f50 added PLS support to SkSL
Bug: skia:
Change-Id: I77fb0861c8cba0f86e3d0521d2ad77e204487d21
Reviewed-on: https://skia-review.googlesource.com/c/99921
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-01-11 18:14:50 +00:00
Robert Phillips
27467658dd Reduce reliance on the SkImage_Gpu's GrContext pointer
The SkImages aren't guaranteed to have a full fledged GrContext (e.g., if they are promise images created outside of a DDL recorder). This CL starts the process if lessening Skia's reliance on what ever the SkImage has cached.

Change-Id: I0181d09417e1ea2ced7706a722e2815f3ceee870
Reviewed-on: https://skia-review.googlesource.com/c/182974
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-01-11 16:07:56 +00:00
Mike Reed
e5f9cfad7b expand flag to include all text-related paint fields
Bug: skia:
Change-Id: I8453a6d607df4902cd05c5c9bc6162feda04ef9c
Reviewed-on: https://skia-review.googlesource.com/c/182969
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-01-10 20:06:07 +00:00
Derek Sollenberger
e6fb76bbd2 Add additional information (e.g. colorspace) to the GpuDrawHandler
Bug: b/115613038
Change-Id: I375fc5f1bac13557b35e39658d678c61f70024c8
Reviewed-on: https://skia-review.googlesource.com/c/182900
Commit-Queue: Derek Sollenberger <djsollen@google.com>
Auto-Submit: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-01-10 18:49:52 +00:00
Herb Derby
f6fca2668d Make a ctor for SkGlyph
Change-Id: I21a5ed81d3e161ddf8a838ea9ac0414265b00ae6
Reviewed-on: https://skia-review.googlesource.com/c/182701
Auto-Submit: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-01-10 18:38:11 +00:00
Brian Salomon
cdd8a0a0e8 Revert "Revert "Reuse GrTexture instances when the same GrBackendTexture is used to""
This reverts commit 426ba463d5.

Bug: skia:8613
Change-Id: Iacaf40549369110aa95015e8d4579ec41db22d13
Reviewed-on: https://skia-review.googlesource.com/c/182963
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-01-10 17:51:21 +00:00
Brian Salomon
426ba463d5 Revert "Reuse GrTexture instances when the same GrBackendTexture is used to"
This reverts commit 559c617137.

Reason for revert: breaking things

Original change's description:
> Reuse GrTexture instances when the same GrBackendTexture is used to
> repeatedly fulfill a promise SkImage.
> 
> Bug: skia:8613
> 
> Change-Id: I35c76435d630d2daa034e0c3efb59666bfd6882a
> Reviewed-on: https://skia-review.googlesource.com/c/175820
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: I7548809945d0a875fdb9387398bbc45e733c0846
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:8613
Reviewed-on: https://skia-review.googlesource.com/c/182960
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-01-10 16:33:11 +00:00
Brian Salomon
559c617137 Reuse GrTexture instances when the same GrBackendTexture is used to
repeatedly fulfill a promise SkImage.

Bug: skia:8613

Change-Id: I35c76435d630d2daa034e0c3efb59666bfd6882a
Reviewed-on: https://skia-review.googlesource.com/c/175820
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-01-10 16:10:59 +00:00
Brian Osman
c6444d2f26 Enable wide color support in CCPR
Unlike other ops, always use half-float colors. The logic around the
Instance struct makes dynamically switching color size tricky.
CCPR stores color in a per-instance attribute though, so the cost of
always using FP16 is much lower.

Bug: skia:
Change-Id: I9c0c64940f74f915a18417a5830030558e065d28
Reviewed-on: https://skia-review.googlesource.com/c/182760
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-01-10 13:53:31 +00:00
Mike Reed
22bee5ac77 Update FontHostStreamTest to use SkFont
This file was adjusted 3 times, beginning here

commit 212e9060ed
Author: Mike Reed <reed@google.com>
Date:   Tue Dec 25 17:35:49 2018 -0500

to try to update it to use SkFont. Along the way we broke the part where
it compares drawing with the typeface pre and post streaming. This CL
restores the original test, and then updated it to use SkFont.

After this CL, we should be able to move SK_SUPPORT_LEGACY_PAINT_FONT_FIELDS
to clients, having them opt-in.

Bug: skia:
Change-Id: Id786160322f8530f5d0c65b30a0c228139b39d61
Reviewed-on: https://skia-review.googlesource.com/c/182805
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-01-10 12:06:05 +00:00
Hal Canary
f1921f44e1 drawText Cleanup, part 6
Change-Id: I9dc5571546dd4fe547f272cb1a5c6f745bef9d05
Reviewed-on: https://skia-review.googlesource.com/c/182261
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
2019-01-09 20:04:58 +00:00
Mike Klein
4284ec6ba5 add SkTHashTable::LookupOrNull()
This should help avoid confusion from T**.

Change-Id: I1851baa2a55714721fa935d234b6a4a1c6d6504f
Reviewed-on: https://skia-review.googlesource.com/c/182562
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-01-09 18:51:22 +00:00
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