Remove SkResizeImageFilter.

Its functionality has been subsumed by SkMatrixImageFilter, and it's no longer
used in Blink.

BUG=skia:
R=bsalomon@google.com

Author: senorblanco@chromium.org

Review URL: https://codereview.chromium.org/222923005

git-svn-id: http://skia.googlecode.com/svn/trunk@14073 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2014-04-07 15:11:08 +00:00
parent 622eda7373
commit b554440543
5 changed files with 0 additions and 181 deletions

View File

@ -52,7 +52,6 @@
'<(skia_src_path)/effects/SkPixelXorXfermode.cpp',
'<(skia_src_path)/effects/SkPorterDuff.cpp',
'<(skia_src_path)/effects/SkRectShaderImageFilter.cpp',
'<(skia_src_path)/effects/SkResizeImageFilter.cpp',
'<(skia_src_path)/effects/SkStippleMaskFilter.cpp',
'<(skia_src_path)/effects/SkTableColorFilter.cpp',
'<(skia_src_path)/effects/SkTableMaskFilter.cpp',

View File

@ -1,63 +0,0 @@
/*
* Copyright 2013 The Android Open Source Project
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkResizeImageFilter_DEFINED
#define SkResizeImageFilter_DEFINED
#include "SkImageFilter.h"
#include "SkScalar.h"
#include "SkRect.h"
#include "SkPoint.h"
#include "SkPaint.h"
/*! \class SkResizeImageFilter
Resampling image filter. This filter draws its source image resampled using the given scale
values.
*/
class SK_API SkResizeImageFilter : public SkImageFilter {
public:
virtual ~SkResizeImageFilter();
/** Construct a (scaling-only) resampling image filter.
* @param sx The x scale parameter to apply when resizing.
* @param sy The y scale parameter to apply when resizing.
* @param filterLevel The quality of filtering to apply when scaling.
* @param input The input image filter. If NULL, the src bitmap
* passed to filterImage() is used instead.
*/
static SkResizeImageFilter* Create(SkScalar sx, SkScalar sy, SkPaint::FilterLevel filterLevel,
SkImageFilter* input = NULL) {
return SkNEW_ARGS(SkResizeImageFilter, (sx, sy, filterLevel, input));
}
virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE;
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkResizeImageFilter)
protected:
SkResizeImageFilter(SkReadBuffer& buffer);
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
SkIRect* dst) const SK_OVERRIDE;
#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
public:
#endif
SkResizeImageFilter(SkScalar sx, SkScalar sy, SkPaint::FilterLevel filterLevel,
SkImageFilter* input = NULL);
private:
SkScalar fSx, fSy;
SkPaint::FilterLevel fFilterLevel;
typedef SkImageFilter INHERITED;
};
#endif

View File

@ -1,113 +0,0 @@
/*
* Copyright 2013 The Android Open Source Project
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkResizeImageFilter.h"
#include "SkBitmap.h"
#include "SkCanvas.h"
#include "SkDevice.h"
#include "SkColorPriv.h"
#include "SkReadBuffer.h"
#include "SkWriteBuffer.h"
#include "SkMatrix.h"
#include "SkRect.h"
SkResizeImageFilter::SkResizeImageFilter(SkScalar sx, SkScalar sy, SkPaint::FilterLevel filterLevel,
SkImageFilter* input)
: INHERITED(input),
fSx(sx),
fSy(sy),
fFilterLevel(filterLevel) {
}
SkResizeImageFilter::SkResizeImageFilter(SkReadBuffer& buffer)
: INHERITED(1, buffer) {
fSx = buffer.readScalar();
fSy = buffer.readScalar();
fFilterLevel = static_cast<SkPaint::FilterLevel>(buffer.readInt());
}
void SkResizeImageFilter::flatten(SkWriteBuffer& buffer) const {
this->INHERITED::flatten(buffer);
buffer.writeScalar(fSx);
buffer.writeScalar(fSy);
buffer.writeInt(fFilterLevel);
}
SkResizeImageFilter::~SkResizeImageFilter() {
}
bool SkResizeImageFilter::onFilterImage(Proxy* proxy,
const SkBitmap& source,
const Context& ctx,
SkBitmap* result,
SkIPoint* offset) const {
SkBitmap src = source;
SkIPoint srcOffset = SkIPoint::Make(0, 0);
if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctx, &src, &srcOffset)) {
return false;
}
SkRect dstRect;
SkIRect srcBounds, dstBounds;
src.getBounds(&srcBounds);
srcBounds.offset(srcOffset);
SkRect srcRect = SkRect::Make(srcBounds);
SkMatrix matrix;
if (!ctx.ctm().invert(&matrix)) {
return false;
}
matrix.postScale(fSx, fSy);
matrix.postConcat(ctx.ctm());
matrix.mapRect(&dstRect, srcRect);
dstRect.roundOut(&dstBounds);
SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(dstBounds.width(), dstBounds.height()));
if (NULL == device.get()) {
return false;
}
SkCanvas canvas(device.get());
canvas.scale(fSx, fSy);
SkPaint paint;
paint.setXfermodeMode(SkXfermode::kSrc_Mode);
paint.setFilterLevel(fFilterLevel);
canvas.drawBitmap(src, 0, 0, &paint);
*result = device.get()->accessBitmap(false);
offset->fX = dstBounds.fLeft;
offset->fY = dstBounds.fTop;
return true;
}
void SkResizeImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const {
SkRect bounds = src;
if (getInput(0)) {
getInput(0)->computeFastBounds(src, &bounds);
}
dst->setXYWH(bounds.x(), bounds.y(), bounds.width() * fSx, bounds.height() * fSy);
}
bool SkResizeImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
SkIRect* dst) const {
SkMatrix matrix;
if (!ctm.invert(&matrix)) {
return false;
}
matrix.postScale(SkScalarInvert(fSx), SkScalarInvert(fSy));
matrix.postConcat(ctm);
SkRect floatBounds;
matrix.mapRect(&floatBounds, SkRect::Make(src));
SkIRect bounds;
floatBounds.roundOut(&bounds);
if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) {
return false;
}
*dst = bounds;
return true;
}

View File

@ -53,7 +53,6 @@
#include "SkPictureImageFilter.h"
#include "SkPixelXorXfermode.h"
#include "SkRectShaderImageFilter.h"
#include "SkResizeImageFilter.h"
#include "SkStippleMaskFilter.h"
#include "SkTableColorFilter.h"
#include "SkTestImageFilters.h"
@ -93,7 +92,6 @@ static void InitializeFlattenables(int*) {
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPictureImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPixelXorXfermode)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkRectShaderImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkResizeImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkStippleMaskFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSumPathEffect)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTileImageFilter)

View File

@ -53,7 +53,6 @@
#include "SkPictureImageFilter.h"
#include "SkPixelXorXfermode.h"
#include "SkRectShaderImageFilter.h"
#include "SkResizeImageFilter.h"
#include "SkStippleMaskFilter.h"
#include "SkTableColorFilter.h"
#include "SkTestImageFilters.h"
@ -93,7 +92,6 @@ static void InitializeFlattenables(int*) {
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPictureImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPixelXorXfermode)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkRectShaderImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkResizeImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkStippleMaskFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSumPathEffect)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTileImageFilter)