Make SkImageFilter methods const.

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
This commit is contained in:
commit-bot@chromium.org 2014-02-05 22:32:02 +00:00
parent d2e88f67c9
commit ae761f7545
54 changed files with 107 additions and 109 deletions

View File

@ -23,7 +23,7 @@ public:
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter)
protected:
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) {
SkBitmap* result, SkIPoint* offset) const {
return false;
}
@ -46,7 +46,7 @@ public:
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter)
protected:
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) {
SkBitmap* result, SkIPoint* offset) const {
*result = src;
return true;
}

View File

@ -29,7 +29,7 @@ public:
: SkImageFilter(input), fDX(dx), fDY(dy) {}
virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
SkBitmap* dst, SkIPoint* offset) SK_OVERRIDE {
SkBitmap* dst, SkIPoint* offset) const SK_OVERRIDE {
SkBitmap source = src;
SkImageFilter* input = getInput(0);
SkIPoint srcOffset = SkIPoint::Make(0, 0);

View File

@ -227,7 +227,7 @@ protected:
* some subclasses that do not support pixel manipulations after drawing
* has occurred (e.g. printing). The default implementation returns true.
*/
virtual bool allowImageFilter(SkImageFilter*) SK_OVERRIDE;
virtual bool allowImageFilter(const SkImageFilter*) SK_OVERRIDE;
/**
* Override and return true for filters that the device can handle
@ -236,7 +236,7 @@ protected:
* Returning false means the SkCanvas will have apply the filter itself,
* and just pass the resulting image to the device.
*/
virtual bool canHandleImageFilter(SkImageFilter*) SK_OVERRIDE;
virtual bool canHandleImageFilter(const SkImageFilter*) SK_OVERRIDE;
/**
* Related (but not required) to canHandleImageFilter, this method returns
@ -245,7 +245,7 @@ protected:
* If the device does not recognize or support this filter,
* it just returns false and leaves result and offset unchanged.
*/
virtual bool filterImage(SkImageFilter*, const SkBitmap&, const SkMatrix&,
virtual bool filterImage(const SkImageFilter*, const SkBitmap&, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
private:

View File

@ -341,7 +341,7 @@ protected:
* some subclasses that do not support pixel manipulations after drawing
* has occurred (e.g. printing). The default implementation returns true.
*/
virtual bool allowImageFilter(SkImageFilter*) = 0;
virtual bool allowImageFilter(const SkImageFilter*) = 0;
/**
* Override and return true for filters that the device can handle
@ -350,7 +350,7 @@ protected:
* Returning false means the SkCanvas will have apply the filter itself,
* and just pass the resulting image to the device.
*/
virtual bool canHandleImageFilter(SkImageFilter*) = 0;
virtual bool canHandleImageFilter(const SkImageFilter*) = 0;
/**
* Related (but not required) to canHandleImageFilter, this method returns
@ -359,7 +359,7 @@ protected:
* If the device does not recognize or support this filter,
* it just returns false and leaves result and offset unchanged.
*/
virtual bool filterImage(SkImageFilter*, const SkBitmap&, const SkMatrix&,
virtual bool filterImage(const SkImageFilter*, const SkBitmap&, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) = 0;
// This is equal kBGRA_Premul_Config8888 or kRGBA_Premul_Config8888 if

View File

@ -55,10 +55,10 @@ public:
virtual SkBaseDevice* createDevice(int width, int height) = 0;
// returns true if the proxy can handle this filter natively
virtual bool canHandleImageFilter(SkImageFilter*) = 0;
virtual bool canHandleImageFilter(const SkImageFilter*) = 0;
// returns true if the proxy handled the filter itself. if this returns
// false then the filter's code will be called.
virtual bool filterImage(SkImageFilter*, const SkBitmap& src,
virtual bool filterImage(const SkImageFilter*, const SkBitmap& src,
const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset) = 0;
};
@ -77,7 +77,7 @@ public:
* the result and offset parameters will be ignored by the caller.
*/
bool filterImage(Proxy*, const SkBitmap& src, const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset);
SkBitmap* result, SkIPoint* offset) const;
/**
* Given the src bounds of an image, this returns the bounds of the result
@ -105,7 +105,7 @@ public:
* single-pass processing using asNewEffect().
*/
virtual bool filterImageGPU(Proxy*, const SkBitmap& src, const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset);
SkBitmap* result, SkIPoint* offset) const;
/**
* Returns whether this image filter is a color filter and puts the color filter into the
@ -187,7 +187,7 @@ protected:
* caller.
*/
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset);
SkBitmap* result, SkIPoint* offset) const;
// Given the bounds of the destination rect to be filled in device
// coordinates (first parameter), and the CTM, compute (conservatively)
// which rect of the source image would be required (third parameter).

