Bug 795549 - Move TileProc functions into their own file to ensure they only exist once in a library r=mattwoodrow
authorGeorge Wright <gw@gwright.org.uk>
Mon, 24 Sep 2012 17:29:09 -0400
changeset 108741 86acf4b667c822c8f14be779577b921a37a1c987
parent 108736 1d3de8da2508e3acdaa3ddf1e0769472d3704f0b
child 108742 eef8fce038aa8c19695a3aaf7be32dd20ae3792a
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersmattwoodrow
bugs795549
milestone18.0a1
Bug 795549 - Move TileProc functions into their own file to ensure they only exist once in a library r=mattwoodrow
gfx/skia/Makefile.in
gfx/skia/src/effects/gradients/SkGradientShaderPriv.h
gfx/skia/src/effects/gradients/SkGradientTileProc.cpp
--- 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
+