mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 14:25:49 +00:00
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:
parent
3c21b4d662
commit
6ca8f7d2e0
@ -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
|
@ -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)
|
||||
|
@ -271,6 +271,7 @@ FINAL_LIBRARY = 'xul'
|
||||
GENERATED_FILES = [
|
||||
'DeprecatedPremultiplyTables.h',
|
||||
]
|
||||
GENERATED_FILES['DeprecatedPremultiplyTables.h'].script = 'genTables.py:generate'
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/workers',
|
||||
|
Loading…
x
Reference in New Issue
Block a user