View File

@ -28,7 +28,7 @@ public:
* this function returns src. If the filter has no GPU implementation, it
* will be processed in software and uploaded to the GPU.
*/
static bool GetInputResultGPU(SkImageFilter* filter, SkImageFilter::Proxy* proxy,
static bool GetInputResultGPU(const SkImageFilter* filter, SkImageFilter::Proxy* proxy,
const SkBitmap& src, const SkMatrix& ctm, SkBitmap* result,
SkIPoint* offset);
};

View File

@ -39,12 +39,12 @@ protected:
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* loc) SK_OVERRIDE;
SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
#if SK_SUPPORT_GPU
virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; }
virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
#endif
private:

View File

@ -23,7 +23,7 @@ protected:
explicit SkBitmapSource(SkReadBuffer& buffer);
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
virtual bool onFilterBounds(const SkIRect& src, const SkMatrix& ctm, SkIRect* dst) const SK_OVERRIDE;
private:

View File

@ -26,13 +26,13 @@ protected:
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
SkIRect* dst) const SK_OVERRIDE;
bool canFilterImageGPU() const SK_OVERRIDE { return true; }
virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
private:
SkSize fSigma;

View File

@ -26,7 +26,7 @@ protected:
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* loc) SK_OVERRIDE;
SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
virtual bool asColorFilter(SkColorFilter**) const SK_OVERRIDE;

View File

@ -21,7 +21,7 @@ protected:
explicit SkComposeImageFilter(SkReadBuffer& buffer);
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* loc) SK_OVERRIDE;
SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) const SK_OVERRIDE;
private:

View File

@ -36,7 +36,7 @@ public:
const SkBitmap& src,
const SkMatrix& ctm,
SkBitmap* dst,
SkIPoint* offset) SK_OVERRIDE;
SkIPoint* offset) const SK_OVERRIDE;
virtual void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVERRIDE;
virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
@ -45,7 +45,7 @@ public:
#if SK_SUPPORT_GPU
virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; }
virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
#endif
protected:
@ -57,8 +57,6 @@ private:
ChannelSelectorType fYChannelSelector;
SkScalar fScale;
typedef SkImageFilter INHERITED;
SkImageFilter* getDisplacementInput() { return getInput(0); }
SkImageFilter* getColorInput() { return getInput(1); }
const SkImageFilter* getDisplacementInput() const { return getInput(0); }
const SkImageFilter* getColorInput() const { return getInput(1); }
};

View File

@ -19,7 +19,7 @@ public:
protected:
explicit SkDropShadowImageFilter(SkReadBuffer&);
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
virtual bool onFilterImage(Proxy*, const SkBitmap& source, const SkMatrix&, SkBitmap* result, SkIPoint* loc) SK_OVERRIDE;
virtual bool onFilterImage(Proxy*, const SkBitmap& source, const SkMatrix&, SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
SkIRect* dst) const SK_OVERRIDE;

View File

@ -23,7 +23,7 @@ protected:
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
#if SK_SUPPORT_GPU
virtual bool asNewEffect(GrEffectRef** effect, GrTexture* texture, const SkMatrix& matrix, const SkIRect& bounds) const SK_OVERRIDE;
#endif

View File

