SkSurface will already reject a rowBytes that does not align on a pixel
boundary. Push that check into SkImageInfo. This will make SkBitmap,
SkPixmap, SkMallocPixelRef, and SkImage_Raster, which already call
validRowBytes, make the same check. If an SkSurface cannot use a
non-pixel-aligned rowBytes, then an SkCanvas wrapping an SkBitmap should
not either.
Update MallocPixelRefTest to use a rowBytes that is still valid.
Change-Id: I848d94dbeab8b58b92877104dd67ea23a9d19ca8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265599
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Also add macro for ALL_COMPLETED
We plan to use this with ANGLE ES2 contexts.
Change-Id: I6c967fa9b9aefc41c31cd806aece8533f846f940
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265756
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This is mainly so we can test the compression code on macOS.
Bug: skia:9680
Change-Id: Ie0a2eacfe9100ee4ce4cc94c878d3032d6985832
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264480
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
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>
Flutter on the web wants to be able to extract arbitrary frames from
an animated image and pass those into functions like:
drawAtlas, drawImage, drawImageRect
This should allow that to happen w/o having to add lots of variants like
drawAnimatedImage. If this sticks, is drawAnimatedImage still useful?
(maybe it saves a copy?)
Change-Id: I99d7045c5dea61d0a1bd6d335c88e7517f2c4fc2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263020
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Change-Id: Iad9fadd113d0c97e8ece51df19c7824252d7eb9c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263197
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Change-Id: I0b11d4210c6e663cfb4854fc33e1396fd79fe9a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261780
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Implements tessellation support at the Ganesh level, and adds back
door methods for supplying raw GLSL strings directly to the OpenGL
driver. Adds a new gm to verify tessellation is works in GL.
Change-Id: Idfc285b955cbe5e8e6bf0475be8b518b0cc6ed2c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261196
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@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>
Bug: skia:9580
Change-Id: I663549dafc4239248e265bee8d6927bf5b259303
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259804
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This also now requires that when using a vulkan GrContext, the backing VkDevice,
Queue, and Instance must be alive when the GrContext is first destroyed or
abandoned. Additionally any GrBackendTextures created from the GrContext must
be deleted before destroying or abandoning the GrContext.
Bug: skia:9603
Change-Id: Ibf194d2ffdcddd61e34214d7d59a2d9a33c880e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257921
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Having it means you cannot write:
SkSize size;
float x, y;
size = {x , y};
clang allows it but GCC does not, claiming it is ambiguous between the
implicitly generated
SkSize& SkSize::operator=(const SkSize&)
and
SkSize& SkSize::operator=(const SkISize&)
clang gives the same error if the former is explicitly declared default.
Change-Id: I3b64436ef6aa669b3d87e7f37057c5dcb4add987
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257880
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
converting from YUV to RGB on GPU.
Change-Id: I872e1e85f3efccce7bf93d2f3d5f2a841b8a5b0f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257680
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Add a common way to make rect op for testing that uses a GP with a local
matrix.
Change-Id: I958d1230bd5067b2e4b60fcd374e2f7718681e43
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255782
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
The matrices we're using can produce very slightly out of range color
channels. This gives surprising results when in shader blending is used
for color burn and color dodge. After this change we clamp the RGB
values to 0..1 before applying premul.
Adds a GM modeled on a blink layout test that shows the problem using
SkImageMakeFromYUVAPixmaps.
Bug: skia:9619
Change-Id: I446d39763a7f5a2f7c5f61d94d163927d851baa3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253879
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
With these things exposed, I think Flutter will not need
CanvasKit to expose the very complex SkCodec API.
Change-Id: Iace1b496d1dcb8842181466e860e8f212aba7b48
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253542
Reviewed-by: Leon Scroggins <scroggo@google.com>
This reverts commit 701522798a.
Reason for revert: Maybe blocking the Android roll
Original change's description:
> Fully embrace skcms types in SkColorSpace API
>
> Remove the SkMatrix44 getter entirely.
>
> Change-Id: I25bfe68a7a9b21d8a8696415b517cb79fc2d7a94
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252596
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>
TBR=mtklein@google.com,brianosman@google.com,reed@google.com
Change-Id: Ic277d54d4ac8c84f00405946c927a3aee4e33068
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252801
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Remove the SkMatrix44 getter entirely.
Change-Id: I25bfe68a7a9b21d8a8696415b517cb79fc2d7a94
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252596
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Change-Id: Ie704f0f83b1034ff8ee1a5d3cd194e555cae20a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252600
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Remove the RGB/YUV helpers (use SkYUVMath instead), along with the
unused get20/set20.
Change-Id: Id83467a1b7f33657869e0a933af75387a4e36a88
Bug: skia:9543
Change-Id: Id83467a1b7f33657869e0a933af75387a4e36a88
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252188
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Change-Id: I8ef13b78a5f2f49ff9c59db285b3e0e7ee708c9b
Bug: chromium:960620
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252160
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Chrome is now using the newer version.
Bug: skia:8962
Change-Id: I8c38bde63e1e032281d19b0cc7cb8cf301061a9e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251198
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Brings over skcms' encoding scheme, etc.
Change-Id: Ib8abec911acd1c50df3b201b4a9bde01b1cb123b
Bug: chromium:960620
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249000
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This api will replace ComputeTextureSize.
Change-Id: I9befd8706f44250805315bdb13a559cf81c7142d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247337
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
bug: skia:9503
Change-Id: I5b4e2434c6085d048d6d0fc42b2b928439b1066b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246296
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This is a reland of 6fc04f88a8
Original change's description:
> Reland "SkSurface asynchronous read APIs allow client to extend pixel lifetime"
>
> This is a reland of ce240cc6fd
>
> Original change's description:
> > SkSurface asynchronous read APIs allow client to extend pixel lifetime
> >
> > Previously the pixel data passed to the client was only valid during
> > the client's callback. This meant if the client wanted to defer
> > processing of the data a copy was necessary.
> >
> > Now we pass an object to the callback and the pixel lifetime is tied
> > to the lifetime of that object.
> >
> > The object may be holding a GPU transfer buffer mapped. We don't assume
> > that the object will be released on the direct GrContext thread. So
> > when the object is destroyed it posts a message to a new type,
> > GrClientMappedBufferManager, hanging off the direct context. The direct
> > context will periodically check for messages and unmap and then unref
> > buffers so that they can be reused. Currently this is done in
> > GrContext::performDeferredCleanup() and GrDrawingManager::flush().
> >
> > The old API is kept around for backwards compatibility but it is
> > reimplemented as a bridge on top of the new mechanism.
> >
> > Also a utility function to SkImageInfo is added to directly make a new
> > info with a specified dimensions rather than passing the width and
> > height separately to makeWH().
> >
> > Bug: chromium:973403
> > Bug: skia:8962
> >
> > Change-Id: Id5cf04235376170142a48e90d3ecd13fd021a2a6
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245457
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
>
> Bug: chromium:973403, skia:8962
> Change-Id: I5cecd36276c8b6dc942cf549c7095db2df88530c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245678
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
Bug: chromium:973403, skia:8962
Change-Id: Ie584c1c3ef8021c976f71b708e53871c693cc450
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246057
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This reverts commit 6fc04f88a8.
Reason for revert: Chrome roll failure suspect because of:
* https://chromium-review.googlesource.com/c/chromium/src/+/1837131 (22 commits)
* https://chromium-review.googlesource.com/c/chromium/src/+/1837214 (24 commits)
Original change's description:
> Reland "SkSurface asynchronous read APIs allow client to extend pixel lifetime"
>
> This is a reland of ce240cc6fd
>
> Original change's description:
> > SkSurface asynchronous read APIs allow client to extend pixel lifetime
> >
> > Previously the pixel data passed to the client was only valid during
> > the client's callback. This meant if the client wanted to defer
> > processing of the data a copy was necessary.
> >
> > Now we pass an object to the callback and the pixel lifetime is tied
> > to the lifetime of that object.
> >
> > The object may be holding a GPU transfer buffer mapped. We don't assume
> > that the object will be released on the direct GrContext thread. So
> > when the object is destroyed it posts a message to a new type,
> > GrClientMappedBufferManager, hanging off the direct context. The direct
> > context will periodically check for messages and unmap and then unref
> > buffers so that they can be reused. Currently this is done in
> > GrContext::performDeferredCleanup() and GrDrawingManager::flush().
> >
> > The old API is kept around for backwards compatibility but it is
> > reimplemented as a bridge on top of the new mechanism.
> >
> > Also a utility function to SkImageInfo is added to directly make a new
> > info with a specified dimensions rather than passing the width and
> > height separately to makeWH().
> >
> > Bug: chromium:973403
> > Bug: skia:8962
> >
> > Change-Id: Id5cf04235376170142a48e90d3ecd13fd021a2a6
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245457
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
>
> Bug: chromium:973403, skia:8962
> Change-Id: I5cecd36276c8b6dc942cf549c7095db2df88530c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245678
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,brianosman@google.com
Change-Id: I9e01d1b82fb399b94292441d91da51176bb161d9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:973403, skia:8962
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245956
Reviewed-by: Ravi Mistry <rmistry@google.com>
Commit-Queue: Ravi Mistry <rmistry@google.com>
This is a reland of ce240cc6fd
Original change's description:
> SkSurface asynchronous read APIs allow client to extend pixel lifetime
>
> Previously the pixel data passed to the client was only valid during
> the client's callback. This meant if the client wanted to defer
> processing of the data a copy was necessary.
>
> Now we pass an object to the callback and the pixel lifetime is tied
> to the lifetime of that object.
>
> The object may be holding a GPU transfer buffer mapped. We don't assume
> that the object will be released on the direct GrContext thread. So
> when the object is destroyed it posts a message to a new type,
> GrClientMappedBufferManager, hanging off the direct context. The direct
> context will periodically check for messages and unmap and then unref
> buffers so that they can be reused. Currently this is done in
> GrContext::performDeferredCleanup() and GrDrawingManager::flush().
>
> The old API is kept around for backwards compatibility but it is
> reimplemented as a bridge on top of the new mechanism.
>
> Also a utility function to SkImageInfo is added to directly make a new
> info with a specified dimensions rather than passing the width and
> height separately to makeWH().
>
> Bug: chromium:973403
> Bug: skia:8962
>
> Change-Id: Id5cf04235376170142a48e90d3ecd13fd021a2a6
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245457
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
Bug: chromium:973403, skia:8962
Change-Id: I5cecd36276c8b6dc942cf549c7095db2df88530c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245678
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This reverts commit ce240cc6fd.
Reason for revert: crashing in chrome unit test, abandoned context related?
Original change's description:
> SkSurface asynchronous read APIs allow client to extend pixel lifetime
>
> Previously the pixel data passed to the client was only valid during
> the client's callback. This meant if the client wanted to defer
> processing of the data a copy was necessary.
>
> Now we pass an object to the callback and the pixel lifetime is tied
> to the lifetime of that object.
>
> The object may be holding a GPU transfer buffer mapped. We don't assume
> that the object will be released on the direct GrContext thread. So
> when the object is destroyed it posts a message to a new type,
> GrClientMappedBufferManager, hanging off the direct context. The direct
> context will periodically check for messages and unmap and then unref
> buffers so that they can be reused. Currently this is done in
> GrContext::performDeferredCleanup() and GrDrawingManager::flush().
>
> The old API is kept around for backwards compatibility but it is
> reimplemented as a bridge on top of the new mechanism.
>
> Also a utility function to SkImageInfo is added to directly make a new
> info with a specified dimensions rather than passing the width and
> height separately to makeWH().
>
> Bug: chromium:973403
> Bug: skia:8962
>
> Change-Id: Id5cf04235376170142a48e90d3ecd13fd021a2a6
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245457
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,brianosman@google.com
Change-Id: Ic14cf07a7629b167c9f34a651aa87a0326e74207
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:973403, skia:8962
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245721
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Previously the pixel data passed to the client was only valid during
the client's callback. This meant if the client wanted to defer
processing of the data a copy was necessary.
Now we pass an object to the callback and the pixel lifetime is tied
to the lifetime of that object.
The object may be holding a GPU transfer buffer mapped. We don't assume
that the object will be released on the direct GrContext thread. So
when the object is destroyed it posts a message to a new type,
GrClientMappedBufferManager, hanging off the direct context. The direct
context will periodically check for messages and unmap and then unref
buffers so that they can be reused. Currently this is done in
GrContext::performDeferredCleanup() and GrDrawingManager::flush().
The old API is kept around for backwards compatibility but it is
reimplemented as a bridge on top of the new mechanism.
Also a utility function to SkImageInfo is added to directly make a new
info with a specified dimensions rather than passing the width and
height separately to makeWH().
Bug: chromium:973403
Bug: skia:8962
Change-Id: Id5cf04235376170142a48e90d3ecd13fd021a2a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245457
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Change-Id: Idea9530028428c1a9d42e08a655457938b284b84
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245261
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This reverts commit 355111bf7c.
Change-Id: I0aa45bf92f437a0d680aa788ef4dc5c0299c6fe0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244882
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
This reverts commit 2281be3117.
Reason for revert: need to guard this since it changes some test results
Original change's description:
> add explicit src and dst colorspaces to filterColor4f
>
> bug: skia:9472
>
> Change-Id: Ibf4a3ab7eddc455a3c51b16bb68678ee722fc752
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244876
> Reviewed-by: Mike Klein <mtklein@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Mike Reed <reed@google.com>
TBR=mtklein@google.com,brianosman@google.com,reed@google.com
Change-Id: I6d10a5f2c9b2616bb0548ab2d370d93fd66af17f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244880
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
bug: skia:9472
Change-Id: Ibf4a3ab7eddc455a3c51b16bb68678ee722fc752
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244876
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Change-Id: I87b0fc76ef48c1a21498e576853a6c3b4a6a98f9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242563
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This CL adds:
kAlpha_F16_SkColorType
kRG_F16_SkColorType
kRGBA_16161616_SkColorType,
which should be it for a while.
Bug: skia:9121
Change-Id: I81b9d46a202a76e9b7d7ca86495d72dbdae32576
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/241357
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>