Introduce a private base class (SkShaderBase), to hide
implementation details from the public interface (SkShader).
Change-Id: Ib1d76cde880bd51868b97408710f8bb38128e536
Reviewed-on: https://skia-review.googlesource.com/17925
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Introduce a private base class (SkShaderBase), to hide
implementation details from the public interface (SkShader).
Change-Id: If3ec26ca6abc9da20e3f139c11fdc023bdd85176
Reviewed-on: https://skia-review.googlesource.com/17241
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Add an opt-in mechanism (SkShader::isRasterPipelineOnly) and switch
SkSweepGradient to always-RP.
This also repurposes the existing SK_LEGACY_SWEEP_GRADIENT guard.
Change-Id: Iabf0a701eda56f009d331120f0c987f96bd35d27
Reviewed-on: https://skia-review.googlesource.com/16912
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Mostly this is about extending the fallback in SkShader::appendStages()
to cover more cases, and making sure subclasses call appendStages() so
they can get the fallback, not onAppendStages() directly.
We still need to watch for SkShader::makeContext() failing in the
fallback itself, so sadly SkShader::appendStages() may still fail.
Change-Id: I2314b234a24bdcecac401a385ce050d7fdf0a83e
Reviewed-on: https://skia-review.googlesource.com/16369
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Many SkShader subclasses are only friends to use makeColorSpace().
Our usual solution to this is to add a method on SkColorSpaceXformer
that calls makeColorSpace() for us, so that only SkColorSpaceXformer
needs to be a friend.
Just a refactor. No image diffs.
Change-Id: Icf952b739edf45f2fb8c0c35e353ef2866f4c5cc
Reviewed-on: https://skia-review.googlesource.com/16370
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
The helper doesn't need a full context rec - it only looks at the CTM
and external local matrix. Pass these explicitly instead.
Change-Id: I6a5884f65cd383c2df0e8d83c9086789bd96f345
Reviewed-on: https://skia-review.googlesource.com/15870
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Fixes 4 gms in gbr-8888 config.
Bug: skia:6516
Change-Id: I9da839eb0211910989be35db0e13c0e1bbfa185d
Reviewed-on: https://skia-review.googlesource.com/13964
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Matt Sarett <msarett@google.com>
Just a refactor - reimplements the shader xforms with makeColorSpace().
11 gms have diffs. Some are down to floating precision. The old
implementation would go float->fixed->float in some cases. Others
are due to improvements with gradient shaders inside local matrix
shaders.
Bug: skia:6516
Change-Id: I424406990c5c58a47833cf4c9ef146cd3ea6c37e
Reviewed-on: https://skia-review.googlesource.com/13769
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Matt Sarett <msarett@google.com>
This silences a new warning in clang 5.0
Change-Id: Ieb5b75a6ffed60107c3fd16075d2ecfd515b55e8
Reviewed-on: https://skia-review.googlesource.com/10006
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
This reverts commit 368af4605d.
Reason for revert: checking to see if this is breaking the Chrome DEPS roll
Original change's description:
> More non-invertible shader local matrix guards
>
> Change-Id: Ida9a300420ff1d883e617cdaadb80e88c99ad226
> Reviewed-on: https://skia-review.googlesource.com/8333
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Florin Malita <fmalita@chromium.org>
>
TBR=brianosman@google.com,fmalita@chromium.org,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: Id0a771342b9be27c85d91f511d814297b8c3e0b8
Reviewed-on: https://skia-review.googlesource.com/8345
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
- Added default implementation of onMakeContext to support use in android.
Searches for uses:
"public SkShader" package:^chromium$ -file:^src/third_party/skia
package:^aosp.* "public SkShader" -file:external/skia -file:.*third_party/skia
package:^android$ "public SkShader" -file:external/skia -file:.*third_party/skia
... shows that no subclass overrides onCreateContext.
TBR=reed@google.comTBR=mtklein@google.com
Change-Id: I8bd5f57a79534574e344b165d31dccee41c31767
Reviewed-on: https://skia-review.googlesource.com/8140
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
This reverts commit 2b57b7f7a7.
Reason for revert: Android compile failing
Original change's description:
> Use SkArenaAlloc instead of SkSmallAllocator in the SkAutoBlitterChoose code.
>
>
> TBR=reed@google.com
> Change-Id: Iefb044bf7657fbf982f23aa91a3f4d013ce2c626
> Reviewed-on: https://skia-review.googlesource.com/7786
> Reviewed-by: Mike Klein <mtklein@chromium.org>
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Herb Derby <herb@google.com>
>
TBR=mtklein@chromium.org,mtklein@google.com,herb@google.com,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: Id09c35377dddae0811d998b7d0c34c422325a5bc
Reviewed-on: https://skia-review.googlesource.com/8129
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=reed@google.com
Change-Id: Iefb044bf7657fbf982f23aa91a3f4d013ce2c626
Reviewed-on: https://skia-review.googlesource.com/7786
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Plumb a local matrix arg to onAppendStages, similar to onCreateContext's
ContextRec::fLocalMatrix.
Change-Id: I6db3706918733b35eb7a3ae2cc65503223d0cf2d
Reviewed-on: https://skia-review.googlesource.com/7653
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
I recentely removed the only call site of this so it should be
safe to delete now.
BUG=skia:
Change-Id: Id7fa94b9af5d73c4f7bb5e5a657d6fc6728923b5
Reviewed-on: https://skia-review.googlesource.com/7330
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Change-Id: Ifd194fd009196b8bee2dd83328bbe698586d72f4
Reviewed-on: https://skia-review.googlesource.com/6965
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
* SkAutoFree moved to SkTemplates.h (now implmented with unique_ptr).
* SkAutoMalloc and SkAutoSMalloc moved to SkAutoMalloc.h
* "SkAutoFree X(sk_malloc_throw(N));" --> "SkAutoMalloc X(N);"
Revert "Revert 'SkTypes.h : move SkAutoMalloc into SkAutoMalloc.h'"
This reverts commit c456b73fef.
Change-Id: Ie2c1a17c20134b8ceab85a68b3ae3e61c24fbaab
Reviewed-on: https://skia-review.googlesource.com/6886
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
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>
BUG=skia:
Change-Id: Ib1920fffd5735ad54a5b785bbc2676ea240bdbfa
Reviewed-on: https://skia-review.googlesource.com/5611
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
Most of this is plumbing through the full paint to shaders instead of just the filter quality.
CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD
Change-Id: I6afde07566afa3a4391c24dca7017a9a4f5ec700
Reviewed-on: https://skia-review.googlesource.com/5317
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
- thread through ctm
- make blitter handle paint modulation instead of each shader
TBR=herb@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4830
CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
Change-Id: I8161e6b3864c4e48e4d47d5ad40a56a13c02fee8
Reviewed-on: https://skia-review.googlesource.com/4830
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Here first just the simplest, constant-color shaders.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4743
Change-Id: I92c6523660e21a1e2aa353524570230282ba5dfe
Reviewed-on: https://skia-review.googlesource.com/4743
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
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>
This is no longer used and can be removed.
Change-Id: I6aab1cf243aa1f09bdcd26517a392bbcf11c9444
Reviewed-on: https://skia-review.googlesource.com/4360
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
There appear to be no existing overriders of the refAs.. method outside
Skia.
Change-Id: Iab174e83023093b4d7fc0bd8907666b66ddb1eea
Reviewed-on: https://skia-review.googlesource.com/3746
Reviewed-by: Ben Wagner <benjaminwagner@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reduces copy-paste and eases maintenance. I'll be adding another field to
AsFPArgs soon, and this is going to streamline that change.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3639
Change-Id: I6372ed5dce50a5ba9d73039bd4714e34502a1f75
Reviewed-on: https://skia-review.googlesource.com/3639
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Lessons learned
1. ImageShader (correctly) always compresses (typically via PNG) during serialization. This has the surprise results of
- if the image was marked opaque, but has some non-opaque pixels (i.e. bug in blitter or caller), then compressing may "fix" those pixels, making the deserialized version draw differently. bug filed.
- 565 compressess/decompresses to 8888 (at least on Mac), which draws differently (esp. under some filters). bug filed.
2. BitmapShader did not enforce a copy for mutable bitmaps, but ImageShader does (since it creates an Image). Thus the former would see subsequent changes to the pixels after shader creation, while the latter does not, hence the change to the BlitRow test to avoid this modify-after-create pattern. I sure hope this prev. behavior was a bug/undefined-behavior, since this CL changes that.
BUG=skia:5595
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2195893002
Review-Url: https://codereview.chromium.org/2195893002
This is going to be needed in many more places as I finish connecting the
dots. Even better - I'd like to switch to a world where SkColorSpace !=
nullptr is the only signal we use for gamma-correct rendering, so I can
eliminate SkSourceGammaTreatment and SkSurfaceProps::isGammaCorrect.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2180503002
Review-Url: https://codereview.chromium.org/2180503002
Implemented as a different subclass for SkColorShader (which is also private) partly to make the CL clearer/simpler, and partly for flatten/unflatten compatibility. Later I'm sure we could combine these if that proves useful.
Lots of TODOs at the moment, but still valuable to get reviewed.
Note: this ignores the question (for the moment) about how to interpret SkColor in the larger world. That needs to happen, but this CL is more focused on what *else* to do besides handle the old-style input (and old-style pipeline).
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1934313002
Review-Url: https://codereview.chromium.org/1934313002
Reason for revert:
Used by Chrome.
c:\b\build\slave\workdir\build\src\cc\playback\compositing_display_item.cc(53): error C2039: 'GetFlattenableType': is not a member of 'SkColorFilter'
c:\b\build\slave\workdir\build\src\third_party\skia\include\core\skshader.h(19): note: see declaration of 'SkColorFilter'
c:\b\build\slave\workdir\build\src\cc\playback\compositing_display_item.cc(53): error C3861: 'GetFlattenableType': identifier not found
Original issue's description:
> Delete SkFlattenable::Type
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1834303003
>
> Committed: https://skia.googlesource.com/skia/+/99d9231f6a4cb6b85b8637e9d8ae32f8bd7c466fTBR=reed@google.com,msarett@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/1853383002