@ -68,7 +68,7 @@ protected:
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* loc) SK_OVERRIDE;
SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
#if SK_SUPPORT_GPU
virtual bool asNewEffect(GrEffectRef** effect,
@ -91,20 +91,20 @@ private:
void filterPixels(const SkBitmap& src,
SkBitmap* result,
const SkIRect& rect,
const SkIRect& bounds);
const SkIRect& bounds) const;
template <class PixelFetcher>
void filterPixels(const SkBitmap& src,
SkBitmap* result,
const SkIRect& rect,
const SkIRect& bounds);
const SkIRect& bounds) const;
void filterInteriorPixels(const SkBitmap& src,
SkBitmap* result,
const SkIRect& rect,
const SkIRect& bounds);
const SkIRect& bounds) const;
void filterBorderPixels(const SkBitmap& src,
SkBitmap* result,
const SkIRect& rect,
const SkIRect& bounds);
const SkIRect& bounds) const;
};
#endif

View File

@ -29,7 +29,7 @@ protected:
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* loc) SK_OVERRIDE;
SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
private:
uint8_t* fModes; // SkXfermode::Mode

View File

@ -32,14 +32,14 @@ public:
protected:
bool filterImageGeneric(Proc procX, Proc procY,
Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset);
SkBitmap* result, SkIPoint* offset) const;
SkMorphologyImageFilter(SkReadBuffer& buffer);
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
#if SK_SUPPORT_GPU
virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; }
bool filterImageGPUGeneric(bool dilate, Proxy* proxy, const SkBitmap& src,
const SkMatrix& ctm, SkBitmap* result,
SkIPoint* offset);
SkIPoint* offset) const;
#endif
SkISize radius() const { return fRadius; }
@ -57,10 +57,10 @@ public:
: INHERITED(radiusX, radiusY, input, cropRect) {}
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
#if SK_SUPPORT_GPU
virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
#endif
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDilateImageFilter)
@ -80,10 +80,10 @@ public:
: INHERITED(radiusX, radiusY, input, cropRect) {}
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
#if SK_SUPPORT_GPU
virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
#endif
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter)

View File

@ -25,7 +25,7 @@ protected:
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* loc) SK_OVERRIDE;
SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) const SK_OVERRIDE;
private:

View File

@ -31,7 +31,7 @@ protected:
explicit SkPictureImageFilter(SkReadBuffer& buffer);
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
private:
SkPicture* fPicture;

View File

@ -38,7 +38,7 @@ protected:
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* loc) SK_OVERRIDE;
SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
private:
SkRectShaderImageFilter(SkShader* s, const CropRect* rect);

View File

@ -40,7 +40,7 @@ protected:
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* loc) SK_OVERRIDE;
SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
private:
SkScalar fSx, fSy;

View File

@ -16,7 +16,7 @@ protected:
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* loc) SK_OVERRIDE;
SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
private:
SkScalar fScale;

View File

@ -23,7 +23,7 @@ public:
: INHERITED(input), fSrcRect(srcRect), fDstRect(dstRect) {}
virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
SkBitmap* dst, SkIPoint* offset) SK_OVERRIDE;
SkBitmap* dst, SkIPoint* offset) const SK_OVERRIDE;
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTileImageFilter)

View File

@ -32,11 +32,11 @@ public:
const SkBitmap& src,
const SkMatrix& ctm,
SkBitmap* dst,
SkIPoint* offset) SK_OVERRIDE;
SkIPoint* offset) const SK_OVERRIDE;
#if SK_SUPPORT_GPU
virtual bool canFilterImageGPU() const SK_OVERRIDE { return !cropRectIsSet(); }
virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
#endif
protected:

View File

