Bug 1252302 - Remove gfx/thebes/Makefile.in; r?gps draft
authorMike Shal <mshal@mozilla.com>
Fri, 26 Feb 2016 23:25:31 -0500
changeset 336301 95276b8aedb4d92a7bf1ae40da48866ba1dcb967
parent 336168 c59c022943f6a7e79f6002e11fc9f56cb836f5dd
child 515364 0d677265beba94dc24060f365add0745b04e30f4
push id12032
push userbmo:mshal@mozilla.com
push dateThu, 03 Mar 2016 00:22:07 +0000
reviewersgps
bugs1252302
milestone47.0a1
Bug 1252302 - Remove gfx/thebes/Makefile.in; r?gps This requires converting genTables.py into something moz.build can call into. MozReview-Commit-ID: 11kXtK8bP5W
gfx/thebes/Makefile.in
gfx/thebes/genTables.py
gfx/thebes/moz.build
deleted file mode 100644
--- a/gfx/thebes/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-include $(topsrcdir)/config/rules.mk
-
-DeprecatedPremultiplyTables.h: $(srcdir)/genTables.py
-	$(PYTHON) $(srcdir)/genTables.py
--- a/gfx/thebes/genTables.py
+++ b/gfx/thebes/genTables.py
@@ -1,12 +1,21 @@
 #!/usr/bin/python
 
+import sys
+
 def table_generator(f):
     return ",\n".join([", ".join(["0x%2.2x" % h for h in [f(i) for i in range(r,r+16)]]) for r in range(0, 65536, 16)])
 
-with open("DeprecatedPremultiplyTables.h", "w") as f:
-  f.write("const uint8_t gfxUtils::sPremultiplyTable[256*256] = {\n");
-  f.write(table_generator(lambda i: ((i / 256) * (i % 256) + 254) / 255) + "\n")
-  f.write("};\n");
-  f.write("const uint8_t gfxUtils::sUnpremultiplyTable[256*256] = {\n");
-  f.write(table_generator(lambda i: (i % 256) * 255 / ((i / 256) if (i / 256) > 0 else 255) % 256) + "\n")
-  f.write("};\n");
+def generate(output):
+    output.write("const uint8_t gfxUtils::sPremultiplyTable[256*256] = {\n");
+    output.write(table_generator(lambda i: ((i / 256) * (i % 256) + 254) / 255) + "\n")
+    output.write("};\n");
+    output.write("const uint8_t gfxUtils::sUnpremultiplyTable[256*256] = {\n");
+    output.write(table_generator(lambda i: (i % 256) * 255 / ((i / 256) if (i / 256) > 0 else 255) % 256) + "\n")
+    output.write("};\n");
+
+if __name__ == '__main__':
+    if len(sys.argv) != 2:
+        print >> sys.stderr, "Usage: genTables.py <header.h>"
+        sys.exit(1)
+    with open(sys.argv[1], 'w') as f:
+        generate(f)
--- a/gfx/thebes/moz.build
+++ b/gfx/thebes/moz.build
@@ -266,16 +266,17 @@ if CONFIG['GNU_CXX']:
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 GENERATED_FILES = [
     'DeprecatedPremultiplyTables.h',
 ]
+GENERATED_FILES['DeprecatedPremultiplyTables.h'].script = 'genTables.py:generate'
 
 LOCAL_INCLUDES += [
     '/dom/workers',
     '/dom/xml',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
   LOCAL_INCLUDES += ['/widget/gonk']