summaryrefslogtreecommitdiffstats
path: root/skia/sgl/SkBitmapProcState_matrix.h
diff options
context:
space:
mode:
authormal@chromium.org <mal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-15 04:50:37 +0000
committermal@chromium.org <mal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-15 04:50:37 +0000
commite0216626dad56120d385803ca92f7bea74989195 (patch)
tree961bc9a6901f7aaa34f101d51996fd63db658842 /skia/sgl/SkBitmapProcState_matrix.h
parent0abba532723e20a4de61a0dfc88eeba3f5ab8e77 (diff)
downloadchromium_src-e0216626dad56120d385803ca92f7bea74989195.zip
chromium_src-e0216626dad56120d385803ca92f7bea74989195.tar.gz
chromium_src-e0216626dad56120d385803ca92f7bea74989195.tar.bz2
Fix the Facebook sidebar.
This is actually just a replica of the following patch (internal Google URL): http://go/facebook-skia-patch Apparently the changes made by yzshen@google.com were not upstreamed to Skia. In the most recent skia update (r7308), these changes were dropped. I've tested the changes locally, and it fixes Facebook. However, it could possibly break layout tests. BUG= 5564 R= brettw TEST= I'd kill for one. Review URL: http://codereview.chromium.org/20386 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9836 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/sgl/SkBitmapProcState_matrix.h')
-rw-r--r--skia/sgl/SkBitmapProcState_matrix.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/skia/sgl/SkBitmapProcState_matrix.h b/skia/sgl/SkBitmapProcState_matrix.h
index 1212a41..80d3e97 100644
--- a/skia/sgl/SkBitmapProcState_matrix.h
+++ b/skia/sgl/SkBitmapProcState_matrix.h
@@ -1,4 +1,5 @@
+#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)
@@ -17,6 +18,38 @@
#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 |
@@ -241,6 +274,9 @@ 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,
@@ -256,6 +292,10 @@ 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
@@ -269,5 +309,7 @@ static SkBitmapProcState::MatrixProc MAKENAME(_Procs)[] = {
#undef PREAMBLE_ARG_X
#undef PREAMBLE_ARG_Y
+#undef PREAMBLE_TRANS
+
#undef TILEX_LOW_BITS
#undef TILEY_LOW_BITS