@ -131,8 +131,8 @@ public:
*/
virtual void makeRenderTargetCurrent();
virtual bool canHandleImageFilter(SkImageFilter*) SK_OVERRIDE;
virtual bool filterImage(SkImageFilter*, const SkBitmap&, const SkMatrix&,
virtual bool canHandleImageFilter(const SkImageFilter*) SK_OVERRIDE;
virtual bool filterImage(const SkImageFilter*, const SkBitmap&, const SkMatrix&,
SkBitmap*, SkIPoint*) SK_OVERRIDE;
class SkAutoCachedTexture; // used internally

View File

@ -213,7 +213,7 @@ protected:
virtual bool onReadPixels(const SkBitmap& bitmap, int x, int y,
SkCanvas::Config8888) SK_OVERRIDE;
virtual bool allowImageFilter(SkImageFilter*) SK_OVERRIDE;
virtual bool allowImageFilter(const SkImageFilter*) SK_OVERRIDE;
private:
// TODO(vandebo): push most of SkPDFDevice's state into a core object in

View File

@ -95,17 +95,17 @@ const SkBitmap& SkBitmapDevice::onAccessBitmap() {
return fBitmap;
}
bool SkBitmapDevice::canHandleImageFilter(SkImageFilter*) {
bool SkBitmapDevice::canHandleImageFilter(const SkImageFilter*) {
return false;
}
bool SkBitmapDevice::filterImage(SkImageFilter* filter, const SkBitmap& src,
bool SkBitmapDevice::filterImage(const SkImageFilter* filter, const SkBitmap& src,
const SkMatrix& ctm, SkBitmap* result,
SkIPoint* offset) {
return false;
}
bool SkBitmapDevice::allowImageFilter(SkImageFilter*) {
bool SkBitmapDevice::allowImageFilter(const SkImageFilter*) {
return true;
}

View File

@ -18,10 +18,10 @@ public:
return fDevice->createCompatibleDevice(SkBitmap::kARGB_8888_Config,
w, h, false);
}
virtual bool canHandleImageFilter(SkImageFilter* filter) SK_OVERRIDE {
virtual bool canHandleImageFilter(const SkImageFilter* filter) SK_OVERRIDE {
return fDevice->canHandleImageFilter(filter);
}
virtual bool filterImage(SkImageFilter* filter, const SkBitmap& src,
virtual bool filterImage(const SkImageFilter* filter, const SkBitmap& src,
const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE {
return fDevice->filterImage(filter, src, ctm, result, offset);

View File

@ -94,7 +94,7 @@ void SkImageFilter::flatten(SkWriteBuffer& buffer) const {
bool SkImageFilter::filterImage(Proxy* proxy, const SkBitmap& src,
const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset) {
SkBitmap* result, SkIPoint* offset) const {
SkASSERT(result);
SkASSERT(offset);
/*
@ -135,7 +135,7 @@ void SkImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const {
}
bool SkImageFilter::onFilterImage(Proxy*, const SkBitmap&, const SkMatrix&,
SkBitmap*, SkIPoint*) {
SkBitmap*, SkIPoint*) const {
return false;
}
@ -144,7 +144,7 @@ bool SkImageFilter::canFilterImageGPU() const {
}
bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset) {
SkBitmap* result, SkIPoint* offset) const {
#if SK_SUPPORT_GPU
SkBitmap input;
SkASSERT(fInputCount == 1);

View File

@ -21,7 +21,7 @@ bool SkImageFilterUtils::WrapTexture(GrTexture* texture, int width, int height,
return true;
}
bool SkImageFilterUtils::GetInputResultGPU(SkImageFilter* filter, SkImageFilter::Proxy* proxy,
bool SkImageFilterUtils::GetInputResultGPU(const SkImageFilter* filter, SkImageFilter::Proxy* proxy,
const SkBitmap& src, const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset) {
// Ensure that GrContext calls under filterImage and filterImageGPU below will see an identity

View File

@ -22,7 +22,7 @@ protected:
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
#if SK_SUPPORT_GPU
virtual bool asNewEffect(GrEffectRef** effect, GrTexture* texture,
const SkMatrix& matrix, const SkIRect& bounds) const SK_OVERRIDE;
@ -305,7 +305,7 @@ void SkAlphaThresholdFilterImpl::flatten(SkWriteBuffer& buffer) const {
bool SkAlphaThresholdFilterImpl::onFilterImage(Proxy*, const SkBitmap& src,
const SkMatrix& matrix, SkBitmap* dst,
SkIPoint* offset) {
SkIPoint* offset) const {
SkASSERT(src.config() == SkBitmap::kARGB_8888_Config);
if (src.config() != SkBitmap::kARGB_8888_Config) {

View File

@ -85,7 +85,7 @@ bool SkBicubicImageFilter::onFilterImage(Proxy* proxy,
const SkBitmap& source,
const SkMatrix& matrix,
SkBitmap* result,
SkIPoint* offset) {
SkIPoint* offset) const {
SkBitmap src = source;
SkIPoint srcOffset = SkIPoint::Make(0, 0);
if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, &srcOffset)) {
@ -170,7 +170,7 @@ bool SkBicubicImageFilter::onFilterImage(Proxy* proxy,
#if SK_SUPPORT_GPU
bool SkBicubicImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset) {
SkBitmap* result, SkIPoint* offset) const {
SkBitmap srcBM;
if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &srcBM, offset)) {
return false;

View File

@ -43,7 +43,7 @@ void SkBitmapSource::flatten(SkWriteBuffer& buffer) const {
}
bool SkBitmapSource::onFilterImage(Proxy* proxy, const SkBitmap&, const SkMatrix& matrix,
SkBitmap* result, SkIPoint* offset) {
SkBitmap* result, SkIPoint* offset) const {
SkRect bounds, dstRect;
fBitmap.getBounds(&bounds);
matrix.mapRect(&dstRect, fDstRect);

View File

@ -136,7 +136,7 @@ static void getBox3Params(SkScalar s, int *kernelSize, int* kernelSize3, int *lo
bool SkBlurImageFilter::onFilterImage(Proxy* proxy,
const SkBitmap& source, const SkMatrix& ctm,
SkBitmap* dst, SkIPoint* offset) {
SkBitmap* dst, SkIPoint* offset) const {
SkBitmap src = source;
SkIPoint srcOffset = SkIPoint::Make(0, 0);
if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctm, &src, &srcOffset)) {
@ -252,7 +252,7 @@ bool SkBlurImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
}
bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset) {
SkBitmap* result, SkIPoint* offset) const {
#if SK_SUPPORT_GPU
SkBitmap input;
SkIPoint srcOffset = SkIPoint::Make(0, 0);

View File

@ -101,7 +101,7 @@ SkColorFilterImageFilter::~SkColorFilterImageFilter() {
bool SkColorFilterImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& source,
const SkMatrix& matrix,
SkBitmap* result,
SkIPoint* offset) {
SkIPoint* offset) const {
SkBitmap src = source;
SkIPoint srcOffset = SkIPoint::Make(0, 0);
if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, &srcOffset)) {

View File

@ -17,7 +17,7 @@ bool SkComposeImageFilter::onFilterImage(Proxy* proxy,
const SkBitmap& src,
const SkMatrix& ctm,
SkBitmap* result,
SkIPoint* offset) {
SkIPoint* offset) const {
SkImageFilter* outer = getInput(0);
SkImageFilter* inner = getInput(1);

View File

@ -195,10 +195,10 @@ bool SkDisplacementMapEffect::onFilterImage(Proxy* proxy,
const SkBitmap& src,
const SkMatrix& ctm,
SkBitmap* dst,
SkIPoint* offset) {
SkIPoint* offset) const {
SkBitmap displ = src, color = src;
SkImageFilter* colorInput = getColorInput();
SkImageFilter* displInput = getDisplacementInput();
const SkImageFilter* colorInput = getColorInput();
const SkImageFilter* displInput = getDisplacementInput();
SkIPoint colorOffset = SkIPoint::Make(0, 0), displOffset = SkIPoint::Make(0, 0);
if ((colorInput && !colorInput->filterImage(proxy, src, ctm, &color, &colorOffset)) ||
(displInput && !displInput->filterImage(proxy, src, ctm, &displ, &displOffset))) {
@ -348,7 +348,7 @@ private:
};
bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset) {
SkBitmap* result, SkIPoint* offset) const {
SkBitmap colorBM;
SkIPoint colorOffset = SkIPoint::Make(0, 0);
if (!SkImageFilterUtils::GetInputResultGPU(getColorInput(), proxy, src, ctm, &colorBM,

View File

@ -58,7 +58,7 @@ void SkDropShadowImageFilter::flatten(SkWriteBuffer& buffer) const
buffer.writeColor(fColor);
}
bool SkDropShadowImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& source, const SkMatrix& matrix, SkBitmap* result, SkIPoint* offset)
bool SkDropShadowImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& source, const SkMatrix& matrix, SkBitmap* result, SkIPoint* offset) const
{
SkBitmap src = source;
SkIPoint srcOffset = SkIPoint::Make(0, 0);

View File

@ -272,7 +272,7 @@ protected:
explicit SkDiffuseLightingImageFilter(SkReadBuffer& buffer);
virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE;
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
#if SK_SUPPORT_GPU
virtual bool asNewEffect(GrEffectRef** effect, GrTexture*, const SkMatrix& matrix, const SkIRect& bounds) const SK_OVERRIDE;
#endif
@ -294,7 +294,7 @@ protected:
explicit SkSpecularLightingImageFilter(SkReadBuffer& buffer);
virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE;
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
#if SK_SUPPORT_GPU
virtual bool asNewEffect(GrEffectRef** effect, GrTexture*, const SkMatrix& matrix, const SkIRect& bounds) const SK_OVERRIDE;
#endif
@ -925,7 +925,7 @@ bool SkDiffuseLightingImageFilter::onFilterImage(Proxy* proxy,
const SkBitmap& source,
const SkMatrix& ctm,
SkBitmap* dst,
SkIPoint* offset) {
SkIPoint* offset) const {
SkImageFilter* input = getInput(0);
SkBitmap src = source;
SkIPoint srcOffset = SkIPoint::Make(0, 0);
@ -1018,7 +1018,7 @@ bool SkSpecularLightingImageFilter::onFilterImage(Proxy* proxy,
const SkBitmap& source,
const SkMatrix& ctm,
SkBitmap* dst,
SkIPoint* offset) {
SkIPoint* offset) const {
SkImageFilter* input = getInput(0);
SkBitmap src = source;
SkIPoint srcOffset = SkIPoint::Make(0, 0);

View File

@ -281,7 +281,7 @@ void SkMagnifierImageFilter::flatten(SkWriteBuffer& buffer) const {
bool SkMagnifierImageFilter::onFilterImage(Proxy*, const SkBitmap& src,
const SkMatrix&, SkBitmap* dst,
SkIPoint* offset) {
SkIPoint* offset) const {
SkASSERT(src.config() == SkBitmap::kARGB_8888_Config);
SkASSERT(fSrcRect.width() < src.width());
SkASSERT(fSrcRect.height() < src.height());

View File

@ -152,7 +152,7 @@ template<class PixelFetcher, bool convolveAlpha>
void SkMatrixConvolutionImageFilter::filterPixels(const SkBitmap& src,
SkBitmap* result,
const SkIRect& rect,
const SkIRect& bounds) {
const SkIRect& bounds) const {
for (int y = rect.fTop; y < rect.fBottom; ++y) {
SkPMColor* dptr = result->getAddr32(rect.fLeft - bounds.fLeft, y - bounds.fTop);
for (int x = rect.fLeft; x < rect.fRight; ++x) {
@ -192,7 +192,7 @@ template<class PixelFetcher>
void SkMatrixConvolutionImageFilter::filterPixels(const SkBitmap& src,
SkBitmap* result,
const SkIRect& rect,
const SkIRect& bounds) {
const SkIRect& bounds) const {
if (fConvolveAlpha) {
filterPixels<PixelFetcher, true>(src, result, rect, bounds);
} else {
@ -203,14 +203,14 @@ void SkMatrixConvolutionImageFilter::filterPixels(const SkBitmap& src,
void SkMatrixConvolutionImageFilter::filterInteriorPixels(const SkBitmap& src,
SkBitmap* result,
const SkIRect& rect,
const SkIRect& bounds) {
const SkIRect& bounds) const {
filterPixels<UncheckedPixelFetcher>(src, result, rect, bounds);
}
void SkMatrixConvolutionImageFilter::filterBorderPixels(const SkBitmap& src,
SkBitmap* result,
const SkIRect& rect,
const SkIRect& bounds) {
const SkIRect& bounds) const {
switch (fTileMode) {
case kClamp_TileMode:
filterPixels<ClampPixelFetcher>(src, result, rect, bounds);
@ -253,7 +253,7 @@ bool SkMatrixConvolutionImageFilter::onFilterImage(Proxy* proxy,
const SkBitmap& source,
const SkMatrix& matrix,
SkBitmap* result,
SkIPoint* offset) {
SkIPoint* offset) const {
SkBitmap src = source;
SkIPoint srcOffset = SkIPoint::Make(0, 0);
if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, &srcOffset)) {

View File

@ -67,7 +67,7 @@ SkMergeImageFilter::~SkMergeImageFilter() {
bool SkMergeImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset) {
SkBitmap* result, SkIPoint* offset) const {
if (countInputs() < 1) {
return false;
}

View File

@ -143,7 +143,7 @@ bool SkMorphologyImageFilter::filterImageGeneric(SkMorphologyImageFilter::Proc p
const SkBitmap& source,
const SkMatrix& ctm,
SkBitmap* dst,
SkIPoint* offset) {
SkIPoint* offset) const {
SkBitmap src = source;
SkIPoint srcOffset = SkIPoint::Make(0, 0);
if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctm, &src, &srcOffset)) {
@ -214,7 +214,7 @@ bool SkMorphologyImageFilter::filterImageGeneric(SkMorphologyImageFilter::Proc p
bool SkErodeImageFilter::onFilterImage(Proxy* proxy,
const SkBitmap& source, const SkMatrix& ctm,
SkBitmap* dst, SkIPoint* offset) {
SkBitmap* dst, SkIPoint* offset) const {
Proc erodeXProc = SkMorphologyGetPlatformProc(kErodeX_SkMorphologyProcType);
if (!erodeXProc) {
erodeXProc = erode<kX>;
@ -228,7 +228,7 @@ bool SkErodeImageFilter::onFilterImage(Proxy* proxy,
bool SkDilateImageFilter::onFilterImage(Proxy* proxy,
const SkBitmap& source, const SkMatrix& ctm,
SkBitmap* dst, SkIPoint* offset) {
SkBitmap* dst, SkIPoint* offset) const {
Proc dilateXProc = SkMorphologyGetPlatformProc(kDilateX_SkMorphologyProcType);
if (!dilateXProc) {
dilateXProc = dilate<kX>;
@ -540,7 +540,7 @@ bool SkMorphologyImageFilter::filterImageGPUGeneric(bool dilate,
const SkBitmap& src,
const SkMatrix& ctm,
SkBitmap* result,
SkIPoint* offset) {
SkIPoint* offset) const {
SkBitmap input;
SkIPoint srcOffset = SkIPoint::Make(0, 0);
if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &input, &srcOffset)) {
@ -582,12 +582,12 @@ bool SkMorphologyImageFilter::filterImageGPUGeneric(bool dilate,
}
bool SkDilateImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset) {
SkBitmap* result, SkIPoint* offset) const {
return this->filterImageGPUGeneric(true, proxy, src, ctm, result, offset);
}
bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset) {
SkBitmap* result, SkIPoint* offset) const {
return this->filterImageGPUGeneric(false, proxy, src, ctm, result, offset);
}

View File

@ -17,7 +17,7 @@
bool SkOffsetImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& source,
const SkMatrix& matrix,
SkBitmap* result,
SkIPoint* offset) {
SkIPoint* offset) const {
SkImageFilter* input = getInput(0);
SkBitmap src = source;
SkIPoint srcOffset = SkIPoint::Make(0, 0);

View File

@ -45,7 +45,7 @@ void SkPictureImageFilter::flatten(SkWriteBuffer& buffer) const {
}
bool SkPictureImageFilter::onFilterImage(Proxy* proxy, const SkBitmap&, const SkMatrix& matrix,
SkBitmap* result, SkIPoint* offset) {
SkBitmap* result, SkIPoint* offset) const {
if (!fPicture) {
offset->fX = offset->fY = 0;
return true;

View File

@ -54,7 +54,7 @@ bool SkRectShaderImageFilter::onFilterImage(Proxy* proxy,
const SkBitmap& source,
const SkMatrix& ctm,
SkBitmap* result,
SkIPoint* offset) {
SkIPoint* offset) const {
SkIRect bounds;
source.getBounds(&bounds);
if (!this->applyCropRect(&bounds, ctm)) {

View File

@ -44,7 +44,7 @@ bool SkResizeImageFilter::onFilterImage(Proxy* proxy,
const SkBitmap& source,
const SkMatrix& matrix,
SkBitmap* result,
SkIPoint* offset) {
SkIPoint* offset) const {
SkBitmap src = source;
SkIPoint srcOffset = SkIPoint::Make(0, 0);
if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, &srcOffset)) {

View File

@ -23,7 +23,7 @@ public:
bool SkDownSampleImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
const SkMatrix&,
SkBitmap* result, SkIPoint*) {
SkBitmap* result, SkIPoint*) const {
SkScalar scale = fScale;
if (scale > SK_Scalar1 || scale <= 0) {
return false;

View File

@ -17,7 +17,7 @@
#include "SkValidationUtils.h"
bool SkTileImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
SkBitmap* dst, SkIPoint* offset) {
SkBitmap* dst, SkIPoint* offset) const {
SkBitmap source = src;
SkImageFilter* input = getInput(0);
SkIPoint srcOffset = SkIPoint::Make(0, 0);

View File

@ -47,7 +47,7 @@ bool SkXfermodeImageFilter::onFilterImage(Proxy* proxy,
const SkBitmap& src,
const SkMatrix& ctm,
SkBitmap* dst,
SkIPoint* offset) {
SkIPoint* offset) const {
SkBitmap background = src, foreground = src;
SkImageFilter* backgroundInput = getInput(0);
SkImageFilter* foregroundInput = getInput(1);
@ -100,7 +100,7 @@ bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy,
const SkBitmap& src,
const SkMatrix& ctm,
SkBitmap* result,
SkIPoint* offset) {
SkIPoint* offset) const {
SkBitmap background;
SkIPoint backgroundOffset = SkIPoint::Make(0, 0);
if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &background,

View File

@ -1515,7 +1515,7 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap,
}
static bool filter_texture(SkBaseDevice* device, GrContext* context,
GrTexture* texture, SkImageFilter* filter,
GrTexture* texture, const SkImageFilter* filter,
int w, int h, const SkMatrix& ctm, SkBitmap* result,
SkIPoint* offset) {
SkASSERT(filter);
@ -1694,11 +1694,11 @@ void SkGpuDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,
fContext->drawRectToRect(grPaint, dstRect, srcRect);
}
bool SkGpuDevice::canHandleImageFilter(SkImageFilter* filter) {
bool SkGpuDevice::canHandleImageFilter(const SkImageFilter* filter) {
return filter->canFilterImageGPU();
}
bool SkGpuDevice::filterImage(SkImageFilter* filter, const SkBitmap& src,
bool SkGpuDevice::filterImage(const SkImageFilter* filter, const SkBitmap& src,
const SkMatrix& ctm,
SkBitmap* result, SkIPoint* offset) {
// want explicitly our impl, so guard against a subclass of us overriding it

View File

@ -2330,6 +2330,6 @@ bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y,
return false;
}
bool SkPDFDevice::allowImageFilter(SkImageFilter*) {
bool SkPDFDevice::allowImageFilter(const SkImageFilter*) {
return false;
}

View File

@ -299,9 +299,9 @@ protected:
}
virtual void lockPixels() SK_OVERRIDE { NothingToDo(); }
virtual void unlockPixels() SK_OVERRIDE { NothingToDo(); }
virtual bool allowImageFilter(SkImageFilter*) SK_OVERRIDE { return false; }
virtual bool canHandleImageFilter(SkImageFilter*) SK_OVERRIDE { return false; }
virtual bool filterImage(SkImageFilter*, const SkBitmap&, const SkMatrix&,
virtual bool allowImageFilter(const SkImageFilter*) SK_OVERRIDE { return false; }
virtual bool canHandleImageFilter(const SkImageFilter*) SK_OVERRIDE { return false; }
virtual bool filterImage(const SkImageFilter*, const SkBitmap&, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE {
return false;
}

View File

@ -75,9 +75,9 @@ public:
}
virtual void lockPixels() SK_OVERRIDE { nothing_to_do(); }
virtual void unlockPixels() SK_OVERRIDE { nothing_to_do(); }
virtual bool allowImageFilter(SkImageFilter*) SK_OVERRIDE { return false; }
virtual bool canHandleImageFilter(SkImageFilter*) SK_OVERRIDE { return false; }
virtual bool filterImage(SkImageFilter*, const SkBitmap&, const SkMatrix&,
virtual bool allowImageFilter(const SkImageFilter*) SK_OVERRIDE { return false; }
virtual bool canHandleImageFilter(const SkImageFilter*) SK_OVERRIDE { return false; }
virtual bool filterImage(const SkImageFilter*, const SkBitmap&, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE {
return false;
}