Permalink
Browse files

Bug 827934 - Only build gfxUtils.cpp when needed; r=jrmuizel,ted

  • Loading branch information...
1 parent a017203 commit fbe69e080d97ec6f28dc0acdc1ad31e06652f451 @ehsan ehsan committed Jan 8, 2013
Showing with 10 additions and 17 deletions.
  1. +2 −3 gfx/thebes/Makefile.in
  2. +7 −7 gfx/thebes/genTables.py
  3. +1 −7 gfx/thebes/gfxUtils.cpp
View
@@ -394,8 +394,7 @@ gfxAlphaRecoverySSE2.$(OBJ_SUFFIX): OS_CXXFLAGS += -xarch=sse2 -xO4
endif
endif
-.PHONY: CONSTANT_TABLES
-CONSTANT_TABLES:
+PremultiplyTables.h: $(srcdir)/genTables.py
$(PYTHON) $(srcdir)/genTables.py
-gfxUtils.$(OBJ_SUFFIX): CONSTANT_TABLES
+gfxUtils.$(OBJ_SUFFIX): PremultiplyTables.h
View
@@ -3,10 +3,10 @@
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)])
-f = open("sPremultiplyTable.h", "w")
-f.write(table_generator(lambda i: ((i / 256) * (i % 256) + 254) / 255) + "\n")
-f.close()
-
-f = open("sUnpremultiplyTable.h", "w")
-f.write(table_generator(lambda i: (i % 256) * 255 / ((i / 256) if (i / 256) > 0 else 255) % 256) + "\n")
-f.close()
+with open("PremultiplyTables.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");
View
@@ -20,13 +20,7 @@ using namespace mozilla;
using namespace mozilla::layers;
using namespace mozilla::gfx;
-const uint8_t gfxUtils::sPremultiplyTable[256*256] = {
-#include "sPremultiplyTable.h"
-};
-
-const uint8_t gfxUtils::sUnpremultiplyTable[256*256] = {
-#include "sUnpremultiplyTable.h"
-};
+#include "PremultiplyTables.h"
static const uint8_t PremultiplyValue(uint8_t a, uint8_t v) {
return gfxUtils::sPremultiplyTable[a*256+v];

0 comments on commit fbe69e0

Please sign in to comment.