aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkImageFilter.h
Commit message (Collapse)AuthorAge
* Simplify flattening to just write enough to call the ↵Gravatar reed2014-08-21
| | | | | | | | | | | | | | | | | | factory/public-constructor for the class. We want to *not* rely on private constructors, and not rely on calling through the inheritance hierarchy for either flattening or unflattening(CreateProc). Refactoring pattern: 1. guard the existing constructor(readbuffer) with the legacy build-flag 2. If you are a instancable subclass, implement CreateProc(readbuffer) to create a new instances from the buffer params (or return NULL). If you're a shader subclass 1. You must read/write the local matrix if your class accepts that in its factory/constructor, else ignore it. R=robertphillips@google.com, mtklein@google.com, senorblanco@google.com, senorblanco@chromium.org, sugoi@chromium.org Author: reed@google.com Review URL: https://codereview.chromium.org/395603002
* Remove external SkImageFilter cache, and rename UniqueIDCache -> Cache.Gravatar senorblanco2014-08-08
| | | | | | | | | | | | There Can Only Be One.... Cache for SkImageFilter. R=bsalomon@google.com BUG=skia: Author: senorblanco@chromium.org Review URL: https://codereview.chromium.org/452923002
* Implement a persistent uniqueID-based cache for SkImageFilter.Gravatar senorblanco2014-07-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a unique ID to SkImageFilter, and use it as part of a persistent cache of image-filtered results. This is used for caching frame-to-frame coherent filters. We also keep track of which filter subtrees do not reference the src input, and use a GenID of zero for the src input in that case. That way, subtrees which are not dependent on the filter input can be cached independently of it. This gives approximately a 4X speedup on letmespellitoutforyou.com/samples/svg/filter_terrain.svg on Z620 and Nexus10. The cache key consists of the uniqueID of the filter, the clip bounds, the CTM and the genID of the input bitmap. Since this does not yet handle the case where the input primitives (and part of the resulting filter tree) are unchanged, we have to keep around the external cache for that painting case. When the work to cache unchanging input primitives is done, the old cache can be removed, and the new UniqueIDCache will be renamed to Cache. R=bsalomon@google.com, mtklein@google.com Author: senorblanco@chromium.org Review URL: https://codereview.chromium.org/414483003
* Use if instead of ifdef SK_SUPPORT_GPUGravatar kkinnunen2014-07-29
| | | | | | | | | | The SK_SUPPORT_GPU is always defined. R=reed@google.com, bsalomon@google.com Author: kkinnunen@nvidia.com Review URL: https://codereview.chromium.org/331353003
* factor out flattening/unflattening of common fields from SkImageFilterGravatar reed2014-07-17
| | | | | | | | | | This is a precursor to changing SkImageFilters (and all effects) to unflatten via a factory instead of a constructor. In that world, each subclass of ImageFilter will need to control/initiate the unflattening of the common fields, so they can be extract and passed to their Factory. R=senorblanco@google.com, robertphillips@google.com, mtklein@google.com, senorblanco@chromium.org Author: reed@google.com Review URL: https://codereview.chromium.org/395273002
* Remove ability for Release code to call getRefCnt() or getWeakRefCnt().Gravatar mtklein2014-07-09
| | | | | | | | | | | | | | | | | | | | These getRefCnt() methods are not thread safe, so Skia code should not be calling them. unique() is fine. SkDEBUG code (SkASSERTs) can still call getRefCnt() / getWeakRefCnt(). This adds tools/RefCntIs.{h,cpp}, which lets tests make their assertions in both debug and release modes. BUG=skia:2726 Committed: https://skia.googlesource.com/skia/+/4ae94ffce5ecf1b71cb5e295b68bf4ec9e697443 R=senorblanco@chromium.org, mtklein@google.com, reed@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/378643003
* Revert "Remove ability for Release code to call getRefCnt() or getWeakRefCnt()."Gravatar Mike Klein2014-07-09
| | | | | | | | This reverts commit 4ae94ffce5ecf1b71cb5e295b68bf4ec9e697443. BUG=skia: Review URL: https://codereview.chromium.org/382523002
* Clean up SkImageFilter constructors.Gravatar senorblanco2014-07-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | Now that all creation of SkImageFilters goes through factory Create() methods, there's no real reason for the convenience constructors. Some SkImageFilter subclasses which actually have zero DAG-able inputs were passing NULL to the superclass constructor. This actually means 1 input, with a NULL value, not zero inputs. This becomes more relevant for the upcoming cache infrastructure, where this indicates that the filter will use its src input, where in fact some of these filters do not (they are image generators only). Limiting SkImageFilter to a single constructor resolves this ambiguity. Along the way, I removed all of the default parameters to the constructors, since the Create methods always call them with the full argument list. BUG=skia: R=reed@google.com Author: senorblanco@chromium.org Review URL: https://codereview.chromium.org/376953003
* Make GrDrawState and GrPaint take GrEffect* instead of GrEffectRef*.Gravatar bsalomon2014-07-08
| | | | | | | | | | | | | | Make Sk-effect virtuals produce GrEffect* rather than GrEffectRef* Make GrEffectRef a typedef for GrEffect. Committed: https://skia.googlesource.com/skia/+/2011fe9cdfa63b83489a146cea6a724cede352c8 R=robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/377503004
* Remove ability for Release code to call getRefCnt() or getWeakRefCnt().Gravatar mtklein2014-07-08
| | | | | | | | | | | | | | | | | These getRefCnt() methods are not thread safe, so Skia code should not be calling them. unique() is fine. SkDEBUG code (SkASSERTs) can still call getRefCnt() / getWeakRefCnt(). This adds tools/RefCntIs.{h,cpp}, which lets tests make their assertions in both debug and release modes. BUG=skia:2726 R=senorblanco@chromium.org, mtklein@google.com, reed@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/378643003
* Revert of Make GrDrawState and GrPaint take GrEffect* instead of ↵Gravatar reed2014-07-07
| | | | | | | | | | | | | | | | | | | | | | | | | GrEffectRef*. (https://codereview.chromium.org/377503004/) Reason for revert: broke linux builders Original issue's description: > Make GrDrawState and GrPaint take GrEffect* instead of GrEffectRef*. > > Make Sk-effect virtuals produce GrEffect* rather than GrEffectRef* > > Make GrEffectRef a typedef for GrEffect. > > Committed: https://skia.googlesource.com/skia/+/2011fe9cdfa63b83489a146cea6a724cede352c8 R=robertphillips@google.com, bsalomon@google.com TBR=bsalomon@google.com, robertphillips@google.com NOTREECHECKS=true NOTRY=true Author: reed@google.com Review URL: https://codereview.chromium.org/372053003
* Make GrDrawState and GrPaint take GrEffect* instead of GrEffectRef*.Gravatar bsalomon2014-07-07
| | | | | | | | | | | | Make Sk-effect virtuals produce GrEffect* rather than GrEffectRef* Make GrEffectRef a typedef for GrEffect. R=robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/377503004
* Add a missing SK_API to SkImageFilter::Cache.Gravatar senorblanco@chromium.org2014-04-23
| | | | | | | | TBR=bsalomon@google.com Review URL: https://codereview.chromium.org/251353003 git-svn-id: http://skia.googlecode.com/svn/trunk@14343 2bbb7eff-a529-9590-31e7-b0007b416f81
* Allow clients to specify an external SkImageFilter cache.Gravatar senorblanco@chromium.org2014-04-14
| | | | | | | | | | | | | | This change allows external callers to substitute their own SkImageFilter cache for the default intra-frame cache in Skia. This allows the caller to perform inter-frame caching for example, by the maintaining a persistent cache between frames and doing custom invalidation. R=reed@google.com Review URL: https://codereview.chromium.org/225903010 git-svn-id: http://skia.googlecode.com/svn/trunk@14181 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
* 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
* Revert "Implement support for expanding crop rects in image filters"Gravatar senorblanco@chromium.org2014-03-14
| | | | | | | | | | | Breaking ImageFilterTests unit test. TBR=bsalomon@google.com BUG=skia: Review URL: https://codereview.chromium.org/196353021 git-svn-id: http://skia.googlecode.com/svn/trunk@13806 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 Review URL: https://codereview.chromium.org/198003008 git-svn-id: http://skia.googlecode.com/svn/trunk@13805 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
* Cleanup patch to move all of SkImageFilterUtils into SkImageFilter.Gravatar senorblanco@chromium.org2014-03-03
| | | | | | | | | | | | | | This was a utility class that dates from before GPU code was allowed in core. Now that it is, there's no reason not to have this functionality in SkImageFilter. Covered by existing tests. R=reed@google.com Review URL: https://codereview.chromium.org/185973003 git-svn-id: http://skia.googlecode.com/svn/trunk@13646 2bbb7eff-a529-9590-31e7-b0007b416f81
* Make SkImageFilter methods const.Gravatar commit-bot@chromium.org2014-02-05
| | | | | | | | | | | | | | SkImageFilter had some non-const methods that could all be made const. This is a first step towards making SkImageFilter immutable. BUG=skia:2097 R=mtklein@google.com, reed@google.com, robertphillips@google.com Author: dominikg@chromium.org Review URL: https://codereview.chromium.org/148883011 git-svn-id: http://skia.googlecode.com/svn/trunk@13330 2bbb7eff-a529-9590-31e7-b0007b416f81
* Implement correct clipping for image filters.Gravatar senorblanco@chromium.org2014-02-05
| | | | | | | | | | | | | | | | | | | | | | | | | | Image filters in Skia currently clip the size of the the offscreen bitmap used for filtering to the device clip bounds. This means that any pixel-moving filter (e.g., blur) has edge artifacts at the clip boundaries. This is problematic for tiling, where a single SkPicture is played back with a clip set to the tile boundaries. By implementing the onFilterBounds() traversal, and using it in saveLayer() when a filter is present, we can clip the layer to the expanded clip rect. Note that this requires that the traversal be performed in reverse as compared to computeFastBounds(). (It's also done in device space, unlike computeFastBounds()). New test imagefiltersclipped tests pixel-moving filters when clipped by various clip rects. New test imageblurtiled tests tiled (compositor-style) rendering of blurred text. There should be no artifacts at the tile boundaries. BUG=337831 R=reed@google.com Review URL: https://codereview.chromium.org/23011012 git-svn-id: http://skia.googlecode.com/svn/trunk@13323 2bbb7eff-a529-9590-31e7-b0007b416f81
* Refactor read and write buffers.Gravatar commit-bot@chromium.org2014-01-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Eliminates SkFlattenable{Read,Write}Buffer, promoting SkOrdered{Read,Write}Buffer a step each in the hierarchy. What used to be this: SkFlattenableWriteBuffer -> SkOrderedWriteBuffer SkFlattenableReadBuffer -> SkOrderedReadBuffer SkFlattenableReadBuffer -> SkValidatingReadBuffer is now SkWriteBuffer SkReadBuffer -> SkValidatingReadBuffer Benefits: - code is simpler, names are less wordy - the generic SkFlattenableFooBuffer code in SkPaint was incorrect; removed - write buffers are completely devirtualized, important for record speed This refactoring was mostly mechanical. You aren't going to find anything interesting in files with less than 10 lines changed. BUG=skia: R=reed@google.com, scroggo@google.com, djsollen@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/134163010 git-svn-id: http://skia.googlecode.com/svn/trunk@13245 2bbb7eff-a529-9590-31e7-b0007b416f81
* Implement a computeFastBounds() traversal for SkImageFilter.Gravatar senorblanco@chromium.org2014-01-27
| | | | | | | | | | | This allows for correct culling of primitives which have image filters applied. R=reed@google.com BUG=skia: Review URL: https://codereview.chromium.org/137423005 git-svn-id: http://skia.googlecode.com/svn/trunk@13207 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
* Changed maxInputCount for exact inputCountGravatar commit-bot@chromium.org2013-12-04
| | | | | | | | | | | | | Processing still had issue when the number of inputs was 0, so I changed my previous fix from a maximum input count to an exact input count. -1 is used when the input count isn't fixed (but still has to be a non-negative number). BUG= R=senorblanco@chromium.org, reed@google.com, sugoi@google.com, bsalomon@google.com Author: sugoi@chromium.org Review URL: https://codereview.chromium.org/100803004 git-svn-id: http://skia.googlecode.com/svn/trunk@12492 2bbb7eff-a529-9590-31e7-b0007b416f81
* Adding more validationGravatar commit-bot@chromium.org2013-11-25
| | | | | | | | | | | | | | | | - Added a way to check that the number of inputs of a filter is not more than a filter expects - Added validation of reftype in SkBitmap::unflatten() - Added validation on fKD (diffuse lighting constant) and fKS (specular lighting constant) to make sure that they are always non-negative numbers - Added validation of SkPerlinNoiseShader::fType and SkPerlinNoiseShader::fNumOctaves BUG= R=reed@google.com, senorblanco@google.com, mtklein@google.com, senorblanco@chromium.org, sugoi@google.com Author: sugoi@chromium.org Review URL: https://codereview.chromium.org/83343003 git-svn-id: http://skia.googlecode.com/svn/trunk@12388 2bbb7eff-a529-9590-31e7-b0007b416f81
* Initial error handling codeGravatar commit-bot@chromium.org2013-10-23
| | | | | | | | | | | | | | | | I made it as simple as possible. The impact seems minimal and it should do what's necessary to make this code secure. BUG= Committed: http://code.google.com/p/skia/source/detail?r=11247 R=reed@google.com, scroggo@google.com, djsollen@google.com, sugoi@google.com, bsalomon@google.com, mtklein@google.com, senorblanco@google.com, senorblanco@chromium.org Author: sugoi@chromium.org Review URL: https://codereview.chromium.org/23021015 git-svn-id: http://skia.googlecode.com/svn/trunk@11922 2bbb7eff-a529-9590-31e7-b0007b416f81
* Implement crop rect support for SkMatrixConvolutionImageFilter.Gravatar senorblanco@chromium.org2013-10-18
| | | | | | | | R=bsalomon@google.com Review URL: https://codereview.chromium.org/27471002 git-svn-id: http://skia.googlecode.com/svn/trunk@11863 2bbb7eff-a529-9590-31e7-b0007b416f81
* Make SkImageFilter::asNewEffect() (and all derived-class overrides) protected.Gravatar senorblanco@chromium.org2013-10-17
| | | | | | | | R=bsalomon@google.com, bsalomon Review URL: https://codereview.chromium.org/26937006 git-svn-id: http://skia.googlecode.com/svn/trunk@11847 2bbb7eff-a529-9590-31e7-b0007b416f81
* Make CropRect immutable after construction.Gravatar senorblanco@chromium.org2013-10-16
| | | | | | | | | BUG= R=reed@google.com Review URL: https://codereview.chromium.org/27490005 git-svn-id: http://skia.googlecode.com/svn/trunk@11819 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
* Split SkDevice into SkBaseDevice and SkBitmapDeviceGravatar robertphillips@google.com2013-08-29
| | | | | | | | https://codereview.chromium.org/22978012/ git-svn-id: http://skia.googlecode.com/svn/trunk@10995 2bbb7eff-a529-9590-31e7-b0007b416f81
* In image filters, apply the CTM and offset to the crop rect. This is ↵Gravatar senorblanco@chromium.org2013-08-27
| | | | | | | | | | | | | | necessary to compensate for both clipping applied by the compositor (communicated via the CTM) and for cropping applied in upstream image filters (communicated via the offset). This requires a few ugly conversions, since the crop rect is an SkIRect, and the ctm is an SkMatrix. I also had to offset the matrix passed to filter evaluation by drawSprite() and internalDrawBitmap() by the primitive position. This is the same offset that is applied when drawing the primitive, to compensate for the internal saveLayer(). Also apply the total matrix to the filter params in asNewEffect(), so that (for example) lighting params are offset by both the compositor clipping and upstream crop rects. R=reed@google.com Review URL: https://codereview.chromium.org/23295017 git-svn-id: http://skia.googlecode.com/svn/trunk@10961 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert r10830 (Split SkDevice out of SkRasterDevice) until we can get ↵Gravatar robertphillips@google.com2013-08-20
| | | | | | Chromium ready. git-svn-id: http://skia.googlecode.com/svn/trunk@10835 2bbb7eff-a529-9590-31e7-b0007b416f81
* Split SkDevice out of SkBitmapDeviceGravatar robertphillips@google.com2013-08-20
| | | | | | | | https://codereview.chromium.org/22978012/ git-svn-id: http://skia.googlecode.com/svn/trunk@10830 2bbb7eff-a529-9590-31e7-b0007b416f81
* Remove warning comment from SkImageFilter.Gravatar senorblanco@chromium.org2013-08-05
| | | | | | | | R=reed@google.com Review URL: https://codereview.chromium.org/22236002 git-svn-id: http://skia.googlecode.com/svn/trunk@10546 2bbb7eff-a529-9590-31e7-b0007b416f81
* Added ctm matrix to GPU pathGravatar commit-bot@chromium.org2013-08-05
| | | | | | | | | | | | | There should be no changes in behavior caused by this cl, it just adds the ctm matrix to filterImageGPU so that it may be used for scaling on all platforms when it is implemented on the blink side. BUG= R=senorblanco@google.com, senorblanco@chromium.org Author: sugoi@chromium.org Review URL: https://chromiumcodereview.appspot.com/22209002 git-svn-id: http://skia.googlecode.com/svn/trunk@10536 2bbb7eff-a529-9590-31e7-b0007b416f81
* Implement crop rect for lighting image filters. Changes for the CPU path ↵Gravatar senorblanco@chromium.org2013-07-26
| | | | | | | | | | | | | | were fairly straightforward: use the bounds rectangle when traversing the pixels, not the source rectangle. For the GPU path, this required modifying the signature of SkImageFilter::asNewEffect() to receive the bounds offset, so that the lighting filters could offset the light position by the offset. It also required modifying the base-class implementation of SkImageFilter::filterImageGPU() (which implements single-pass filters) to intersect against the bounds rect, to pass its offset to asNewEffect(), and to modify the caller's offset (so it's drawn in the correct place). Note: this will require rebaselining the lighting GM. Six new test cases were added, to accommodate a cropped version of each lighting filter. R=bsalomon@google.com, reed@google.com Review URL: https://codereview.chromium.org/20426002 git-svn-id: http://skia.googlecode.com/svn/trunk@10379 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
* Reverting r10251 (Implement crop rect for SkImageFilter) due to ↵Gravatar robertphillips@google.com2013-07-24
| | | | | | Chromium-side unit test failures git-svn-id: http://skia.googlecode.com/svn/trunk@10304 2bbb7eff-a529-9590-31e7-b0007b416f81
* This patch implements a crop rect for SkImageFilter. It has been implemented ↵Gravatar senorblanco@chromium.org2013-07-22
| | | | | | | | | | | | | | | | 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 Review URL: https://codereview.chromium.org/19775006 git-svn-id: http://skia.googlecode.com/svn/trunk@10251 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Housekeeper-NightlyGravatar skia.committer@gmail.com2013-07-11
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@9992 2bbb7eff-a529-9590-31e7-b0007b416f81
* Implement offset for GPU filter path. Although we can't yet use this in ↵Gravatar commit-bot@chromium.org2013-07-10
| | | | | | | | | | | | | | | | Blink for FEOffset, due to SVG semantics, we can use it to support crop rect (upcoming patch). This patch adds the parameter to the filterImageGPU() signature, plumbs through the code on the GPU side, and implements support for it in SkXfermodeImageFilter for both raster and GPU. Of the remaining filters with GPU implementations, Blur, Morphology, Bicubic and Displacement work fine; they're commutative wrt offset and can simply pass it up the chain. Blend is not, but will be removed shortly anyway (has been replaced with SkXfermodeImageFilter in Blink). R=reed@google.com, bsalomon@google.com Author: senorblanco@chromium.org Review URL: https://chromiumcodereview.appspot.com/15995026 git-svn-id: http://skia.googlecode.com/svn/trunk@9977 2bbb7eff-a529-9590-31e7-b0007b416f81
* Remove SkImageFilter::getInputResult(), since its return value is notGravatar senorblanco@chromium.org2013-05-24
| | | | | | | | | | | | style-compliant, and doesn't allow us to abort on failure. R=reed@google.com Committed: https://code.google.com/p/skia/source/detail?r=9245 Review URL: https://codereview.chromium.org/15600003 git-svn-id: http://skia.googlecode.com/svn/trunk@9274 2bbb7eff-a529-9590-31e7-b0007b416f81
* Reverting r9245 due to Chrome breakageGravatar robertphillips@google.com2013-05-22
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@9250 2bbb7eff-a529-9590-31e7-b0007b416f81
* Remove SkImageFilter::getInputResult(), since its return value is notGravatar senorblanco@chromium.org2013-05-22
| | | | | | | | | | style-compliant, and doesn't allow us to abort on failure. R=reed@google.com Review URL: https://codereview.chromium.org/15600003 git-svn-id: http://skia.googlecode.com/svn/trunk@9245 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Skia_Periodic_House_KeepingGravatar skia.committer@gmail.com2013-04-09
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8568 2bbb7eff-a529-9590-31e7-b0007b416f81
* Allow single-pass filters (which use asNewEffect()) to participate in the ↵Gravatar senorblanco@chromium.org2013-04-08
| | | | | | | | | | image filter DAG. This was done by introducing the SkSinglePassImageFilter abstract base class, which implements canFilterImageGPU() and filterImageGPU() on behalf of the derived class. The derived class still only needs to asNewEffect(). This allows us to recurse on the filter input in SkSinglePassImageFilter::onFilterImageGPU(). It also allows us to remove any knowledge of single-pass image filters from SkGpuDevice and from the SkImageFilter base class as well. BUG= Review URL: https://codereview.chromium.org/13602013 git-svn-id: http://skia.googlecode.com/svn/trunk@8563 2bbb7eff-a529-9590-31e7-b0007b416f81