The issue is around needing to go from a float rect to a clipped (intersected
with the clip bounds) irect.
The old code promoted the clip bounds to rect,
intersected with the rect, and then rounded to ints. This is problematic
since convert float --> int can produce float values that are larger than
their int counter-parts. (e.g. int:67108863 becomes float:67108864).
This error goes on to confuse subsequent logic.
The fix is to round the rect to int first (knowing that very large floats
will saturate to maxint), and then intersect.
Bug: 927075
Change-Id: If6c7d72ff15184700b87532e1922e576d1348ee8
Reviewed-on: https://skia-review.googlesource.com/c/188307
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
This copies the hardware buffer unit test from, which was cherry picked
straight into skqp last year, into Skia proper.
There are not functional changes, but a few of the APIs have been updated
to work with newer Skia.
Bug: skia:
Change-Id: I2d7b2ed8b0b9314ca3e03e703a6a5ac53805275e
Reviewed-on: https://skia-review.googlesource.com/c/188034
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
SkiaRenderer does not delete promise image textures when they are released
but not done. Refulfilling promise image textures takes a significant amount
of CPU time. This allows us to fulfill each promise image once.
Bug: skia:8736
Change-Id: I7ad7fa9678ed0ec4bb714b71fbf920ab4a845409
Reviewed-on: https://skia-review.googlesource.com/c/188039
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Bug: b/122338652
Bug: b/77339676
getSampledDimensions is supposed to report dimensions that
SkAndroidCodec can decode to. But if SkAndroidCodec is respecting an
orientation that requires swapping the width and the height,
getSampledDimensions needs to do so, too.
Change-Id: I0cacefc2b02eb9832b8c029c88bcaaedcb2ba82b
Reviewed-on: https://skia-review.googlesource.com/c/188035
Auto-Submit: Leon Scroggins <scroggo@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Change-Id: I03d15a563eeb7ea187c7d48deffe00357dc55177
Reviewed-on: https://skia-review.googlesource.com/c/188032
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This begins the process of splitting GrContext into:
GrContext_Base, GrImageContext, GrRecordingContext and GrDirectContext.
Change-Id: I3c43045f2a5549b049e95791d65f74d4e16de36f
Reviewed-on: https://skia-review.googlesource.com/c/186878
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
No longer used by Chrome.
Change-Id: I842482490f132bb3aa3e85f847d8d4167f5595df
Reviewed-on: https://skia-review.googlesource.com/c/188029
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This just shuffles stuff around.
Change-Id: I90e24a73bf44dd3e88fc121a0528bf94e4fdead4
Reviewed-on: https://skia-review.googlesource.com/c/187786
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This just shuffles stuff around.
Change-Id: Ieab35f50945efe87512d7077cb994132f0e0b6ef
Reviewed-on: https://skia-review.googlesource.com/c/186874
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This reverts commit 3c03c851ad.
Modification was to copy/assign fBitfieldsUInt rather than fBitfields,
since fBitfields might be smaller, and therefore ignore some bits that
we do use in hashing, etc.
Bug: skia:
Change-Id: I5965d5d64bd22bd60f0da797fdfeeffb730588ea
Reviewed-on: https://skia-review.googlesource.com/c/187307
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>