When a client calls makeRasterImage, they're likely to hold on to that
image, and throw away the source (GPU or Lazy). In that situation, it
makes no sense to leave the buffer in the resource cache.
Change-Id: Ic0be8ceb643ed9196526469516be0d200bea42fd
Bug: b/144232910
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263347
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This is working in the GL and Vulkan back ends. MacOS only supports the RGBA8 variants.
For mobile devices, probably only nVidia GPUs will support this.
Bug: skia:9680
Change-Id: I9d886b72232a031603e93e46059a97a8aa288b3c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261093
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This is just the API level interface(s) and the backend virtual calls needed to implement them.
Bug: skia:9680
Change-Id: I6c655751e23ce18c6a184c925e8d472902e8a478
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259976
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Following CLs use CompressionType much more widely so let's switch it first.
Bug: skia:9680
Change-Id: Ie8847f24936e90dd85e0ad79cbe5542d68c87b12
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258882
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Change-Id: I01259b685859e2d95e4b87c0f611ccc074bd5229
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254807
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
The conversion math for a given space can be fully derived
from the Kr and Kb terms (plus the headroom/footroom), so
avoid redundant values that can be wrong.
And, no need to list every possible value of an enum param,
especially when the generated doxygen links to the type's
documentation, which has all the values listed.
Change-Id: I64ce8cfd5ec7ff74dc3b878202b13d0d483e1db6
Bug: skia:9543
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251764
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
These unused comparison operators are the only users of
<functional> in SkRefCnt.h, for std::less. <functional>
is an expensive header to compile, and SkRefCnt.h is popular,
so it helps to cut dependencies like this.
Mostly we just need to add #include <functional> in a few
places that were picking it up via SkRefCnt.h.
In SkPixmapPriv.h, it looked simpler to template the argument,
since everything was inline anyway.
Change-Id: I7c125bb26a04199847357c729a1b178256c6ef8d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/236942
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This reverts commit a0c9d43c20.
Reason for revert: G3 references should all be updated.
Original change's description:
> Revert "Remove old version of MakeCrossContextFromPixmap"
>
> This reverts commit 237a95fe7b.
>
> Reason for revert: Flutter in Google 3.
>
> Original change's description:
> > Remove old version of MakeCrossContextFromPixmap
> >
> > Client code has been updated
> >
> > Change-Id: Ic6102effc63c0f4f00a47b8876107aa0b2306e32
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235296
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Brian Osman <brianosman@google.com>
>
> TBR=brianosman@google.com,reed@google.com
>
> Change-Id: I0a290030e55987c690b51470a381aca2b6faab2f
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235397
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
TBR=brianosman@google.com,reed@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I778bccf7b1c085413a3d119169686e68777bc344
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235856
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This reverts commit 237a95fe7b.
Reason for revert: Flutter in Google 3.
Original change's description:
> Remove old version of MakeCrossContextFromPixmap
>
> Client code has been updated
>
> Change-Id: Ic6102effc63c0f4f00a47b8876107aa0b2306e32
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235296
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
TBR=brianosman@google.com,reed@google.com
Change-Id: I0a290030e55987c690b51470a381aca2b6faab2f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235397
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Client code has been updated to call new version
Change-Id: Id7e18154fe273590f04435c936121b3a3e3665df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235317
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Client code has been updated
Change-Id: Ic6102effc63c0f4f00a47b8876107aa0b2306e32
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235296
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Change-Id: I962e923a4994eb549a9c1002323f33d05b936b84
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/234912
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This reinterprets the contents of an image as though they were in a
different color space. Helpful for tools and debug visualization.
Bug: chromium:795132 chromium:985500
Change-Id: Ia8739bbd73d72249b8bee9d51dfa11d560a2a1f5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/234328
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Old version still exists until client code is migrated.
Change-Id: I087b6b977f586d334f9a20954e7ed7b5e4b7ea5e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/234579
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
These are meant to contrast MakeFromEncoded(), and emphasize that it is deferred/cached,
while the new methods are not.
Change-Id: I83ac22394cb14cdc84ff8507a514bf708734b84f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/234476
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This reverts commit 693bc2bae5.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Revert "Add flush() to SkImage."
>
> This reverts commit d0503a72ac.
>
> Reason for revert: <INSERT REASONING HERE>
>
> Original change's description:
> > Add flush() to SkImage.
> >
> > This allows a client to ensure all uses of a texture-backed image have
> > been flushed.
> >
> > Does nothing if the image isn't texture-backed.
> >
> > The implementation adds support for triggering a flush if any of a set
> > of proxies are used rather than just a single proxy.
> >
> > Change-Id: I358882d9737e63c6e69b924c0767f49b8f8f36ec
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212405
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
>
> Change-Id: Ie376bf4225307f45b8fb3eb4a63bf84702365797
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212884
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
Change-Id: Idcba378ce2e3af0af9d0eef35737670055539ec5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212960
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This reverts commit d0503a72ac.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Add flush() to SkImage.
>
> This allows a client to ensure all uses of a texture-backed image have
> been flushed.
>
> Does nothing if the image isn't texture-backed.
>
> The implementation adds support for triggering a flush if any of a set
> of proxies are used rather than just a single proxy.
>
> Change-Id: I358882d9737e63c6e69b924c0767f49b8f8f36ec
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212405
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
Change-Id: Ie376bf4225307f45b8fb3eb4a63bf84702365797
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212884
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This allows a client to ensure all uses of a texture-backed image have
been flushed.
Does nothing if the image isn't texture-backed.
The implementation adds support for triggering a flush if any of a set
of proxies are used rather than just a single proxy.
Change-Id: I358882d9737e63c6e69b924c0767f49b8f8f36ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212405
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This adds readPixel and a partial stub of window.createImageData
Change-Id: Iee992312b9331b71852fe2198f844a7e4ae9e963
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211344
Reviewed-by: Mike Reed <reed@google.com>
Current strategy: everything from the top
Things to look at first are the manual changes:
- added tools/rewrite_includes.py
- removed -Idirectives from BUILD.gn
- various compile.sh simplifications
- tweak tools/embed_resources.py
- update gn/find_headers.py to write paths from the top
- update gn/gn_to_bp.py SkUserConfig.h layout
so that #include "include/config/SkUserConfig.h" always
gets the header we want.
No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
- move shader factories to their host (e.g. picture->makeShader)
More to do to formally deprecated SkShader::TileMode
Bug: skia:8937
Change-Id: I101e42fb9fba4ab91d028a34888f1fde16fdece4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205589
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
We're moving in a different direction for Skia documentation. We no
longer run bookmaker on the bots, and things have already degraded such
that it can't be run. This leaves the generated markdown in place for
the last set of docs that were generated (which are still useful until
the Doxygen docs catch up).
See also: https://skia-review.googlesource.com/c/skia/+/198162
Docs-Preview: https://skia.org/?cl=203464
Bug: skia:
Change-Id: I2f967a9c17dbc1cc899947d365071ef69cfb8ad7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203464
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Previously calling SkImage::alphaType(), for example, woult call
the virtual SkImage_Base::onImageInfo() which would construct
and return a temporary SkImageInfo. This often meant ref-ing a
SkColorSpace.
Change-Id: I54975a6b20dea5bc84739068df0c81c022a12067
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202711
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This utility color space just maps Y to R, U to G and V to B when flattening or accessing the YUV planes. Clients can then add a colorFilter to directly manipulate the YUV values.
This cannot land in Skia until the following CL lands in Chrome:
https://chromium-review.googlesource.com/c/chromium/src/+/1506004 (Update usage of Skia's SkYUVColorSpace enum to allow the addition of a new value)
Change-Id: Id9403ebbd009b45281d4d53fca52f68692d6c69f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198160
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This is a reland of 57263c2e0c
Original change's description:
> Add compressed data support for SkImage.
>
> Adds a new SkImage::MakeFromCompressed method which takes raw data,
> a size, and a compression method, and returns a GPU-backed
> image.
>
> Bug: skia:8684
> Change-Id: I570c9dafce283bcd64dfbef4fbe1c4bfeac6ce2a
> Reviewed-on: https://skia-review.googlesource.com/c/184484
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
Bug: skia:8684
Change-Id: I25fb320e8cc05e1c5afa6faa81e1a55ffd83a7a3
Reviewed-on: https://skia-review.googlesource.com/c/185200
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This reverts commit 57263c2e0c.
Reason for revert: assert failures in test bots.
Original change's description:
> Add compressed data support for SkImage.
>
> Adds a new SkImage::MakeFromCompressed method which takes raw data,
> a size, and a compression method, and returns a GPU-backed
> image.
>
> Bug: skia:8684
> Change-Id: I570c9dafce283bcd64dfbef4fbe1c4bfeac6ce2a
> Reviewed-on: https://skia-review.googlesource.com/c/184484
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=jvanverth@google.com,bsalomon@google.com,robertphillips@google.com,ericrk@google.com
Change-Id: If5705507f4aa34c6495fa72ff1a927cb18eca6ba
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:8684
Reviewed-on: https://skia-review.googlesource.com/c/185002
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Adds a new SkImage::MakeFromCompressed method which takes raw data,
a size, and a compression method, and returns a GPU-backed
image.
Bug: skia:8684
Change-Id: I570c9dafce283bcd64dfbef4fbe1c4bfeac6ce2a
Reviewed-on: https://skia-review.googlesource.com/c/184484
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This reverts commit 9a97c96c9c.
This works like makeColorSpace, but allows changing color type as well.
Added a GM to test, although the GM demonstrates several ways this can
fail (especially when using this on lazy images).
For simple use-cases (8888 <-> F16), everything should be fine.
For the reland, add logic to the GM to guard against context abandon
failures, and to ensure that lazy images can be decoded (by calling
makeRasterImage) before trying to draw them. That prevents the DDL
recorder from seeing them.
Bug: skia:
Change-Id: Ibc7b07c3399979b1a44d85a38424e5487e606607
Reviewed-on: https://skia-review.googlesource.com/c/183800
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This reverts commit f855c3c785.
Reason for revert: DDL and Abandon failures.
Original change's description:
> Add SkImage::makeColorTypeAndColorSpace
>
> This works like makeColorSpace, but allows changing color type as well.
> Added a GM to test, although the GM demonstrates several ways this can
> fail (especially when using this on lazy images).
>
> For simple use-cases (8888 <-> F16), everything should be fine.
>
> Bug: skia:8618
> Change-Id: If4c173c0dd4abaf4f8e63b7ae0ffcf8a08c7e9ef
> Reviewed-on: https://skia-review.googlesource.com/c/183382
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>
TBR=mtklein@google.com,bsalomon@google.com,brianosman@google.com
Change-Id: I5d7a72e2b674224351e4b0c982408f89780708f8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:8618
Reviewed-on: https://skia-review.googlesource.com/c/183392
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This works like makeColorSpace, but allows changing color type as well.
Added a GM to test, although the GM demonstrates several ways this can
fail (especially when using this on lazy images).
For simple use-cases (8888 <-> F16), everything should be fine.
Bug: skia:8618
Change-Id: If4c173c0dd4abaf4f8e63b7ae0ffcf8a08c7e9ef
Reviewed-on: https://skia-review.googlesource.com/c/183382
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Klein <mtklein@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>
Bug: skia:7903
Change-Id: I41ee31ad3657aee372e22ec3e7a0a317e31b2791
Reviewed-on: https://skia-review.googlesource.com/c/171007
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Bookmaker does not require documentation for public symbols
described as "deprecated", "private", or "experimental".
Adding one of these words (case-insensitive) to the symbol
description in the include file tells bookmaker that the bmh file
should not include documentation, and the generated markdown
should omit it in its indices and descriptions.
Symbols marked as "to be deprecated" or "may be deprecated"
are still regarded as public and documented.
Private notes in the includes that start with TODO: are
omitted as well.
This CL updated generated includes to describe its symbols
accordingly. The includes will be fully regenerated in a future
CL. The corresponding documentation has been deleted from the
bmh files, and the web markup has been regenerated.
TBR=reed@google.com
Docs-Preview: https://skia.org/?cl=169830
Bug: skia:
Change-Id: Ie6ec3ccdadb7be9ac15db4811823a30948c4af25
Reviewed-on: https://skia-review.googlesource.com/c/169830
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
In preparation for upcoming changes to bookmaker
which validate more include contents, revise
generated files in include/core to fix various
errors.
Fixes include:
- references in comments to other Skia interface elements
- @param names agree with function declarations
- spelling typos
- generic references (e.g. 'x' in place of 'x-axis')
- lines longer than 100 columns
The fix to SkPath::rCubicTo triggered a parallel
fix to SkPath_Reference.bmh; other wed documentation
fixes will be in an upcoming CL.
TBR=reed@google.com
Docs-Preview: https://skia.org/?cl=166680
Bug: skia:
Change-Id: If734696dc64655f1cf40b121a180210c932b1d89
Reviewed-on: https://skia-review.googlesource.com/c/166680
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
* Remove more uses of colortype
* Add back SkImage_GpuYUVA::MakeFromYUVATextures
Bug: skia:7903
Change-Id: I3ee119d190db39c128516dbb78db34fe29ba3cce
Reviewed-on: https://skia-review.googlesource.com/c/165943
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
* Fixes isTextureBacked() for SkImage_GpuYUVA
* Hooks in SkImage_GpuYUVA::MakePromiseYUVATexture()
* Pass down plane texture sizes to MakePromiseYUVATexture()
* Move some other methods to SkImage_GpuBase.
Bug: skia:7901
Change-Id: I33d62c16b426abba5830f7168f9f8fd54a0cb093
Reviewed-on: https://skia-review.googlesource.com/c/161149
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=bsalomon@google.com
Bug: skia:7903
Change-Id: Ib5a3bdba99da4cfb79115d1ff7b2c014272a5556
Reviewed-on: https://skia-review.googlesource.com/c/159520
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Cary Clark <caryclark@google.com>
add docs for new SkImage methods
Also, the tool slightly adjusted the spacing
for the include comments, and fixed a few references.
TBR=bsalomon@google.com
Docs-Preview: https://skia.org/?cl=155160
Bug: skia:
Change-Id: I7977ca3048bd7d0c23f84db19f62f7accdcd77bb
Reviewed-on: https://skia-review.googlesource.com/155160
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
Add support for kBottomLeft_GrSurfaceOrigin origin for SkImage
backed by an Android hardware buffer.
Bug: b/115610873
Change-Id: I8ba142007ee01c3fc2fd48317b29388d07a7b6e0
Reviewed-on: https://skia-review.googlesource.com/154301
Commit-Queue: Stan Iliev <stani@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>