remove unused Kernel33MaskFilter

R=robertphillips@google.com
TBR=robertphilips@google.com

Author: reed@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@14691 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2014-05-12 13:35:55 +00:00
parent c51d6e459a
commit e003aecb30
11 changed files with 3 additions and 305 deletions

View File

@ -74,7 +74,6 @@
#include "SkImage.h"
#include "SkImageInfo.h"
#include "SkInstCnt.h"
#include "SkKernel33MaskFilter.h"
#include "SkLayerDrawLooper.h"
#include "SkLayerRasterizer.h"
#include "SkLerpXfermode.h"

View File

@ -35,7 +35,6 @@
'<(skia_src_path)/effects/SkEmbossMaskFilter.cpp',
'<(skia_src_path)/effects/SkGpuBlurUtils.h',
'<(skia_src_path)/effects/SkGpuBlurUtils.cpp',
'<(skia_src_path)/effects/SkKernel33MaskFilter.cpp',
'<(skia_src_path)/effects/SkLayerDrawLooper.cpp',
'<(skia_src_path)/effects/SkLayerRasterizer.cpp',
'<(skia_src_path)/effects/SkLerpXfermode.cpp',

View File

@ -83,7 +83,6 @@
'effects/SkBicubicImageFilter.h',
'effects/SkPorterDuff.h',
'effects/SkBlurImageFilter.h',
'effects/SkKernel33MaskFilter.h',
'effects/SkTableMaskFilter.h',
'effects/SkAvoidXfermode.h',
'effects/SkBitmapSource.h',

View File

