aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image/SkImage_Generator.cpp
Commit message (Collapse)AuthorAge
* Continue making Ganesh use absolute texture coordinates - take 2Gravatar Robert Phillips2017-01-20
| | | | | | | | | | | | The idea here is that the GrCoordTransform will actually hold a GrTextureProxy (rather than a GrTexture) and then, in GrGLSLPrimitiveProcessor::GetTransformMatrix, use the instantiated width & height (when uploading the transform matrix) Relanding of: https://skia-review.googlesource.com/c/6977/ Change-Id: Ibc9b9e354f7fc23b1a6e6e4fe7c9fe3cef771c02 Reviewed-on: https://skia-review.googlesource.com/7265 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
* Plumb dst color space in many places, rather than "mode"Gravatar Brian Osman2016-12-09
| | | | | | | | | | | | | | | | | This is less to type in most cases, and gives us more information (for things like picture-backed images, where we need to know all about the destination surface). Additionally, strip out the plumbing entirely for bitmap sources, where we don't need to know anything. BUG=skia: Change-Id: I4deff6c7c345fcf62eb08b2aff0560adae4313da Reviewed-on: https://skia-review.googlesource.com/5748 Reviewed-by: Mike Klein <mtklein@chromium.org> Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* Support decoding images to multiple formats, depending on usageGravatar Brian Osman2016-11-21
| | | | | | | | | | | | | | | | | | | | | | | | Our codec generator will now preserve any asked-for color space, and convert the encoded data to that representation. Cacherator now allows decoding an image to both legacy (nullptr color space), and color-correct formats. In color-correct mode, we choose the best decoded format, based on the original properties, and our backend's capabilities. Preference is given to the native format, when it's already texturable (sRGB 8888 or F16 linear). Otherwise, we prefer linear F16, and fall back to sRGB when that's not an option. Re-land (and fix) of: https://skia-review.googlesource.com/c/4438/ https://skia-review.googlesource.com/c/4796/ BUG=skia:5907 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4838 Change-Id: I20ff972ffe1c7e6535ddc501e2a8ab8c246e4061 Reviewed-on: https://skia-review.googlesource.com/4838 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
* Rename GrTextureParams to GrSamplerParamsGravatar Brian Salomon2016-11-17
| | | | | | | | | GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4965 Change-Id: I7d52e81c670e92ca96117284f44b274ce3cc3671 Reviewed-on: https://skia-review.googlesource.com/4965 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
* Revert "Support decoding images to multiple formats, depending on usage"Gravatar Brian Osman2016-11-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit c73a1ecbed64652b3d7aa8dc6face9a2205ce830. Reason for revert: ANGLE and CommandBuffer failures Original change's description: > Support decoding images to multiple formats, depending on usage > > Our codec generator will now preserve any asked-for color space, and > convert the encoded data to that representation. Cacherator now > allows decoding an image to both legacy (nullptr color space), and > color-correct formats. In color-correct mode, we choose the best > decoded format, based on the original properties, and our backend's > capabilities. Preference is given to the native format, when it's > already texturable (sRGB 8888 or F16 linear). Otherwise, we prefer > linear F16, and fall back to sRGB when that's not an option. > > BUG=skia:5907 > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4438 > > Change-Id: I847c243dcfb72d8c0f1f6fc73c09547adea933f0 > Reviewed-on: https://skia-review.googlesource.com/4438 > Reviewed-by: Matt Sarett <msarett@google.com> > Commit-Queue: Brian Osman <brianosman@google.com> > TBR=mtklein@google.com,bsalomon@google.com,msarett@google.com,brianosman@google.com,reed@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I1818f937464573d601f64e5a1f1eb43f5a778f4e Reviewed-on: https://skia-review.googlesource.com/4832 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
* Support decoding images to multiple formats, depending on usageGravatar Brian Osman2016-11-15
| | | | | | | | | | | | | | | | | | | | Our codec generator will now preserve any asked-for color space, and convert the encoded data to that representation. Cacherator now allows decoding an image to both legacy (nullptr color space), and color-correct formats. In color-correct mode, we choose the best decoded format, based on the original properties, and our backend's capabilities. Preference is given to the native format, when it's already texturable (sRGB 8888 or F16 linear). Otherwise, we prefer linear F16, and fall back to sRGB when that's not an option. BUG=skia:5907 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4438 Change-Id: I847c243dcfb72d8c0f1f6fc73c09547adea933f0 Reviewed-on: https://skia-review.googlesource.com/4438 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* Rename SkSourceGammaTreatment to SkDestinationSurfaceColorModeGravatar Brian Osman2016-11-09
| | | | | | | | | | | | | | | This is much more explicit about what that type represents (are we in legacy mode or not), which also makes it suitable for other (upcoming) usage. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4529 Change-Id: Iacb397c34e7765f1ca86c0195bc622b2be4d9acf Reviewed-on: https://skia-review.googlesource.com/4529 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Deferred image generator subsettingGravatar fmalita2016-11-04
| | | | | | | | | | Instead of invoking the generator at subset time, instantiate a new SkImage_Generator with its own cacherator but shared generator. R=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2462013003 Review-Url: https://codereview.chromium.org/2462013003
* Avoid separate allocation of SkImageCacheratorGravatar fmalita2016-10-27
| | | | | | | | | | Embed directly in SkImage_Generator, and add a helper to handle param validation. R=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2453473004 Review-Url: https://codereview.chromium.org/2453473004
* Add alphaType() to SkImageGravatar brianosman2016-08-17
| | | | | | | | | | | | | | Keep isOpaque as a convenience method -- many places really only need to know that for optimization purposes (SrcOver -> Src, etc...). In all the places where we pull data back out or convert to another object and need to supply an SkImageInfo, we can avoid losing information about premulness. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2250663002 Review-Url: https://codereview.chromium.org/2250663002
* Add new SkSourceGammaTreatment enum, used in situations like mipmap ↵Gravatar brianosman2016-06-06
| | | | | | | | | construction, where we need to know if we should respect (vs. ignore) the gamma encoding of sRGB tagged images. Plumb that extensively. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2037413002 Review-Url: https://codereview.chromium.org/2037413002
* Add onImageInfo call to SkImage_Base.Gravatar herb2016-04-19
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1903483003 Review URL: https://codereview.chromium.org/1903483003
* switch surface to sk_spGravatar reed2016-03-23
| | | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1817383002 CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot,Build-Mac-Clang-x86_64-Release-CMake-Trybot Review URL: https://codereview.chromium.org/1817383002
* update callsites for Make image factoriesGravatar reed2016-03-17
| | | | | | | | | | | not forced yet, as we still have the build-guard. waiting on chrome CL BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1810813003 TBR= Review URL: https://codereview.chromium.org/1810813003
* Revert "Revert of add Make variations to return SkImage by sk_sp (patchset ↵Gravatar reed2016-03-11
| | | | | | | | | | | | | | | #5 id:80001 of https://codereview.chromium.org/1778393002/ )" Fix was to call get() instead of release() when passing the sp to a bare-ptr method. This reverts commit e683c56115a210b5993df9294260bb147b408bfa. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1789443002 TBR= Review URL: https://codereview.chromium.org/1789443002
* Revert of add Make variations to return SkImage by sk_sp (patchset #5 ↵Gravatar robertphillips2016-03-10
| | | | | | | | | | | | | | | | | | | | | | | | | | id:80001 of https://codereview.chromium.org/1778393002/ ) Reason for revert: Experimental revert to try to clear up ASAN failures Original issue's description: > add Make variations to return SkImage by sk_sp > > some internal call-sites update, but not. Will follow-up in future to complete that. > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1778393002 > > Committed: https://skia.googlesource.com/skia/+/bd73ffb83022f1f6b1997e2a91c049949e88a8a2 TBR=fmalita@chromium.org,bsalomon@google.com,reed@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1783063002
* add Make variations to return SkImage by sk_spGravatar reed2016-03-10
| | | | | | | | | some internal call-sites update, but not. Will follow-up in future to complete that. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1778393002 Review URL: https://codereview.chromium.org/1778393002
* unify peekPixels around pixmap parameterGravatar reed2016-03-09
| | | | | | | | | | requires this chrome CL to land first https://codereview.chromium.org/1775393003/ BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1784563002 Review URL: https://codereview.chromium.org/1784563002
* take gr-context parameter to refEncoded, indicating a desire for only ↵Gravatar reed2016-01-05
| | | | | | | | | | | | | | | gpu-specific formats Prime motivator: - we always call refEncoded on the generator when trying to upload - we call it *before* we ask for raster or YUV - for blink, this call can be very slow, as they have to cons-up their SkData the first time (and grab a mutex to do it) - this parameter will indicate to them that we're only interested in gpu formats, which they will know if they have. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1556333004 Review URL: https://codereview.chromium.org/1556333004
* Stop wrapping images backed by generators as bitmaps in SkGpuDevice (except ↵Gravatar bsalomon2015-12-08
| | | | | | when tiling) Review URL: https://codereview.chromium.org/1510903002
* optimize the disable-caching case for SkImage::readPixelsGravatar reed2015-11-24
| | | | | | | | | | If the client wants no caching, and we haven't already cached it, pass the caller's dst-buffer directly down to the generator, avoiding the (previous) extra memcpy. BUG=skia:4594 Review URL: https://codereview.chromium.org/1473373002
* scaling API on SkPixmapGravatar reed2015-11-23
| | | | | | BUG=skia:4481 Review URL: https://codereview.chromium.org/1463373002
* Remove image usage type enum. Use GrTextureParams instead.Gravatar bsalomon2015-10-12
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1404433002
* SkImage doesn't use props, so don't need to store itGravatar reed2015-10-04
| | | | | | | BUG=skia: TBR=bsalomon Review URL: https://codereview.chromium.org/1372153006
* Revert[4] of add ImageShader, sharing code with its Bitmap cousinGravatar reed2015-09-30
| | | | | | | | | | Now with GrTextureMaker subclasses to handle npot usage. This reverts commit 476506d070dbc59b158acc1a00c34bff95ab2968. BUG=skia: Review URL: https://codereview.chromium.org/1370223002
* Revert of Revert[2] of add ImageShader, sharing code with its Bitmap cousin ↵Gravatar reed2015-09-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | (patchset #11 id:200001 of https://codereview.chromium.org/1352293002/ ) Reason for revert: guess: Need to handle NPOT support in shader case Original issue's description: > Revert[2] of add ImageShader, sharing code with its Bitmap cousin > > Adjustment from previous land : runtime check for npot-support when texture is requested for tiling. > > (patchset #10 id:180001 of https://codereview.chromium.org/1342113002/ ) > > This reverts commit f2608513626264459a00388537175600b515cae2. > > BUG=skia:4365 > > Committed: https://skia.googlesource.com/skia/+/fe05707c356d2a8c2c69222591d4cafbd456b4e5 TBR=fmalita@chromium.org,robertphillips@google.com,bsalomon@google.com,reed@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:4365 Review URL: https://codereview.chromium.org/1375673002
* Revert[2] of add ImageShader, sharing code with its Bitmap cousinGravatar reed2015-09-25
| | | | | | | | | | | | Adjustment from previous land : runtime check for npot-support when texture is requested for tiling. (patchset #10 id:180001 of https://codereview.chromium.org/1342113002/ ) This reverts commit f2608513626264459a00388537175600b515cae2. BUG=skia:4365 Review URL: https://codereview.chromium.org/1352293002
* remove unused (by the outside) SkImage::newSurface, and simplify newImage -> ↵Gravatar reed2015-09-24
| | | | | | | | newSubset BUG=skia: Review URL: https://codereview.chromium.org/1364443002
* Remove SkNEW and SkDELETE macrosGravatar mdempsky2015-09-22
| | | | | | | | | | | | | | | This CL removes the uses of SkNEW that have resprouted since commit 385fe4d, and removes the macros entirely now that Android and Chromium have been cleaned up to no longer depend on them. A bunch of files implicitly depend on #include <new> from SkPostConfig.h still though, so keep that for now. To be fixed in a followup CL. [mtklein mucking around] Only public API removed. TBR=reed@google.com Review URL: https://codereview.chromium.org/1360653004
* Revert of add ImageShader, sharing code with its Bitmap cousin (patchset #10 ↵Gravatar tomhudson2015-09-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | id:180001 of https://codereview.chromium.org/1342113002/ ) Reason for revert: Failing ImageNewShaderTest on both Android (Tegra3 GPU) and iOS bots. e.g. /Users/chrome-bot/buildbot/skiabot-ipad4-000/build/slave/workdir/build/skia/tests/ ImageNewShaderTest.cpp:24 0 == memcmp(bm1.getPixels(), bm2.getPixels(), bm1.getSize()) ImageNewShaderTest.cpp:95 0xFFFF0000 == bmt.getColor(0, y) ImageNewShaderTest.cpp:98 0xFFDEDEDE == bmt.getColor(x, y) ImageNewShaderTest.cpp:98 0xFFDEDEDE == bmt.getColor(x, y) ImageNewShaderTest.cpp:98 0xFFDEDEDE == bmt.getColor(x, y) ImageNewShaderTest.cpp:98 0xFFDEDEDE == bmt.getColor(x, y) ImageNewShaderTest.cpp:95 0xFFFF0000 == bmt.getColor(0, y) ... Original issue's description: > add ImageShader, sharing code with its Bitmap cousin > > This is done by having abstracted the BitmapShaderContext to take a BitmapProvider, instead of just a bitmap. This allows us to share all of that code between SkBitmap and SkImage, since both are valid providers. > > It also means that we can simplify SkImage_Base to not need a virtual for onNewShader, since ALL images can uniformly be turned into a shader now. > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/0b93e3149d2cb30860c51f9f3204ae811d9a97ca TBR=fmalita@chromium.org,bsalomon@google.com,robertphillips@google.com,reed@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1355863002
* add ImageShader, sharing code with its Bitmap cousinGravatar reed2015-09-18
| | | | | | | | | | This is done by having abstracted the BitmapShaderContext to take a BitmapProvider, instead of just a bitmap. This allows us to share all of that code between SkBitmap and SkImage, since both are valid providers. It also means that we can simplify SkImage_Base to not need a virtual for onNewShader, since ALL images can uniformly be turned into a shader now. BUG=skia: Review URL: https://codereview.chromium.org/1342113002
* Purge cached resources on SkImage destruction.Gravatar fmalita2015-09-18
| | | | | | | BUG=532981 R=reed@google.com,mtklein@google.com Review URL: https://codereview.chromium.org/1352883004
* share IDs between cacherator and its host-imageGravatar reed2015-09-17
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1357543002
* remove code from SK_SUPPORT_LEGACY_NEWFROMGENERATOR, eliminates caller of ↵Gravatar reed2015-09-14
| | | | | | | | deprecated SkInstallDiscardablePixelRef BUG=skia: Review URL: https://codereview.chromium.org/1344663002
* Use SkImageCacherator in SkImagesGravatar reed2015-09-10
Possible follow-up changes to consider 1. Roll SkImage_Raster and _Gpu into _Generator, where the generator (or cacherator) is backed by a pre-existing texture or raster. 2. Evolve SkImageUsageType into a verb requiring stretching, and have the caller (common code) digest the caps() and usage, so that subclasses are just told what to do (stretch or not) 3. Common code/utility to convert an unstretched texture into a stretch one (and cache it) if the generator can only make an unstretched one. BUG=skia: Review URL: https://codereview.chromium.org/1282363002