summaryrefslogtreecommitdiffstats
path: root/skia
diff options
context:
space:
mode:
authormal@chromium.org <mal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-15 05:12:24 +0000
committermal@chromium.org <mal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-15 05:12:24 +0000
commit91305c89fa92f52453190b5007377a1df03140df (patch)
treef602bc76a1a8d5019ed1ec86a09f39367feac8c3 /skia
parent9c25bc488d1e1ba7dd6576bcd4ef074cf10c21f5 (diff)
downloadchromium_src-91305c89fa92f52453190b5007377a1df03140df.zip
chromium_src-91305c89fa92f52453190b5007377a1df03140df.tar.gz
chromium_src-91305c89fa92f52453190b5007377a1df03140df.tar.bz2
Rollback Skia fix for Facebook sidebar: layout test failures.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9838 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r--skia/sgl/SkBitmapProcState.cpp5
-rw-r--r--skia/sgl/SkBitmapProcState.h5
-rw-r--r--skia/sgl/SkBitmapProcState_matrix.h42
-rw-r--r--skia/sgl/SkBitmapProcState_matrixProcs.cpp72
4 files changed, 14 insertions, 110 deletions
diff --git a/skia/sgl/SkBitmapProcState.cpp b/skia/sgl/SkBitmapProcState.cpp
index eb87e7b..428921d 100644
--- a/skia/sgl/SkBitmapProcState.cpp
+++ b/skia/sgl/SkBitmapProcState.cpp
@@ -296,9 +296,8 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) {
}
const SkMatrix* m;
- if (inv.getType() <= SkMatrix::kTranslate_Mask ||
- (SkShader::kClamp_TileMode == fTileModeX &&
- SkShader::kClamp_TileMode == fTileModeY)) {
+ if (SkShader::kClamp_TileMode == fTileModeX &&
+ SkShader::kClamp_TileMode == fTileModeY) {
m = &inv;
} else {
fUnitInvMatrix = inv;
diff --git a/skia/sgl/SkBitmapProcState.h b/skia/sgl/SkBitmapProcState.h
index fabc0e5..1366d3b 100644
--- a/skia/sgl/SkBitmapProcState.h
+++ b/skia/sgl/SkBitmapProcState.h
@@ -39,8 +39,7 @@ struct SkBitmapProcState {
int count,
uint16_t colors[]);
- typedef SkFixed (*FixedTileProc)(SkFixed, int);
- typedef int (*IntTileProc)(int, int);
+ typedef U16CPU (*FixedTileProc)(SkFixed); // returns 0..0xFFFF
MatrixProc fMatrixProc; // chooseProcs
SampleProc32 fSampleProc32; // chooseProcs
@@ -49,8 +48,6 @@ struct SkBitmapProcState {
SkMatrix fUnitInvMatrix; // chooseProcs
FixedTileProc fTileProcX; // chooseProcs
FixedTileProc fTileProcY; // chooseProcs
- IntTileProc iTileProcX; // chooseProcs
- IntTileProc iTileProcY; // chooseProcs
SkFixed fFilterOneX;
SkFixed fFilterOneY;
diff --git a/skia/sgl/SkBitmapProcState_matrix.h b/skia/sgl/SkBitmapProcState_matrix.h
index 80d3e97..1212a41 100644
--- a/skia/sgl/SkBitmapProcState_matrix.h
+++ b/skia/sgl/SkBitmapProcState_matrix.h
@@ -1,5 +1,4 @@
-#define TRANSLATE_NOFILTER_NAME MAKENAME(_nofilter_translate)
#define SCALE_NOFILTER_NAME MAKENAME(_nofilter_scale)
#define SCALE_FILTER_NAME MAKENAME(_filter_scale)
#define AFFINE_NOFILTER_NAME MAKENAME(_nofilter_affine)
@@ -18,38 +17,6 @@
#define PREAMBLE_ARG_Y
#endif
-#ifndef PREAMBLE_TRANS
- #define PREAMBLE_TRANS(state)
-#endif
-
-static void TRANSLATE_NOFILTER_NAME(const SkBitmapProcState& s,
- uint32_t xy[], int count, int x, int y)
-{
- SkASSERT((s.fInvType & ~SkMatrix::kTranslate_Mask) == 0);
-
- PREAMBLE_TRANS(s);
-
- x += SkScalarFloor(s.fInvMatrix->getTranslateX());
- y += SkScalarFloor(s.fInvMatrix->getTranslateY());
-
- *xy++ = (uint32_t)TILEY_TRANS(y, (s.fBitmap->height() - 1));
-
- unsigned maxX = s.fBitmap->width() - 1;
- int i;
- uint16_t* xx = (uint16_t*)xy;
- for (i = (count >> 2); i > 0; --i)
- {
- *xx++ = (uint16_t)TILEX_TRANS(x, maxX); x++;
- *xx++ = (uint16_t)TILEX_TRANS(x, maxX); x++;
- *xx++ = (uint16_t)TILEX_TRANS(x, maxX); x++;
- *xx++ = (uint16_t)TILEX_TRANS(x, maxX); x++;
- }
- for (i = (count & 3); i > 0; --i)
- {
- *xx++ = (uint16_t)TILEX_TRANS(x, maxX); x++;
- }
-}
-
static void SCALE_NOFILTER_NAME(const SkBitmapProcState& s,
uint32_t xy[], int count, int x, int y) {
SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
@@ -274,9 +241,6 @@ static void PERSP_FILTER_NAME(const SkBitmapProcState& s,
}
static SkBitmapProcState::MatrixProc MAKENAME(_Procs)[] = {
- TRANSLATE_NOFILTER_NAME,
- TRANSLATE_NOFILTER_NAME, // No need to do filtering if the matrix is no
- // more complex than identity/translate.
SCALE_NOFILTER_NAME,
SCALE_FILTER_NAME,
AFFINE_NOFILTER_NAME,
@@ -292,10 +256,6 @@ static SkBitmapProcState::MatrixProc MAKENAME(_Procs)[] = {
#undef CHECK_FOR_DECAL
#endif
-#undef TILEX_TRANS
-#undef TILEY_TRANS
-
-#undef TRANSLATE_NOFILTER_NAME
#undef SCALE_NOFILTER_NAME
#undef SCALE_FILTER_NAME
#undef AFFINE_NOFILTER_NAME
@@ -309,7 +269,5 @@ static SkBitmapProcState::MatrixProc MAKENAME(_Procs)[] = {
#undef PREAMBLE_ARG_X
#undef PREAMBLE_ARG_Y
-#undef PREAMBLE_TRANS
-
#undef TILEX_LOW_BITS
#undef TILEY_LOW_BITS
diff --git a/skia/sgl/SkBitmapProcState_matrixProcs.cpp b/skia/sgl/SkBitmapProcState_matrixProcs.cpp
index a16c8b3..beb21c8 100644
--- a/skia/sgl/SkBitmapProcState_matrixProcs.cpp
+++ b/skia/sgl/SkBitmapProcState_matrixProcs.cpp
@@ -28,8 +28,6 @@ void decal_filter_scale(uint32_t dst[], SkFixed fx, SkFixed dx, int count);
#define TILEX_LOW_BITS(fx, max) (((fx) >> 12) & 0xF)
#define TILEY_LOW_BITS(fy, max) (((fy) >> 12) & 0xF)
#define CHECK_FOR_DECAL
-#define TILEX_TRANS(x, max) SkClampMax(x, max)
-#define TILEY_TRANS(y, max) SkClampMax(y, max)
#include "SkBitmapProcState_matrix.h"
#define MAKENAME(suffix) RepeatX_RepeatY ## suffix
@@ -37,8 +35,6 @@ void decal_filter_scale(uint32_t dst[], SkFixed fx, SkFixed dx, int count);
#define TILEY_PROCF(fy, max) (((fy) & 0xFFFF) * ((max) + 1) >> 16)
#define TILEX_LOW_BITS(fx, max) ((((fx) & 0xFFFF) * ((max) + 1) >> 12) & 0xF)
#define TILEY_LOW_BITS(fy, max) ((((fy) & 0xFFFF) * ((max) + 1) >> 12) & 0xF)
-#define TILEX_TRANS(x, max) ((x) % ((max) + 1))
-#define TILEY_TRANS(y, max) ((y) % ((max) + 1))
#include "SkBitmapProcState_matrix.h"
#define MAKENAME(suffix) GeneralXY ## suffix
@@ -48,19 +44,13 @@ void decal_filter_scale(uint32_t dst[], SkFixed fx, SkFixed dx, int count);
#define PREAMBLE_PARAM_Y , SkBitmapProcState::FixedTileProc tileProcY
#define PREAMBLE_ARG_X , tileProcX
#define PREAMBLE_ARG_Y , tileProcY
-#define TILEX_PROCF(fx, max) (tileProcX(fx, max) >> 16)
-#define TILEY_PROCF(fy, max) (tileProcY(fy, max) >> 16)
-#define TILEX_LOW_BITS(fx, max) ((tileProcX(fx, max) >> 14) & 0x3)
-#define TILEY_LOW_BITS(fy, max) ((tileProcY(fy, max) >> 14) & 0x3)
-#define PREAMBLE_TRANS(state) SkBitmapProcState::IntTileProc tileProcX = (state).iTileProcX; \
- SkBitmapProcState::IntTileProc tileProcY = (state).iTileProcY
-#define TILEX_TRANS(x, max) tileProcX(x, max)
-#define TILEY_TRANS(y, max) tileProcY(y, max)
+#define TILEX_PROCF(fx, max) (tileProcX(fx) * ((max) + 1) >> 16)
+#define TILEY_PROCF(fy, max) (tileProcY(fy) * ((max) + 1) >> 16)
+#define TILEX_LOW_BITS(fx, max) ((tileProcX(fx) * ((max) + 1) >> 12) & 0xF)
+#define TILEY_LOW_BITS(fy, max) ((tileProcY(fy) * ((max) + 1) >> 12) & 0xF)
#include "SkBitmapProcState_matrix.h"
-
-
-static inline SkFixed fixed_clamp(SkFixed x, int max)
+static inline U16CPU fixed_clamp(SkFixed x)
{
#ifdef SK_CPU_HAS_CONDITIONAL_INSTR
if (x >> 16)
@@ -76,20 +66,19 @@ static inline SkFixed fixed_clamp(SkFixed x, int max)
x = 0xFFFF;
}
#endif
- return x * (max + 1);
+ return x;
}
-static inline SkFixed fixed_repeat(SkFixed x, int max)
+static inline U16CPU fixed_repeat(SkFixed x)
{
- return (x & 0xFFFF) * (max + 1);
+ return x & 0xFFFF;
}
-static inline SkFixed fixed_mirror(SkFixed x, int max)
+static inline U16CPU fixed_mirror(SkFixed x)
{
SkFixed s = x << 15 >> 31;
// s is FFFFFFFF if we're on an odd interval, or 0 if an even interval
- x = ((x ^ s) & 0xFFFF) * (max + 1);
- return s ? (x ^ 0xFFFF) : x;
+ return (x ^ s) & 0xFFFF;
}
static SkBitmapProcState::FixedTileProc choose_tile_proc(unsigned m)
@@ -102,51 +91,14 @@ static SkBitmapProcState::FixedTileProc choose_tile_proc(unsigned m)
return fixed_mirror;
}
-static inline int int_clamp(int x, int max)
-{
- SkASSERT(max >= 0);
-
- return SkClampMax(x, max);
-}
-
-static inline int int_repeat(int x, int max)
-{
- SkASSERT(max >= 0);
-
- return x % (max + 1);
-}
-
-static inline int int_mirror(int x, int max)
-{
- SkASSERT(max >= 0);
-
- int dx = x % (max + 1);
- if (dx < 0)
- dx = -dx - 1;
-
- return (x / (max + 1) % 2) ? max - dx : dx;
-}
-
-static SkBitmapProcState::IntTileProc choose_int_tile_proc(unsigned m)
-{
- if (SkShader::kClamp_TileMode == m)
- return int_clamp;
- if (SkShader::kRepeat_TileMode == m)
- return int_repeat;
- SkASSERT(SkShader::kMirror_TileMode == m);
- return int_mirror;
-}
-
SkBitmapProcState::MatrixProc SkBitmapProcState::chooseMatrixProc()
{
int index = 0;
if (fDoFilter)
index = 1;
if (fInvType & SkMatrix::kPerspective_Mask)
- index |= 6;
- else if (fInvType & SkMatrix::kAffine_Mask)
index |= 4;
- else if (fInvType & SkMatrix::kScale_Mask)
+ else if (fInvType & SkMatrix::kAffine_Mask)
index |= 2;
if (SkShader::kClamp_TileMode == fTileModeX &&
@@ -171,8 +123,6 @@ SkBitmapProcState::MatrixProc SkBitmapProcState::chooseMatrixProc()
// only general needs these procs
fTileProcX = choose_tile_proc(fTileModeX);
fTileProcY = choose_tile_proc(fTileModeY);
- iTileProcX = choose_int_tile_proc(fTileModeX);
- iTileProcY = choose_int_tile_proc(fTileModeY);
return GeneralXY_Procs[index];
}