aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ImageFilterTest.cpp
Commit message (Collapse)AuthorAge
...
* Staging for cleanup of SkPicture-related headersGravatar robertphillips@google.com2014-04-18
| | | | | | | | https://codereview.chromium.org/243173002 git-svn-id: http://skia.googlecode.com/svn/trunk@14258 2bbb7eff-a529-9590-31e7-b0007b416f81
* Reduce internal explicit SaveFlags usage.Gravatar commit-bot@chromium.org2014-04-18
| | | | | | | | | | | | | Most of these are either redundant/defaults or (hopefully) unnecessarily specific. R=reed@google.com, robertphillips@google.com Author: fmalita@chromium.org Review URL: https://codereview.chromium.org/241453003 git-svn-id: http://skia.googlecode.com/svn/trunk@14253 2bbb7eff-a529-9590-31e7-b0007b416f81
* Staged removal of SkPicture-derived classesGravatar commit-bot@chromium.org2014-04-17
| | | | | | | | | | | | | | This CL removes the SkPicture-derived classes (with a flag to keeps clients working). In the process it also lightens the recording factory function so it is no longer ref counted). The only interesting bits are in SkPicture* and Sk*Picture.* R=reed@google.com Author: robertphillips@google.com Review URL: https://codereview.chromium.org/238273012 git-svn-id: http://skia.googlecode.com/svn/trunk@14251 2bbb7eff-a529-9590-31e7-b0007b416f81
* Retract SkPicture::kOptimizeForClippedPlayback_RecordingFlag from public APIGravatar commit-bot@chromium.org2014-04-16
| | | | | | | | | | | | | | | | | | This CL sets the stage for retracting the SkPicture::kOptimizeForClippedPlayback_RecordingFlag flag from the public API (more work needs to be done in Blink & Chrome). In the new world the only way to set this flag (and thus instantiate an SkPicture-derived class) is by passing a factory to the SkPictureRecorder class. This is to get all clients always using factories so that we can then change the factory call used (i.e., so the factory just creates a BBH) and do away with the SkPicture-derived classes. BUG=skia:2315 R=reed@google.com Author: robertphillips@google.com Review URL: https://codereview.chromium.org/239703006 git-svn-id: http://skia.googlecode.com/svn/trunk@14221 2bbb7eff-a529-9590-31e7-b0007b416f81
* split SkPictureRecorder out of SkPictureGravatar robertphillips@google.com2014-04-13
| | | | | | | | https://codereview.chromium.org/214953003/ git-svn-id: http://skia.googlecode.com/svn/trunk@14171 2bbb7eff-a529-9590-31e7-b0007b416f81
* Implement intra-frame cacheing in image filters.Gravatar commit-bot@chromium.org2014-04-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When image filters are processed within Skia, they simply do a blind recursion. This has the side-effect of turning the DAG into a tree. I.e., nodes visited more than once during the traversal will be processed more than once. This change implements a very simple cacheing scheme: a cache is created before traversing the DAG, and handed into the processing traversal. Before recursing into a child in SkImageFilter::filterImage(), the cache is checked for a hit, and early-out is performed. Otherwise, the node is processed, and its result bitmap and location (offset) are cached, but only if it contains two or more children and thus will be visited again during the traversal. Currently, the child count is approximated with the refcount. This is good enough in most cases (and exactly correct for the Chrome use case). We could add an exact child count to the image filter, but this will require violating the immutability of image filters slightly in order to bump the child count as nodes are connected. I leave it up to the reviewer to decide which is better. R=reed@google.com Author: senorblanco@chromium.org Review URL: https://codereview.chromium.org/230653005 git-svn-id: http://skia.googlecode.com/svn/trunk@14160 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix matrix adjustment passed to filter processing.Gravatar senorblanco@chromium.org2014-04-02
| | | | | | | | | | | | | | | | | | When adjusting the CTM for filter use, we were subtracting off the destination coordinates of the drawDevice() or drawSprite(). This is not quite correct: we should subtract off the coordinates relative to the device origin instead. This occurs when one filtered saveLayer() is drawn inside another saveLayer(), both with non-zero origin. This fixes layout test svg/batik/text/smallFonts.svg in Blink, and is exercised by the provided unit test. BUG=skia: R=bsalomon@google.com Review URL: https://codereview.chromium.org/222723002 git-svn-id: http://skia.googlecode.com/svn/trunk@14029 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix SkXfermodeImageFilter when an input is cropped out.Gravatar senorblanco@chromium.org2014-04-01
| | | | | | | | | | | | | | | | | | | | | | If one of inputs to SkXfermodeImageFilter draws nothing, either due to it being cropped out upstream, or within the filter itself, the filter should still draw the other input, since otherwise the result will be incorrect. For the GPU path, since we can't detect this case in canFilterImageGPU() without recursing, we'll just drop to the generic path if either input is empty, since we can't use the effect in that case anyway. While we're at it, let's drop to the generic path if the xfermode can't be expressed as an effect, since the code here was doing a 2-pass render in that case anyway, which is equivalent to what the (xfermode == NULL) case was doing anyway. R=bsalomon@google.com, sugoi@chromium.org Review URL: https://codereview.chromium.org/220723007 git-svn-id: http://skia.googlecode.com/svn/trunk@14016 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix Mac Debug clang build.Gravatar senorblanco@chromium.org2014-03-24
| | | | | | | | TBR=bsalomon@google.com Review URL: https://codereview.chromium.org/210443002 git-svn-id: http://skia.googlecode.com/svn/trunk@13925 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix for crash on large image blur sigma values.Gravatar senorblanco@chromium.org2014-03-24
| | | | | | | | | | | | | | | | This was crashing on the GPU path, due to a failed texture allocation. The belt-and-suspenders fix is to: 1) Limit the GPU path to only allocate up to maxTextureSize. 2) Limit both the raster and GPU paths to reasonable blur sizes (box blur kernel size of 1000, resulting in a sigma limit of 532). R=bsalomon@google.com BUG=skia: Review URL: https://codereview.chromium.org/209353014 git-svn-id: http://skia.googlecode.com/svn/trunk@13923 2bbb7eff-a529-9590-31e7-b0007b416f81
* Implement support for expanding crop rects in image filtersGravatar senorblanco@chromium.org2014-03-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NOTE: this patch set is based on https://codereview.chromium.org/189913021/, and needs that patch to land first. Until now, crop rects in Skia have only been able to reduce the size of the destination bounds, but not expand them. SVG semantics require the latter as well. The heart of the change is in applyCropRect(), which now assigns each edge, instead of doing an intersection with the crop rect. In order to support this (and still work well with tiled drawing) we need to clip the resulting crop rect to the clipping region of the filters. This uses the Context struct previously landed from https://codereview.chromium.org/189913021/. Many of the pixel loops are not yet ready to handle a destination rect larger than the source rect. So we provide a convenience version of applyCropRect() which creates an offscreen and pads it out with transparent black. Once the pixel loops and shaders have been fixed to support larger destination bounds, they should be switched back to the non-drawing version of applyCropRect(). BUG=skia: R=bsalomon@google.com, reed@google.com Committed: https://code.google.com/p/skia/source/detail?r=13805 Review URL: https://codereview.chromium.org/198003008 git-svn-id: http://skia.googlecode.com/svn/trunk@13809 2bbb7eff-a529-9590-31e7-b0007b416f81
* Implement support for a Context parameter in image filtersGravatar senorblanco@chromium.org2014-03-14
| | | | | | | | | | | | | | | Some upcoming work (support for expanding crop rects) requires the clip bounds to be available during filter traversal. This change replaces the SkMatrix parameter in the onFilterImage() traversals with a Context parameter. It contains the CTM, as well as the clip bounds. BUG=skia: R=reed@google.com Review URL: https://codereview.chromium.org/189913021 git-svn-id: http://skia.googlecode.com/svn/trunk@13803 2bbb7eff-a529-9590-31e7-b0007b416f81
* Factory methods for heap-allocated SkImageFilter objects.Gravatar commit-bot@chromium.org2014-03-10
| | | | | | | | | | | | | | | | | | This is part of an effort to ensure that all SkPaint effects can only be allocated on the heap. This patch makes the constructors of SkImageFilter and its subclasses non-public and instead provides factory methods for creating these objects on the heap. We temporarily keep constructor of publicly visible classes public behind a flag. BUG=skia:2187 R=scroggo@google.com, mtklein@chromium.org, reed@google.com, senorblanco@google.com, senorblanco@chromium.org, bsalomon@google.com, sugoi@chromium.org, zork@chromium.org Author: dominikg@chromium.org Review URL: https://codereview.chromium.org/182983003 git-svn-id: http://skia.googlecode.com/svn/trunk@13718 2bbb7eff-a529-9590-31e7-b0007b416f81
* Factory methods for heap-allocated SkColorFilter objects.Gravatar commit-bot@chromium.org2014-02-21
| | | | | | | | | | | | | | | | | | This is part of an effort to ensure that all SkPaint effects can only be allocated on the heap. This patch makes the constructors of SkColorFilter and its subclasses non-public and instead provides factory methods for creating these objects on the heap. We temporarily keep constructor of publicly visible classes public behind a flag. BUG=skia:2187 R=scroggo@google.com, mtklein@google.com, reed@google.com Author: dominikg@chromium.org Review URL: https://codereview.chromium.org/175293002 git-svn-id: http://skia.googlecode.com/svn/trunk@13539 2bbb7eff-a529-9590-31e7-b0007b416f81
* Change device factories to take SkImageInfo instead of SkBitmap::ConfigGravatar commit-bot@chromium.org2014-02-16
| | | | | | | | | | | | | patch from issue 167033002 BUG=skia: R=reed@google.com Author: reed@chromium.org Review URL: https://codereview.chromium.org/168653002 git-svn-id: http://skia.googlecode.com/svn/trunk@13463 2bbb7eff-a529-9590-31e7-b0007b416f81
* replace setConfig+allocPixels with single callGravatar mike@reedtribe.org2014-02-13
| | | | | | | | BUG=skia: Review URL: https://codereview.chromium.org/162643002 git-svn-id: http://skia.googlecode.com/svn/trunk@13426 2bbb7eff-a529-9590-31e7-b0007b416f81
* Mid-air collision: fix constness for onFilterImage in new test.Gravatar senorblanco@chromium.org2014-02-05
| | | | | | | | | TBR=fmalita BUG=skia: Review URL: https://codereview.chromium.org/151323003 git-svn-id: http://skia.googlecode.com/svn/trunk@13332 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix a problem with scaled filters in tiled SkPicture playback.Gravatar senorblanco@chromium.org2014-02-05
| | | | | | | | | | | | | | | The matrix used during filter application should be up-to-date, so that the filter parameters can be scaled by the CTM (e.g., for hiDPI). However, tiled playback defers setting of the matrix until after the restore() call which draws the filter, which is too late. Moving the setMatrix() ahead of the restore() sequence fixes the problem. TEST=ImageFilterMatrixTest R=junov@chromium.org Review URL: https://codereview.chromium.org/145723007 git-svn-id: http://skia.googlecode.com/svn/trunk@13331 2bbb7eff-a529-9590-31e7-b0007b416f81
* More bot whack-a-mole: fix Win build.Gravatar senorblanco@chromium.org2014-02-04
| | | | | | | | | BUG=skia: TBR=fmalita@chromium.org Review URL: https://codereview.chromium.org/146073006 git-svn-id: http://skia.googlecode.com/svn/trunk@13295 2bbb7eff-a529-9590-31e7-b0007b416f81
* Speculative build fix after r13292.Gravatar fmalita@google.com2014-02-03
| | | | | | | | TBR=senorblanco@chromium.org Review URL: https://codereview.chromium.org/153213002 git-svn-id: http://skia.googlecode.com/svn/trunk@13294 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix skia_gpu=0 build.Gravatar senorblanco@chromium.org2014-02-03
| | | | | | | | | BUG=skia: TBR=bsalomon@google.com Review URL: https://codereview.chromium.org/132503006 git-svn-id: http://skia.googlecode.com/svn/trunk@13293 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix image filter crop offsets for GPU path.Gravatar senorblanco@chromium.org2014-02-03
| | | | | | | | | | | | | This is the GPU-side version of https://codereview.chromium.org/112803004/. Also factored the crop offset unit test into a function, so we can call it with both CPU & GPU devices. R=bsalomon@google.com Review URL: https://codereview.chromium.org/153113003 git-svn-id: http://skia.googlecode.com/svn/trunk@13292 2bbb7eff-a529-9590-31e7-b0007b416f81
* Cleanup: Sanitize the order of includes under tests/Gravatar tfarina@chromium.org2014-01-24
| | | | | | | | | | | | | | | | Initially this was to make sure Test.h appeared after the Sk*.h includes. Patch generated by the following command line: $ ~/chromium/src/tools/sort-headers.py tests/*.cpp BUG=None TEST=tests R=robertphillips@google.com Review URL: https://codereview.chromium.org/145313004 git-svn-id: http://skia.googlecode.com/svn/trunk@13177 2bbb7eff-a529-9590-31e7-b0007b416f81
* Move macros from TestClassDef.h to Test.hGravatar commit-bot@chromium.org2014-01-14
| | | | | | | | | | | | | | Motivation: those macros don't make any sense without the definitions in Test.h. BUG= R=mtklein@google.com Author: halcanary@google.com Review URL: https://codereview.chromium.org/138563004 git-svn-id: http://skia.googlecode.com/svn/trunk@13074 2bbb7eff-a529-9590-31e7-b0007b416f81
* Make SkImageFilter crop rects relative to the primitive origin, instead of ↵Gravatar senorblanco@chromium.org2014-01-03
| | | | | | | | | | | | | | | | | | relative to their parent's crop rect. This is required by SVG semantics, and is more sane anyway. To do this, this patch changes the "offset/loc" parameter in filterImage() / onFilterImage() from an inout-param to an out-param only, so that the calling filter can know how much the input filter wants its result offset (and doesn't include the original primitive position). This offset can then be applied to the current filter's crop rect. (I've renamed the parameter "offset" in all cases to make this clear.) This makes the call sites in SkCanvas/SkGpuDevice responsible for applying the resulting offset to the primitive's position, which is actually a fairly small change. This change also fixes SkTileImageFilter and SkOffsetImageFilter to correctly handle an input offset, which they weren't before. This required modifying the GM's, since they assumed the broken behaviour. NOTE: this will require rebaselining the imagefiltersgraph test, since it has a new test case. NOTE: this will "break" the Blink layout tests css3/filters/effect-reference-subregion-chained-hw.html and css3/filters/effect-reference-subregion-hw.html, but it actually makes them give correct results. It should be suppressed on the skia roll, and I'll rebaseline it. R=reed@google.com Review URL: https://codereview.chromium.org/112803004 git-svn-id: http://skia.googlecode.com/svn/trunk@12895 2bbb7eff-a529-9590-31e7-b0007b416f81
* Get rid of DEFINE_TESTCLASS() macro.Gravatar tfarina@chromium.org2013-12-18
| | | | | | | | | | | | | Remaining tests were rewrite to use DEF_TEST() macro instead. This fixes the FIXME in TestClassDef.h BUG=None TEST=tests R=mtklein@google.com Review URL: https://codereview.chromium.org/114563003 git-svn-id: http://skia.googlecode.com/svn/trunk@12760 2bbb7eff-a529-9590-31e7-b0007b416f81
* remove SkFloatToScalar macroGravatar commit-bot@chromium.org2013-11-25
| | | | | | | | | | | BUG= R=reed@google.com, djsollen@google.com Author: caryclark@google.com Review URL: https://codereview.chromium.org/85463005 git-svn-id: http://skia.googlecode.com/svn/trunk@12385 2bbb7eff-a529-9590-31e7-b0007b416f81
* Address some more valgrind issuesGravatar robertphillips@google.com2013-11-14
| | | | | | | | R=borenet@google.com Review URL: https://codereview.chromium.org/59713010 git-svn-id: http://skia.googlecode.com/svn/trunk@12286 2bbb7eff-a529-9590-31e7-b0007b416f81
* Remove support for SK_CROP_RECT_IS_INT, now that it is no longer used in ↵Gravatar senorblanco@chromium.org2013-10-16
| | | | | | | | | | | Blink or Chrome. BUG= R=reed@google.com, reed Review URL: https://codereview.chromium.org/27521002 git-svn-id: http://skia.googlecode.com/svn/trunk@11812 2bbb7eff-a529-9590-31e7-b0007b416f81
* Change SkImageFilter's cropRect from SkIRect to a CropRect struct, ↵Gravatar senorblanco@chromium.org2013-10-10
| | | | | | | | | | | | | | containing an SkRect and flags indicating which parameters are set. NOTE: this will require SK_CROP_RECT_IS_INT=1 to be set in Chrome until Blink has been updated to use SkImageFilter::CropRect. Include https://codereview.chromium.org/26528002/ with the Skia roll. Note also that SK_CROP_RECT_IS_INT is a temporary measure until all call sites in Blink have been updated to use SkRect. R=reed@google.com Review URL: https://codereview.chromium.org/26371002 git-svn-id: http://skia.googlecode.com/svn/trunk@11692 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Housekeeper-NightlyGravatar skia.committer@gmail.com2013-09-17
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@11309 2bbb7eff-a529-9590-31e7-b0007b416f81
* Compiler fix for r11288Gravatar robertphillips@google.com2013-09-16
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@11289 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert 11247, 11250, 11251, 11257, and 11279 to unblock DEPS roll ↵Gravatar robertphillips@google.com2013-09-16
| | | | | | | | | | | | | | (https://codereview.chromium.org/24159002/) 11279 Sanitizing source files in Housekeeper-Nightly - https://code.google.com/p/skia/source/detail?r=11279 11257 Canary build fix - https://codereview.chromium.org/23532068 11251 More warnings as errors fixes - https://code.google.com/p/skia/source/detail?r=11251 11250 Warnings as errors fix - https://code.google.com/p/skia/source/detail?r=11250 11247 Initial error handling code - https://chromiumcodereview.appspot.com/23021015 git-svn-id: http://skia.googlecode.com/svn/trunk@11288 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert the revert of 11247, 11250, 11251 and 11279 (Chrome already relies on ↵Gravatar robertphillips@google.com2013-09-16
| | | | | | changes in r11247) git-svn-id: http://skia.googlecode.com/svn/trunk@11287 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert 11247, 11250, 11251 and 11279 to unblock DEPS roll ↵Gravatar robertphillips@google.com2013-09-16
| | | | | | | | | | | | | (https://codereview.chromium.org/24159002/) 11279 Sanitizing source files in Housekeeper-Nightly - https://code.google.com/p/skia/source/detail?r=11279 11251 More warnings as errors fixes - https://code.google.com/p/skia/source/detail?r=11251 11250 Warnings as errors fix - https://code.google.com/p/skia/source/detail?r=11250 11247 Initial error handling code - https://chromiumcodereview.appspot.com/23021015 git-svn-id: http://skia.googlecode.com/svn/trunk@11285 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Housekeeper-NightlyGravatar skia.committer@gmail.com2013-09-14
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@11279 2bbb7eff-a529-9590-31e7-b0007b416f81
* More warnings as errors fixesGravatar robertphillips@google.com2013-09-13
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@11251 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fixed issues found by fuzzerGravatar commit-bot@chromium.org2013-09-13
| | | | | | | | | | | | | | | Last week, the fuzzer found a few numerical issue with filters and I had written some fixes for them. Here are the fixes with some unit tests. For senorblanco : So I figured out what was asserting when we'd get a 0 width "result" in SkBicubicImageFilter::onFilterImage(). Basically, if the "result" SkBitmap object calls SkBitmap::setConfig() with "width" and/or "height" set to 0, then the SkBitmap object will call SkBitmap::reset(), making the SkBitmap object's config invalid. At this point, calling SkBitmap::getAddr32() will assert, even without attempting to dereference the data pointer, because the SkBitmap's config is invalid. If height is valid, but width is 0, then this call to SkBitmap::getAddr32() happens directly in SkBicubicImageFilter::onFilterImage() a few lines lower and asserts right away. BUG= R=senorblanco@google.com, senorblanco@chromium.org, bsalomon@google.com Author: sugoi@chromium.org Review URL: https://chromiumcodereview.appspot.com/23533042 git-svn-id: http://skia.googlecode.com/svn/trunk@11249 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Housekeeper-NightlyGravatar skia.committer@gmail.com2013-07-25
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@10340 2bbb7eff-a529-9590-31e7-b0007b416f81
* This patch implements a crop rect for SkImageFilter. It has been implemented ↵Gravatar senorblanco@chromium.org2013-07-24
for SkColorFilterImageFilter and SkBlurImageFilter as examples. In order to preserve the immutability of SkImageFilters, the crop rect is passed as a constructor parameter. If NULL (the default), the bounds of the input image are used, as before. This also tightens up the boundary handling for SkImageBlurFilter on the GPU backend. Where we were previously using clamping semantics, we now respect decal semantics (so we don't oversaturate the edges). This brings the GPU and raster backends into closer alignment, but will require some new baselines for the GPU tests. At a minimum, the following tests will need new baselines: imageblur, imagefiltersbase, imagefilterscropped, spritebitmap. R=reed@google.com Committed: https://code.google.com/p/skia/source/detail?r=10251 Review URL: https://codereview.chromium.org/19775006 git-svn-id: http://skia.googlecode.com/svn/trunk@10338 2bbb7eff-a529-9590-31e7-b0007b416f81