aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/blend.cpp
Commit message (Collapse)AuthorAge
* GM: some header cleanupGravatar Mike Klein2017-03-22
| | | | | | | | | | | | | | gm.h includes sk_tool_utils.h but does not use it. The bulk of this CL makes each gm that uses sk_tool_utils include it. sk_tool_utils.h also provided SkRandom and SkTDArray, so a couple GMs add those headers too. Change-Id: Ieb2a7c542f0ca89c3223f744fc11b0ff37af36c1 Reviewed-on: https://skia-review.googlesource.com/10014 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Herb Derby <herb@google.com>
* SkBlendARGB32 and S32[A]_Blend_BlitRow32 are currently formulated as: ↵Gravatar lsalzman2016-08-05
| | | | | | | | | | | | | | | | | | | | | | SkAlphaMulQ(src, src_scale) + SkAlphaMulQ(dst, dst_scale), which boils down to ((src*src_scale)>>8) + ((dst*dst_scale)>>8). In particular, note that the intermediate precision is discarded before the two parts are added together, causing the final result to possibly inaccurate. In Firefox, we use SkCanvas::saveLayer in combination with a backdrop that initializes the layer to the background. When this is blended back onto background using transparency, where the source and destination pixel colors are the same, the resulting color after the blend is not preserved due to the lost precision mentioned above. In cases where this operation is repeatedly performed, this causes substantially noticeable differences in color as evidenced in this downstream Firefox bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=1200684 In the test-case in the downstream report, essentially it does blend(src=0xFF2E3338, dst=0xFF2E3338, scale=217), which gives the result 0xFF2E3237, while we would expect to get back 0xFF2E3338. This problem goes away if the blend is instead reformulated to effectively do (src*src_scale + dst*dst_scale)>>8, which keeps the intermediate precision during the addition before shifting it off. This modifies the blending operations thusly. The performance should remain mostly unchanged, or possibly improve slightly, so there should be no real downside to doing this, with the benefit of making the results more accurate. Without this, it is currently unsafe for Firefox to blend a layer back onto itself that was initialized with a copy of its background. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2097883002 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot [mtklein adds...] No public API changes. TBR=reed@google.com Review-Url: https://codereview.chromium.org/2097883002
* Remove conditional flavor text on blend GM.Gravatar mtklein2016-04-06
| | | | | | | | | This was breaking replay modes for no good reason. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1864253002 Review URL: https://codereview.chromium.org/1864253002
* 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
* Style Change: NULL->nullptrGravatar halcanary2015-08-27
| | | | | | DOCS_PREVIEW= https://skia.org/?cl=1316233002 Review URL: https://codereview.chromium.org/1316233002
* make tests portable by using 565 compatible colorsGravatar caryclark2015-07-29
| | | | | | TBR=reed@google.com Review URL: https://codereview.chromium.org/1262703002
* add a GM to demo the blend bugGravatar mtklein2015-04-17
| | | | | | BUG=skia:3739 Review URL: https://codereview.chromium.org/1094863003
* Remove SkBlendImageFilter, and all tests. Its functionality has been ↵Gravatar senorblanco@chromium.org2013-08-01
| | | | | | | | | | subsumed by SkXfermodeImageFilter. R=robertphillips@google.com Review URL: https://codereview.chromium.org/21404002 git-svn-id: http://skia.googlecode.com/svn/trunk@10482 2bbb7eff-a529-9590-31e7-b0007b416f81
* revert name changes to SkBlendImageFilter. It (correctly) named its enum ↵Gravatar reed@google.com2013-02-01
| | | | | | | | | | | kMultiply_Mode, and handled that itself internally, rather than calling SkXfermode. This CL removes the kModulate_Mode alias from its list. git-svn-id: http://skia.googlecode.com/svn/trunk@7509 2bbb7eff-a529-9590-31e7-b0007b416f81
* clone of https://codereview.appspot.com/7208043/Gravatar reed@google.com2013-01-30
| | | | | | Review URL: https://codereview.appspot.com/7232062 git-svn-id: http://skia.googlecode.com/svn/trunk@7476 2bbb7eff-a529-9590-31e7-b0007b416f81
* Changing imageFilter GM tests to use drawBitmap instead of drawSpriteGravatar junov@chromium.org2013-01-14
| | | | | | | The motivation is be able to test the filters with scaled SkPicture playback in isolation from the issues that surround usage of drawSprite Review URL: https://codereview.appspot.com/7060071 git-svn-id: http://skia.googlecode.com/svn/trunk@7152 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fixed Windows compiler complaints (esp. in debugger)Gravatar robertphillips@google.com2012-09-06
| | | | | | | | https://codereview.appspot.com/6497090/ git-svn-id: http://skia.googlecode.com/svn/trunk@5419 2bbb7eff-a529-9590-31e7-b0007b416f81
* Result of running tools/sanitize_source_files.py (which was added in ↵Gravatar rmistry@google.com2012-08-23
| | | | | | | | | https://codereview.appspot.com/6465078/) This CL is part III of IV (I broke down the 1280 files into 4 CLs). Review URL: https://codereview.appspot.com/6475053 git-svn-id: http://skia.googlecode.com/svn/trunk@5264 2bbb7eff-a529-9590-31e7-b0007b416f81
* Implements the non-Porter-Duff compositing modes required for SVG's feBlendGravatar senorblanco@chromium.org2012-08-22
element. This filter has two inputs, since normal blending can't be used. The GPU side uses two filter stages to accomplish this: one to sample the background, and one to sample the foreground and blend it. Review URL: https://codereview.appspot.com/6463081/ git-svn-id: http://skia.googlecode.com/svn/trunk@5231 2bbb7eff-a529-9590-31e7-b0007b416f81