Commit Graph

205 Commits

Author SHA1 Message Date
Florin Malita
4aed13889b Reland of SkShaderBase
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>
2017-05-25 14:59:07 +00:00
Florin Malita
d93e11ceb4 Revert "SkShaderBase"
This reverts commit 58a756435c.

Reason for revert: g3, Android borkage.

Original change's description:
> SkShaderBase
> 
> 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>
> 

TBR=mtklein@google.com,fmalita@chromium.org,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: I32b012ee466dd006c074593f211f43ed602f1078
Reviewed-on: https://skia-review.googlesource.com/17845
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-05-24 21:15:57 +00:00
Florin Malita
58a756435c SkShaderBase
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>
2017-05-24 19:56:15 +00:00
Florin Malita
7d022e099b Always use raster pipeline for SkSweepGradient
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>
2017-05-16 02:01:03 +00:00
Mike Klein
44d3279b41 Make SkCreateRasterPipelineBlitter() not fail.
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>
2017-05-10 20:07:37 +00:00
Mike Klein
2814d91486 clean up SkShader friends
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>
2017-05-10 19:01:39 +00:00
Florin Malita
26368c3300 Minimize computeTotalInverse()'s inputs
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>
2017-05-08 18:04:57 +00:00
Matt Sarett
72266eeca0 makeColorSpace() for SkColorFilterShader and SkLightingShader
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>
2017-04-21 19:55:23 +00:00
Matt Sarett
6cc6ae7573 SkColorSpaceXformer: Add SkShader::makeColorSpace()
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>
2017-04-19 16:28:44 +00:00
Brian Salomon
d3b65972aa Mark overridden destructors with 'override' and remove 'virtual'
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>
2017-03-22 16:06:18 +00:00
Robert Phillips
54be5c9286 Revert "More non-invertible shader local matrix guards"
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>
2017-02-11 01:19:47 +00:00
Florin Malita
368af4605d 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>
2017-02-10 21:15:16 +00:00
Herb Derby
83e939bcb7 Use SkArenaAlloc in the SkAutoBlitterChoose code.
- 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.com
TBR=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>
2017-02-07 20:01:20 +00:00
Robert Phillips
dd8b72ae73 Revert "Use SkArenaAlloc instead of SkSmallAllocator in the SkAutoBlitterChoose code."
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>
2017-02-07 17:28:21 +00:00
Herb Derby
2b57b7f7a7 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>
2017-02-07 15:43:45 +00:00
Florin Malita
9206c76337 SkRasterPipeline shader adapter
Reland of https://skia-review.googlesource.com/c/7615.

(lifted from https://skia-review.googlesource.com/c/7088/)

CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD

Change-Id: I797a2f0ae80209c8637875418e08d2fa03249672
Reviewed-on: https://skia-review.googlesource.com/7731
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2017-01-31 14:14:13 +00:00
Florin Malita
5ce33efa7c Revert "SkRasterPipeline shader adapter"
This reverts commit 6d11ed2951.

Build failure: https://chromium-swarm.appspot.com/task?id=3403da0cdee8c210&refresh=10

../../../src/core/SkOpts.cpp -o obj/src/core/libskia.SkOpts.o
In file included from ../../../src/core/SkOpts.cpp:46:
../../../src/opts/SkRasterPipeline_opts.h:1093:11: error: no member named 'Load4' in '(anonymous namespace)::SkNx<8, float>'
    SkNf::Load4(buf, &r, &g, &b, &a);
    ~~~~~~^
1 error generated.

Leak: https://chromium-swarm.appspot.com/task?id=3403df55fd5eaa10&refresh=10

Original change's description:
> SkRasterPipeline shader adapter
> 
> (lifted from https://skia-review.googlesource.com/c/7088/)
> 
> R=​mtklein@google.com,herb@google.com,reed@google.com
> 
> CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD
> 
> Change-Id: Idddb84069423c5fc535bea0a65a5b21a4d07084d
> Reviewed-on: https://skia-review.googlesource.com/7615
> Commit-Queue: Florin Malita <fmalita@chromium.org>
> Reviewed-by: Mike Klein <mtklein@chromium.org>
> Reviewed-by: Mike Reed <reed@google.com>
> 

TBR=mtklein@chromium.org,mtklein@google.com,herb@google.com,fmalita@chromium.org,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD

Change-Id: I68c0be3398bde93cd0842baf25b025c5fe1c3df7
Reviewed-on: https://skia-review.googlesource.com/7730
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2017-01-29 16:42:52 +00:00
Florin Malita
6d11ed2951 SkRasterPipeline shader adapter
(lifted from https://skia-review.googlesource.com/c/7088/)

R=mtklein@google.com,herb@google.com,reed@google.com

CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD

Change-Id: Idddb84069423c5fc535bea0a65a5b21a4d07084d
Reviewed-on: https://skia-review.googlesource.com/7615
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2017-01-29 16:19:08 +00:00
Florin Malita
882ccafee0 Raster pipeline support for SkLocalMatrixShader composition
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>
2017-01-27 16:57:47 +00:00
Greg Daniel
48f770c43f Remove unused asACustomShader function from SkShader
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>
2017-01-20 15:21:05 +00:00
Herb Derby
ac04fef619 Remove SkFallbackAlloc and SkFixedAlloc.
CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-ASAN;skia.primary:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-MSAN

TBR=reed@google.com

Change-Id: I1000dc9ed8ad65b249798759d9af99f47fc237d2
Reviewed-on: https://skia-review.googlesource.com/6809
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2017-01-16 17:01:57 +00:00
Hal Canary
5aedd6d5a3 cleanup after 95e3c05
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>
2017-01-12 19:49:46 +00:00
Hal Canary
95e3c058ef SkTypes.h : move SkAutoMalloc into SkAutoMalloc.h
* 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>
2017-01-11 18:55:34 +00:00
Brian Osman
61624f0c71 Plumb dst color space in many places, rather than "mode"
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>
2016-12-09 20:31:23 +00:00
Brian Osman
11970e56c1 Add destination color space to shader ContextRec
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>
2016-12-05 21:48:59 +00:00
Mike Klein
7a14734d2c support a8
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>
2016-11-29 21:36:32 +00:00
Mike Klein
987de5b6b9 Plumb filter quality into SkShader::appendStages().
We of course need this to know whether or not to bilerp.

TBR=herb@google.com

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4932

Change-Id: I5fe6d93c1d36d0d53f566f722960fcafb0d8bc3c
Reviewed-on: https://skia-review.googlesource.com/4932
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
2016-11-17 17:23:59 +00:00
Florin Malita
c0115e4cf3 Ignore ctm param of SkShader::onAppendStages()
Clang 3.8.0:

../../include/core/SkShader.h:513:49: error: unused parameter 'ctm' [-Werror,-Wunused-parameter]
                                const SkMatrix& ctm) const {


R=mtklein@google.com

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4867

Change-Id: I242180cb33ad099b28b06654934029690da195ee
Reviewed-on: https://skia-review.googlesource.com/4867
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
2016-11-15 19:39:32 +00:00
Mike Klein
fb191da789 More shader preliminaries / refactoring
- 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>
2016-11-15 18:53:58 +00:00
Mike Klein
b0d10e05f1 Start hooking shaders into SkRasterPipelineBlitter.
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>
2016-11-14 15:21:25 +00:00
Mike Reed
6a01554e9e remove use of xfermode* in procs
BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4592

Change-Id: I99f35924ff5325dfac527bb573a86d2d0366e0b3
Reviewed-on: https://skia-review.googlesource.com/4592
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2016-11-09 17:03:12 +00:00
Brian Osman
7b8400dad2 Rename SkSourceGammaTreatment to SkDestinationSurfaceColorMode
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>
2016-11-09 01:05:07 +00:00
Mike Reed
faba3715b8 remove unused code around SK_SUPPORT_LEGACY_XFERMODE_PARAM
BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4384

Change-Id: I5121acd027d935ade169ff65941f29f654a47bd0
Reviewed-on: https://skia-review.googlesource.com/4384
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2016-11-03 19:54:08 +00:00
Ben Wagner
d5def99232 Remove SK_SUPPORT_LEGACY_SHADER_ASALOCALMATRIXSHADER
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>
2016-11-02 21:20:43 +00:00
Mike Reed
7d954ad797 remove xfermode from public api
BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4020

CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot

Change-Id: I19cd056f2af778f10e8c6c2b7b2735593b43dbac
Reviewed-on: https://skia-review.googlesource.com/4020
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2016-10-28 20:06:17 +00:00
Ben Wagner
a8834bb323 SkShader* refAs... to sk_sp<SkShader> makeAs...
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>
2016-10-24 16:40:01 +00:00
Mike Reed
958788ab46 remove 4 legacy flags (clients already updated)
BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3785

Change-Id: I187e50e09ed7a3316719fae51af770259928fdf9
Reviewed-on: https://skia-review.googlesource.com/3785
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2016-10-20 21:08:50 +00:00
Brian Osman
9f532a3598 Add helper to create random AsFPArgs for Ganesh unit tests
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>
2016-10-19 16:01:07 +00:00
Mike Reed
627778d5ba isABitmap is deprecated, use isAImage
BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2748

Change-Id: I7006a3231ff0e9e39b187deae550364bc97f49d6
Reviewed-on: https://skia-review.googlesource.com/2748
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2016-09-28 21:42:04 +00:00
reed
320a40d773 Always return ImageShader, even from SkShader::MakeBitmapShader
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
2016-08-02 06:12:06 -07:00
reed
f1ac18229c implement isABitmap for imageshader, return localmatrix for bitmap's impl
For imageshader, I only return true if the image is explicitly raster-backed. I do not return true for texture, nor for generator (i.e. lazy/picture) backed. Is that ok?

BUG=skia:5592
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2197323002

Review-Url: https://codereview.chromium.org/2197323002
2016-08-01 11:24:14 -07:00
brianosman
1638c0deea Add destination color space to AsFPArgs. Eliminates last XFORMTODO.
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
2016-07-25 05:12:53 -07:00
brianosman
839345d634 Bundle SkShader::asFragmentProcessor arguments in a struct
The signature of this thing keeps changing (and is about to change again).
This just makes maintenance much easier.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2175563003

Review-Url: https://codereview.chromium.org/2175563003
2016-07-22 11:04:53 -07:00
bungeman
06ca8ec87c sk_sp for Ganesh.
Convert use of GrFragmentProcessor, GrGeometryProcessor, and
GrXPFactory to sk_sp. This clarifies ownership and should
reduce reference count churn by moving ownership.

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2041113004

Review-Url: https://codereview.chromium.org/2041113004
2016-06-09 08:01:03 -07:00
brianosman
982eb7f377 Add new SkSourceGammaTreatment enum, used in situations like mipmap 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
2016-06-06 13:10:58 -07:00
reed
0ccc62d4f7 move colorshader into its own .cpp, add color4f variant
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
2016-05-04 13:09:39 -07:00
mtklein
3b37545bc5 Revert of Delete SkFlattenable::Type (patchset #2 id:20001 of https://codereview.chromium.org/1834303003/ )
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/+/99d9231f6a4cb6b85b8637e9d8ae32f8bd7c466f

TBR=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
2016-04-04 14:57:19 -07:00
msarett
99d9231f6a Delete SkFlattenable::Type
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1834303003

Review URL: https://codereview.chromium.org/1834303003
2016-04-04 13:53:02 -07:00
reed
cfb6bdf767 switch xfermodes over to sk_sp
waiting on https://codereview.chromium.org/1835163002/

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1832223002

Review URL: https://codereview.chromium.org/1832223002
2016-03-29 11:32:50 -07:00
reed
d053ce9c54 Reland of [2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.o… (patchset #1 id:1 of https://codereview.chromium.org/1821103004/ )
Reason for revert:
guard has now landed in chrome

Original issue's description:
> Revert of Revert[2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.o… (patchset #3 id:40001 of https://codereview.chromium.org/1825073002/ )
>
> Reason for revert:
> CreateModeFilter not compiling
>
> Original issue's description:
> > Revert[2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.org/1822623002/ )"
> >
> > Fixed legacy withColorFilter to call new(er) make method
> >
> > This reverts commit 1eb81db650.
> >
> > BUG=skia:
> > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1825073002
> >
> > TBR=
> >
> > Committed: https://skia.googlesource.com/skia/+/4c9776b046dd5e9e46e2d1ce35154855c8fcb381
>
> TBR=
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/d6889293dd0942f27f9593f679722c956831f2c4

TBR=
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=skia:

Review URL: https://codereview.chromium.org/1827433002
2016-03-22 10:17:23 -07:00