aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-07-12 08:40:05 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-12 13:19:35 +0000
commit6ee29658202a0bd8394df5daed8db30321c01cc9 (patch)
tree1efed95d65f841bbbe8006165f37d9f03a0c0972 /src/core
parent016eef47d78091bab7fbd6a445996f252e3283fc (diff)
remove unreachable perspective code for imageshader
CQ_INCLUDE_TRYBOTS=skia.primary:Test-Debian9-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Bug: skia: Change-Id: If9a7df3e1c387098b00bf1cc1a37c36c6d256ef1 Reviewed-on: https://skia-review.googlesource.com/22348 Commit-Queue: Florin Malita <fmalita@chromium.org> Reviewed-by: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkBitmapProcState.cpp4
-rw-r--r--src/core/SkBitmapProcState_matrix.h32
-rw-r--r--src/core/SkBitmapProcState_matrixProcs.cpp13
-rw-r--r--src/core/SkBitmapProcState_matrix_template.h22
-rw-r--r--src/core/SkMatrix.cpp51
-rw-r--r--src/core/SkPerspIter.h48
6 files changed, 6 insertions, 164 deletions
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp
index 87e3ad8d1c..4df0f58100 100644
--- a/src/core/SkBitmapProcState.cpp
+++ b/src/core/SkBitmapProcState.cpp
@@ -90,6 +90,8 @@ static bool valid_for_filtering(unsigned dimension) {
}
bool SkBitmapProcInfo::init(const SkMatrix& inv, const SkPaint& paint) {
+ SkASSERT(!inv.hasPerspective());
+
fPixmap.reset();
fInvMatrix = inv;
fFilterQuality = paint.getFilterQuality();
@@ -648,7 +650,7 @@ SkBitmapProcState::MatrixProc SkBitmapProcState::getMatrixProc() const {
scale/translate nofilter Y(4bytes) + N * X
affine/perspective nofilter N * (X Y)
scale/translate filter Y Y + N * (X X)
- affine/perspective filter N * (Y Y X X)
+ affine filter N * (Y Y X X)
*/
int SkBitmapProcState::maxCountForBufferSize(size_t bufferSize) const {
int32_t size = static_cast<int32_t>(bufferSize);
diff --git a/src/core/SkBitmapProcState_matrix.h b/src/core/SkBitmapProcState_matrix.h
index ea784c675c..02dba44eeb 100644
--- a/src/core/SkBitmapProcState_matrix.h
+++ b/src/core/SkBitmapProcState_matrix.h
@@ -10,7 +10,6 @@
#define SCALE_FILTER_NAME MAKENAME(_filter_scale)
#define AFFINE_FILTER_NAME MAKENAME(_filter_affine)
-#define PERSP_FILTER_NAME MAKENAME(_filter_persp)
#define PACK_FILTER_X_NAME MAKENAME(_pack_filter_x)
#define PACK_FILTER_Y_NAME MAKENAME(_pack_filter_y)
@@ -28,9 +27,6 @@ void SCALE_FILTER_NAME(const SkBitmapProcState& s,
uint32_t xy[], int count, int x, int y);
void AFFINE_FILTER_NAME(const SkBitmapProcState& s,
uint32_t xy[], int count, int x, int y);
-void PERSP_FILTER_NAME(const SkBitmapProcState& s,
- uint32_t* SK_RESTRICT xy, int count,
- int x, int y);
static inline uint32_t PACK_FILTER_Y_NAME(SkFixed f, unsigned max,
SkFixed one PREAMBLE_PARAM_Y) {
@@ -112,33 +108,6 @@ void AFFINE_FILTER_NAME(const SkBitmapProcState& s,
} while (--count != 0);
}
-void PERSP_FILTER_NAME(const SkBitmapProcState& s,
- uint32_t* SK_RESTRICT xy, int count,
- int x, int y) {
- SkASSERT(s.fInvType & SkMatrix::kPerspective_Mask);
-
- PREAMBLE(s);
- unsigned maxX = s.fPixmap.width() - 1;
- unsigned maxY = s.fPixmap.height() - 1;
- SkFixed oneX = s.fFilterOneX;
- SkFixed oneY = s.fFilterOneY;
-
- SkPerspIter iter(s.fInvMatrix,
- SkIntToScalar(x) + SK_ScalarHalf,
- SkIntToScalar(y) + SK_ScalarHalf, count);
-
- while ((count = iter.next()) != 0) {
- const SkFixed* SK_RESTRICT srcXY = iter.getXY();
- do {
- *xy++ = PACK_FILTER_Y_NAME(srcXY[1] - (oneY >> 1), maxY,
- oneY PREAMBLE_ARG_Y);
- *xy++ = PACK_FILTER_X_NAME(srcXY[0] - (oneX >> 1), maxX,
- oneX PREAMBLE_ARG_X);
- srcXY += 2;
- } while (--count != 0);
- }
-}
-
#undef MAKENAME
#undef TILEX_PROCF
#undef TILEY_PROCF
@@ -148,7 +117,6 @@ void PERSP_FILTER_NAME(const SkBitmapProcState& s,
#undef SCALE_FILTER_NAME
#undef AFFINE_FILTER_NAME
-#undef PERSP_FILTER_NAME
#undef PREAMBLE
#undef PREAMBLE_PARAM_X
diff --git a/src/core/SkBitmapProcState_matrixProcs.cpp b/src/core/SkBitmapProcState_matrixProcs.cpp
index 08753bed99..2860e4b250 100644
--- a/src/core/SkBitmapProcState_matrixProcs.cpp
+++ b/src/core/SkBitmapProcState_matrixProcs.cpp
@@ -14,7 +14,6 @@
*/
#include "SkBitmapProcState.h"
-#include "SkPerspIter.h"
#include "SkShader.h"
#include "SkUtils.h"
#include "SkUtilsArm.h"
@@ -89,8 +88,6 @@ static SkBitmapProcState::MatrixProc ClampX_ClampY_Procs[] = {
ClampX_ClampY_filter_scale,
ClampX_ClampY_nofilter_affine,
ClampX_ClampY_filter_affine,
- NoFilterProc_Persp<ClampTileProcs>,
- ClampX_ClampY_filter_persp
};
#define MAKENAME(suffix) RepeatX_RepeatY ## suffix
@@ -115,8 +112,6 @@ static SkBitmapProcState::MatrixProc RepeatX_RepeatY_Procs[] = {
RepeatX_RepeatY_filter_scale,
NoFilterProc_Affine<RepeatTileProcs>,
RepeatX_RepeatY_filter_affine,
- NoFilterProc_Persp<RepeatTileProcs>,
- RepeatX_RepeatY_filter_persp
};
#endif
@@ -146,8 +141,6 @@ static SkBitmapProcState::MatrixProc GeneralXY_Procs[] = {
GeneralXY_filter_scale,
NoFilterProc_Affine<GeneralTileProcs>,
GeneralXY_filter_affine,
- NoFilterProc_Persp<GeneralTileProcs>,
- GeneralXY_filter_persp
};
///////////////////////////////////////////////////////////////////////////////
@@ -449,6 +442,8 @@ static void mirrorx_nofilter_trans(const SkBitmapProcState& s,
///////////////////////////////////////////////////////////////////////////////
SkBitmapProcState::MatrixProc SkBitmapProcState::chooseMatrixProc(bool trivial_matrix) {
+ SkASSERT((fInvType & SkMatrix::kPerspective_Mask) == 0);
+
// test_int_tileprocs();
// check for our special case when there is no scale/affine/perspective
if (trivial_matrix && kNone_SkFilterQuality == fFilterQuality) {
@@ -467,9 +462,7 @@ SkBitmapProcState::MatrixProc SkBitmapProcState::chooseMatrixProc(bool trivial_m
if (fFilterQuality != kNone_SkFilterQuality) {
index = 1;
}
- if (fInvType & SkMatrix::kPerspective_Mask) {
- index += 4;
- } else if (fInvType & SkMatrix::kAffine_Mask) {
+ if (fInvType & SkMatrix::kAffine_Mask) {
index += 2;
}
diff --git a/src/core/SkBitmapProcState_matrix_template.h b/src/core/SkBitmapProcState_matrix_template.h
index c38610a077..772c8622c5 100644
--- a/src/core/SkBitmapProcState_matrix_template.h
+++ b/src/core/SkBitmapProcState_matrix_template.h
@@ -98,26 +98,4 @@ void NoFilterProc_Affine(const SkBitmapProcState& s, uint32_t xy[],
}
}
-template <typename TileProc>
-void NoFilterProc_Persp(const SkBitmapProcState& s, uint32_t* SK_RESTRICT xy,
- int count, int x, int y) {
- SkASSERT(s.fInvType & SkMatrix::kPerspective_Mask);
-
- int maxX = s.fPixmap.width() - 1;
- int maxY = s.fPixmap.height() - 1;
-
- SkPerspIter iter(s.fInvMatrix,
- SkIntToScalar(x) + SK_ScalarHalf,
- SkIntToScalar(y) + SK_ScalarHalf, count);
-
- while ((count = iter.next()) != 0) {
- const SkFixed* SK_RESTRICT srcXY = iter.getXY();
- while (--count >= 0) {
- *xy++ = (TileProc::Y(s, srcXY[1], maxY) << 16) |
- TileProc::X(s, srcXY[0], maxX);
- srcXY += 2;
- }
- }
-}
-
#endif
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
index 8517d87555..5feee12874 100644
--- a/src/core/SkMatrix.cpp
+++ b/src/core/SkMatrix.cpp
@@ -1268,57 +1268,6 @@ SkVector SkMatrix::fixedStepInX(SkScalar y) const {
///////////////////////////////////////////////////////////////////////////////
-#include "SkPerspIter.h"
-
-SkPerspIter::SkPerspIter(const SkMatrix& m, SkScalar x0, SkScalar y0, int count)
- : fMatrix(m), fSX(x0), fSY(y0), fCount(count) {
- SkPoint pt;
-
- SkMatrix::Persp_xy(m, x0, y0, &pt);
- fX = SkScalarToFixed(pt.fX);
- fY = SkScalarToFixed(pt.fY);
-}
-
-int SkPerspIter::next() {
- int n = fCount;
-
- if (0 == n) {
- return 0;
- }
- SkPoint pt;
- SkFixed x = fX;
- SkFixed y = fY;
- SkFixed dx, dy;
-
- if (n >= kCount) {
- n = kCount;
- fSX += SkIntToScalar(kCount);
- SkMatrix::Persp_xy(fMatrix, fSX, fSY, &pt);
- fX = SkScalarToFixed(pt.fX);
- fY = SkScalarToFixed(pt.fY);
- dx = (fX - x) >> kShift;
- dy = (fY - y) >> kShift;
- } else {
- fSX += SkIntToScalar(n);
- SkMatrix::Persp_xy(fMatrix, fSX, fSY, &pt);
- fX = SkScalarToFixed(pt.fX);
- fY = SkScalarToFixed(pt.fY);
- dx = (fX - x) / n;
- dy = (fY - y) / n;
- }
-
- SkFixed* p = fStorage;
- for (int i = 0; i < n; i++) {
- *p++ = x; x += dx;
- *p++ = y; y += dy;
- }
-
- fCount -= n;
- return n;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
static inline bool checkForZero(float x) {
return x*x == 0;
}
diff --git a/src/core/SkPerspIter.h b/src/core/SkPerspIter.h
deleted file mode 100644
index c0a9083bee..0000000000
--- a/src/core/SkPerspIter.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2006 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 SkPerspIter_DEFINED
-#define SkPerspIter_DEFINED
-
-#include "SkFixed.h"
-#include "SkMatrix.h"
-
-class SkPerspIter {
-public:
- /** Iterate a line through the matrix [x,y] ... [x+count-1, y].
- @param m The matrix we will be iterating a line through
- @param x The initial X coordinate to be mapped through the matrix
- @param y The initial Y coordinate to be mapped through the matrix
- @param count The number of points (x,y) (x+1,y) (x+2,y) ... we will eventually map
- */
- SkPerspIter(const SkMatrix& m, SkScalar x, SkScalar y, int count);
-
- /** Return the buffer of [x,y] fixed point values we will be filling.
- This always returns the same value, so it can be saved across calls to
- next().
- */
- const SkFixed* getXY() const { return fStorage; }
-
- /** Return the number of [x,y] pairs that have been filled in the getXY() buffer.
- When this returns 0, the iterator is finished.
- */
- int next();
-
-private:
- enum {
- kShift = 4,
- kCount = (1 << kShift)
- };
- const SkMatrix& fMatrix;
- SkFixed fStorage[kCount * 2];
- SkFixed fX, fY;
- SkScalar fSX, fSY;
- int fCount;
-};
-
-#endif