@ -1,69 +0,0 @@
/*
* Copyright 2008 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 SkKernel33MaskFilter_DEFINED
#define SkKernel33MaskFilter_DEFINED
#include "SkMaskFilter.h"
class SK_API SkKernel33ProcMaskFilter : public SkMaskFilter {
public:
virtual uint8_t computeValue(uint8_t* const* srcRows) const = 0;
virtual SkMask::Format getFormat() const SK_OVERRIDE;
virtual bool filterMask(SkMask*, const SkMask&, const SkMatrix&,
SkIPoint*) const SK_OVERRIDE;
SK_TO_STRING_OVERRIDE()
protected:
SkKernel33ProcMaskFilter(unsigned percent256 = 256)
: fPercent256(percent256) {}
SkKernel33ProcMaskFilter(SkReadBuffer& rb);
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
private:
int fPercent256;
typedef SkMaskFilter INHERITED;
};
///////////////////////////////////////////////////////////////////////////////
class SK_API SkKernel33MaskFilter : public SkKernel33ProcMaskFilter {
public:
static SkKernel33MaskFilter* Create(const int coeff[3][3], int shift, int percent256 = 256) {
return SkNEW_ARGS(SkKernel33MaskFilter, (coeff, shift, percent256));
}
// override from SkKernel33ProcMaskFilter
virtual uint8_t computeValue(uint8_t* const* srcRows) const SK_OVERRIDE;
SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkKernel33MaskFilter)
protected:
#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
public:
#endif
SkKernel33MaskFilter(const int coeff[3][3], int shift, int percent256 = 256)
: SkKernel33ProcMaskFilter(percent256) {
memcpy(fKernel, coeff, 9 * sizeof(int));
fShift = shift;
}
private:
int fKernel[3][3];
int fShift;
SkKernel33MaskFilter(SkReadBuffer& rb);
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
typedef SkKernel33ProcMaskFilter INHERITED;
};
#endif

View File

@ -14,7 +14,6 @@
#include "SkGradientShader.h"
#include "SkGraphics.h"
#include "SkImageDecoder.h"
#include "SkKernel33MaskFilter.h"
#include "SkPath.h"
#include "SkRandom.h"
#include "SkRegion.h"

View File

@ -12,7 +12,6 @@
#include "SkGradientShader.h"
#include "SkGraphics.h"
#include "SkImageDecoder.h"
#include "SkKernel33MaskFilter.h"
#include "SkPath.h"
#include "SkRandom.h"
#include "SkRegion.h"

View File

@ -12,7 +12,6 @@
#include "SkGradientShader.h"
#include "SkGraphics.h"
#include "SkImageDecoder.h"
#include "SkKernel33MaskFilter.h"
#include "SkPath.h"
#include "SkRandom.h"
#include "SkRegion.h"

View File

@ -11,7 +11,6 @@
#include "SkGradientShader.h"
#include "SkGraphics.h"
#include "SkImageDecoder.h"
#include "SkKernel33MaskFilter.h"
#include "SkPath.h"
#include "SkRandom.h"
#include "SkRegion.h"

View File

@ -13,7 +13,6 @@
#include "SkGradientShader.h"
#include "SkGraphics.h"
#include "SkImageDecoder.h"
#include "SkKernel33MaskFilter.h"
#include "SkPath.h"
#include "SkRandom.h"
#include "SkRegion.h"
@ -28,77 +27,6 @@
#include "SkStream.h"
#include "SkXMLParser.h"
class ReduceNoise : public SkKernel33ProcMaskFilter {
public:
ReduceNoise(int percent256) : SkKernel33ProcMaskFilter(percent256) {}
virtual uint8_t computeValue(uint8_t* const* srcRows) const {
int c = srcRows[1][1];
int min = 255, max = 0;
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
if (i != 1 || j != 1)
{
int v = srcRows[i][j];
if (max < v)
max = v;
if (min > v)
min = v;
}
if (c > max) c = max;
// if (c < min) c = min;
return c;
}
#ifndef SK_IGNORE_TO_STRING
virtual void toString(SkString* str) const SK_OVERRIDE {
str->append("ReduceNoise: (");
this->INHERITED::toString(str);
str->append(")");
}
#endif
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(ReduceNoise)
private:
ReduceNoise(SkReadBuffer& rb) : SkKernel33ProcMaskFilter(rb) {}
typedef SkKernel33ProcMaskFilter INHERITED;
};
class Darken : public SkKernel33ProcMaskFilter {
public:
Darken(int percent256) : SkKernel33ProcMaskFilter(percent256) {}
virtual uint8_t computeValue(uint8_t* const* srcRows) const {
int c = srcRows[1][1];
float f = c / 255.f;
if (c >= 0) {
f = sqrtf(f);
} else {
f *= f;
}
SkASSERT(f >= 0 && f <= 1);
return (int)(f * 255);
}
#ifndef SK_IGNORE_TO_STRING
virtual void toString(SkString* str) const SK_OVERRIDE {
str->append("Darken: (");
this->INHERITED::toString(str);
str->append(")");
}
#endif
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Darken)
private:
Darken(SkReadBuffer& rb) : SkKernel33ProcMaskFilter(rb) {}
typedef SkKernel33ProcMaskFilter INHERITED;
};
static SkMaskFilter* makemf() { return new Darken(0x30); }
static void test_breakText() {
SkPaint paint;
const char* text = "sdfkljAKLDFJKEWkldfjlk#$%&sdfs.dsj";
@ -213,9 +141,8 @@ static const struct {
{ "Subpixel", SkPaint::kSubpixelText_Flag, true }
};
static void DrawTheText(SkCanvas* canvas, const char text[], size_t length,
SkScalar x, SkScalar y, const SkPaint& paint,
SkScalar clickX, SkMaskFilter* mf) {
static void DrawTheText(SkCanvas* canvas, const char text[], size_t length, SkScalar x, SkScalar y,
const SkPaint& paint, SkScalar clickX) {
SkPaint p(paint);
#if 0
@ -238,7 +165,6 @@ static void DrawTheText(SkCanvas* canvas, const char text[], size_t length,
#ifdef SK_DEBUG
if (true) {
// p.setMaskFilter(mf);
p.setSubpixelText(false);
p.setLinearText(true);
x += SkIntToScalar(180);
@ -250,18 +176,12 @@ static void DrawTheText(SkCanvas* canvas, const char text[], size_t length,
class TextSpeedView : public SampleView {
public:
TextSpeedView() {
fMF = makemf();
fHints = 0;
fClickX = 0;
test_breakText();
}
virtual ~TextSpeedView() {
SkSafeUnref(fMF);
}
protected:
// overrides from SkEventSink
virtual bool onQuery(SkEvent* evt) {
@ -326,8 +246,7 @@ protected:
for (SkScalar dx = 0; dx <= SkIntToScalar(3)/4;
dx += SkIntToScalar(1) /* /4 */) {
y += paint.getFontSpacing();
DrawTheText(canvas, text, length, SkIntToScalar(20) + dx, y,
paint, fClickX, fMF);
DrawTheText(canvas, text, length, SkIntToScalar(20) + dx, y, paint, fClickX);
}
}
if (gHints[index].fFlushCache) {
@ -349,7 +268,6 @@ protected:
private:
int fHints;
SkScalar fClickX;
SkMaskFilter* fMF;
typedef SampleView INHERITED;
};

View File

