194d775edc
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
47 lines
1.4 KiB
C++
47 lines
1.4 KiB
C++
/*
|
|
* Copyright 2013 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef SkGpuBlurUtils_DEFINED
|
|
#define SkGpuBlurUtils_DEFINED
|
|
|
|
#if SK_SUPPORT_GPU
|
|
class GrTexture;
|
|
class GrContext;
|
|
#endif
|
|
|
|
struct SkRect;
|
|
|
|
namespace SkGpuBlurUtils {
|
|
|
|
#if SK_SUPPORT_GPU
|
|
/**
|
|
* Applies a 2D Gaussian blur to a given texture.
|
|
* @param context The GPU context
|
|
* @param srcTexture The source texture to be blurred.
|
|
* @param canClobberSrc If true, srcTexture may be overwritten, and
|
|
* may be returned as the result.
|
|
* @param rect The destination rectangle.
|
|
* @param cropToRect If true, do not sample any pixels outside the
|
|
* source rect.
|
|
* @param sigmaX The blur's standard deviation in X.
|
|
* @param sigmaY The blur's standard deviation in Y.
|
|
* @return the blurred texture, which may be srcTexture reffed, or a
|
|
* new texture. It is the caller's responsibility to unref this texture.
|
|
*/
|
|
GrTexture* GaussianBlur(GrContext* context,
|
|
GrTexture* srcTexture,
|
|
bool canClobberSrc,
|
|
const SkRect& rect,
|
|
bool cropToRect,
|
|
float sigmaX,
|
|
float sigmaY);
|
|
#endif
|
|
|
|
};
|
|
|
|
#endif
|