Bug 795549 - Move TileProc functions into their own file to ensure they only exist once in a library r=mattwoodrow
--- a/gfx/skia/Makefile.in
+++ b/gfx/skia/Makefile.in
@@ -213,16 +213,17 @@ CPPSRCS = \
SkFlattenableBuffers.cpp \
SkFloat.cpp \
SkFloatBits.cpp \
SkFontDescriptor.cpp \
SkFontHost.cpp \
SkGeometry.cpp \
SkGlyphCache.cpp \
SkGradientShader.cpp \
+ SkGradientTileProc.cpp \
SkGraphics.cpp \
SkGPipeRead.cpp \
SkGPipeWrite.cpp \
SkImage.cpp \
SkImage_Codec.cpp \
SkImage_Picture.cpp \
SkImage_Raster.cpp \
SkImageDecoder.cpp \
--- a/gfx/skia/src/effects/gradients/SkGradientShaderPriv.h
+++ b/gfx/skia/src/effects/gradients/SkGradientShaderPriv.h
@@ -37,44 +37,21 @@ static void sk_memset32_dither(uint32_t
}
if (count & 1) {
*dst = v0;
}
}
}
}
-// Clamp
-
-static SkFixed clamp_tileproc(SkFixed x) {
- return SkClampMax(x, 0xFFFF);
-}
-
-// Repeat
-
-static SkFixed repeat_tileproc(SkFixed x) {
- return x & 0xFFFF;
-}
-
-// Mirror
+///////////////////////////////////////////////////////////////////////////////
-// Visual Studio 2010 (MSC_VER=1600) optimizes bit-shift code incorrectly.
-// See http://code.google.com/p/skia/issues/detail?id=472
-#if defined(_MSC_VER) && (_MSC_VER >= 1600)
-#pragma optimize("", off)
-#endif
-
-static inline SkFixed mirror_tileproc(SkFixed x) {
- int s = x << 15 >> 31;
- return (x ^ s) & 0xFFFF;
-}
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1600)
-#pragma optimize("", on)
-#endif
+SkFixed clamp_tileproc(SkFixed x);
+SkFixed mirror_tileproc(SkFixed x);
+SkFixed repeat_tileproc(SkFixed x);
///////////////////////////////////////////////////////////////////////////////
typedef SkFixed (*TileProc)(SkFixed);
///////////////////////////////////////////////////////////////////////////////
static const TileProc gTileProcs[] = {
new file mode 100644
--- /dev/null
+++ b/gfx/skia/src/effects/gradients/SkGradientTileProc.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkGradientShaderPriv.h"
+
+// Clamp
+
+SkFixed clamp_tileproc(SkFixed x) {
+ return SkClampMax(x, 0xFFFF);
+}
+
+// Repeat
+
+SkFixed repeat_tileproc(SkFixed x) {
+ return x & 0xFFFF;
+}
+
+// Mirror
+
+// Visual Studio 2010 (MSC_VER=1600) optimizes bit-shift code incorrectly.
+// See http://code.google.com/p/skia/issues/detail?id=472
+#if defined(_MSC_VER) && (_MSC_VER >= 1600)
+#pragma optimize("", off)
+#endif
+
+SkFixed mirror_tileproc(SkFixed x) {
+ int s = x << 15 >> 31;
+ return (x ^ s) & 0xFFFF;
+}
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1600)
+#pragma optimize("", on)
+#endif
+