@ -13,7 +13,6 @@
#include "SkGradientShader.h"
#include "SkGraphics.h"
#include "SkImageDecoder.h"
#include "SkKernel33MaskFilter.h"
#include "SkPath.h"
#include "SkRandom.h"
#include "SkRegion.h"

View File

@ -1,143 +0,0 @@
/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkKernel33MaskFilter.h"
#include "SkColorPriv.h"
#include "SkReadBuffer.h"
#include "SkWriteBuffer.h"
#include "SkString.h"
SkMask::Format SkKernel33ProcMaskFilter::getFormat() const {
return SkMask::kA8_Format;
}
bool SkKernel33ProcMaskFilter::filterMask(SkMask* dst, const SkMask& src,
const SkMatrix&, SkIPoint* margin) const {
// margin???
dst->fImage = NULL;
dst->fBounds = src.fBounds;
dst->fBounds.inset(-1, -1);
dst->fFormat = SkMask::kA8_Format;
if (NULL == src.fImage) {
return true;
}
dst->fRowBytes = dst->fBounds.width();
size_t size = dst->computeImageSize();
if (0 == size) {
return false; // too big to allocate, abort
}
dst->fImage = SkMask::AllocImage(size);
const int h = src.fBounds.height();
const int w = src.fBounds.width();
const int srcRB = src.fRowBytes;
const uint8_t* srcImage = src.fImage;
uint8_t* dstImage = dst->fImage;
uint8_t* srcRows[3];
uint8_t storage[3][3];
srcRows[0] = storage[0];
srcRows[1] = storage[1];
srcRows[2] = storage[2];
unsigned scale = fPercent256;
for (int y = -1; y <= h; y++) {
uint8_t* dstRow = dstImage;
for (int x = -1; x <= w; x++) {
memset(storage, 0, sizeof(storage));
uint8_t* storagePtr = &storage[0][0];
for (int ky = y - 1; ky <= y + 1; ky++) {
const uint8_t* srcRow = srcImage + ky * srcRB; // may be out-of-range
for (int kx = x - 1; kx <= x + 1; kx++) {
if ((unsigned)ky < (unsigned)h && (unsigned)kx < (unsigned)w) {
*storagePtr = srcRow[kx];
}
storagePtr++;
}
}
int value = this->computeValue(srcRows);
if (scale < 256) {
value = SkAlphaBlend(value, srcRows[1][1], scale);
}
*dstRow++ = SkToU8(value);
}
dstImage += dst->fRowBytes;
}
return true;
}
void SkKernel33ProcMaskFilter::flatten(SkWriteBuffer& wb) const {
this->INHERITED::flatten(wb);
wb.writeInt(fPercent256);
}
SkKernel33ProcMaskFilter::SkKernel33ProcMaskFilter(SkReadBuffer& rb)
: SkMaskFilter(rb) {
fPercent256 = rb.readInt();
}
#ifndef SK_IGNORE_TO_STRING
void SkKernel33ProcMaskFilter::toString(SkString* str) const {
str->appendf("percent256: %d, ", fPercent256);
}
#endif
///////////////////////////////////////////////////////////////////////////////
uint8_t SkKernel33MaskFilter::computeValue(uint8_t* const* srcRows) const {
int value = 0;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
value += fKernel[i][j] * srcRows[i][j];
}
}
value >>= fShift;
if (value < 0) {
value = 0;
} else if (value > 255) {
value = 255;
}
return (uint8_t)value;
}
void SkKernel33MaskFilter::flatten(SkWriteBuffer& wb) const {
this->INHERITED::flatten(wb);
wb.writeIntArray(&fKernel[0][0], 9);
wb.writeInt(fShift);
}
SkKernel33MaskFilter::SkKernel33MaskFilter(SkReadBuffer& rb)
: SkKernel33ProcMaskFilter(rb) {
SkDEBUGCODE(bool success = )rb.readIntArray(&fKernel[0][0], 9);
SkASSERT(success);
fShift = rb.readInt();
}
#ifndef SK_IGNORE_TO_STRING
void SkKernel33MaskFilter::toString(SkString* str) const {
str->append("SkKernel33MaskFilter: (");
str->appendf("kernel: (%d, %d, %d, %d, %d, %d, %d, %d, %d), ",
fKernel[0][0], fKernel[0][1], fKernel[0][2],
fKernel[1][0], fKernel[1][1], fKernel[1][2],
fKernel[2][0], fKernel[2][1], fKernel[2][2]);
str->appendf("shift: %d, ", fShift);
this->INHERITED::toString(str);
str->append(")");
}
#endif