Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Unified Diff: src/core/SkBitmapFilter.cpp

Issue 845303005: remove dead code after HQ change (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove commented-out code Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkBitmapProcState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapFilter.cpp
diff --git a/src/core/SkBitmapFilter.cpp b/src/core/SkBitmapFilter.cpp
index fce4c1d5fbc2f1c9b913e89515bea1481c33e013..82494d9bbecc6b46432c2541f7d11e64e123e49c 100644
--- a/src/core/SkBitmapFilter.cpp
+++ b/src/core/SkBitmapFilter.cpp
@@ -22,86 +22,6 @@
// the image is rotated or has some other complex transformation applied.
// Scaled images will usually be rescaled directly before rasterization.
-namespace {
-
-template <typename Color, typename ColorPacker>
-void highQualityFilter(ColorPacker pack, const SkBitmapProcState& s, int x, int y, Color* SK_RESTRICT colors, int count) {
- const int maxX = s.fBitmap->width();
- const int maxY = s.fBitmap->height();
- SkAutoTMalloc<SkScalar> xWeights(maxX);
- const SkBitmapFilter* filter = s.getBitmapFilter();
-
- while (count-- > 0) {
- SkPoint srcPt;
- s.fInvProc(s.fInvMatrix, x + 0.5f,
- y + 0.5f, &srcPt);
- srcPt.fX -= SK_ScalarHalf;
- srcPt.fY -= SK_ScalarHalf;
-
- SkScalar weight = 0;
- SkScalar fr = 0, fg = 0, fb = 0, fa = 0;
-
- int y0 = SkClampMax(SkScalarCeilToInt(srcPt.fY - filter->width()), maxY);
- int y1 = SkClampMax(SkScalarFloorToInt(srcPt.fY + filter->width() + 1), maxY);
- int x0 = SkClampMax(SkScalarCeilToInt(srcPt.fX - filter->width()), maxX);
- int x1 = SkClampMax(SkScalarFloorToInt(srcPt.fX + filter->width()) + 1, maxX);
-
- for (int srcX = x0; srcX < x1 ; srcX++) {
- // Looking these up once instead of each loop is a ~15% speedup.
- xWeights[srcX - x0] = filter->lookupScalar((srcPt.fX - srcX));
- }
-
- for (int srcY = y0; srcY < y1; srcY++) {
- SkScalar yWeight = filter->lookupScalar((srcPt.fY - srcY));
-
- for (int srcX = x0; srcX < x1 ; srcX++) {
- SkScalar xWeight = xWeights[srcX - x0];
-
- SkScalar combined_weight = SkScalarMul(xWeight, yWeight);
- weight += combined_weight;
-
- SkPMColor c = *s.fBitmap->getAddr32(srcX, srcY);
- if (!c) {
- continue;
- }
- fr += combined_weight * SkGetPackedR32(c);
- fg += combined_weight * SkGetPackedG32(c);
- fb += combined_weight * SkGetPackedB32(c);
- fa += combined_weight * SkGetPackedA32(c);
- }
- }
-
- fr = SkScalarDiv(fr, weight);
- fg = SkScalarDiv(fg, weight);
- fb = SkScalarDiv(fb, weight);
- fa = SkScalarDiv(fa, weight);
-
- int a = SkClampMax(SkScalarRoundToInt(fa), 255);
- int r = SkClampMax(SkScalarRoundToInt(fr), a);
- int g = SkClampMax(SkScalarRoundToInt(fg), a);
- int b = SkClampMax(SkScalarRoundToInt(fb), a);
-
- *colors++ = pack(a, r, g, b);
-
- x++;
- }
-}
-
-uint16_t PackTo565(int /*a*/, int r, int g, int b) {
- return SkPack888ToRGB16(r, g, b);
-}
-
-} // namespace
-
-void highQualityFilter32(const SkBitmapProcState& s, int x, int y, SkPMColor* SK_RESTRICT colors, int count) {
- highQualityFilter(&SkPackARGB32, s, x, y, colors, count);
-}
-
-void highQualityFilter16(const SkBitmapProcState& s, int x, int y, uint16_t* SK_RESTRICT colors, int count) {
- highQualityFilter(&PackTo565, s, x, y, colors, count);
-}
-
-
SK_CONF_DECLARE(const char *, c_bitmapFilter, "bitmap.filter", "mitchell", "Which scanline bitmap filter to use [mitchell, lanczos, hamming, gaussian, triangle, box]");
SkBitmapFilter *SkBitmapFilter::Allocate() {
@@ -124,35 +44,3 @@ SkBitmapFilter *SkBitmapFilter::Allocate() {
return NULL;
}
-bool SkBitmapProcState::setBitmapFilterProcs() {
- if (fFilterLevel != SkPaint::kHigh_FilterLevel) {
- return false;
- }
-
- if (fAlphaScale != 256) {
- return false;
- }
-
- // TODO: consider supporting other colortypes (e.g. 565, A8)
- if (fBitmap->colorType() != kN32_SkColorType) {
- return false;
- }
-
- // TODO: consider supporting repeat and mirror
- if (SkShader::kClamp_TileMode != fTileModeX || SkShader::kClamp_TileMode != fTileModeY) {
- return false;
- }
-
- // TODO: is this right? do we want fBitmapFilter allocated even if we can't set shader procs?
- if (fInvType & (SkMatrix::kAffine_Mask | SkMatrix::kScale_Mask)) {
- fBitmapFilter = SkBitmapFilter::Allocate();
- }
-
- if (fInvType & SkMatrix::kScale_Mask) {
- fShaderProc32 = highQualityFilter32;
- fShaderProc16 = highQualityFilter16;
- return true;
- } else {
- return false;
- }
-}
« no previous file with comments | « no previous file | src/core/SkBitmapProcState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698