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
This commit is contained in:
Mike Shal 2016-02-26 23:25:31 -05:00
parent 3c21b4d662
commit 6ca8f7d2e0
3 changed files with 18 additions and 15 deletions

View File

@ -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

View File

@ -1,12 +1,22 @@
#!/usr/bin/python
from __future__ import print_function
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("Usage: genTables.py <header.h>", file=sys.stderr)
sys.exit(1)
with open(sys.argv[1], 'w') as f:
generate(f)

View File

@ -271,6 +271,7 @@ FINAL_LIBRARY = 'xul'
GENERATED_FILES = [
'DeprecatedPremultiplyTables.h',
]
GENERATED_FILES['DeprecatedPremultiplyTables.h'].script = 'genTables.py:generate'
LOCAL_INCLUDES += [
'/dom/workers',