Skip to content

Commit

Permalink
Move crush_png in global scope
Browse files Browse the repository at this point in the history
  • Loading branch information
Helco committed Oct 23, 2018
1 parent 416aa3f commit 315c855
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions Utilities/mkpack.py
Expand Up @@ -41,6 +41,8 @@
import os
import sys

crush_png = None # To be imported

TAB_OFS = 0x0C
RES_OFS = 0x200C

Expand Down Expand Up @@ -189,18 +191,17 @@ def sourcedesc(self):
return self.file

class ResourceImage(Resource):
def __init__(self, coll, j, crush_png, palette):
def __init__(self, coll, j, palette):
super(self.__class__, self).__init__(coll, j)

self.file = "{}/{}".format(self.coll.root, j["input"]["file"])
self.crush_png = crush_png
self.palette = palette

def deps(self):
return [self.file]

def data(self):
return self.crush_png(self.file, self.palette)
return crush_png(self.file, self.palette)

def sourcedesc(self):
return "imported image " + self.file
Expand Down Expand Up @@ -231,7 +232,7 @@ class ResourceCollection:
"""

def __init__(self, fname, root = ".", crush_png = None):
def __init__(self, fname, root = "."):
"""
Load in a resource collection from a file, but don't load the
resources associated with it. (That happens later.)
Expand All @@ -258,7 +259,7 @@ def __init__(self, fname, root = ".", crush_png = None):
elif res["input"]["type"] == "resource":
self.resources.append(ResourceRef(self, res))
elif res["input"]["type"] == "image":
self.resources.append(ResourceImage(self, res, crush_png, jdb["palette"]))
self.resources.append(ResourceImage(self, res, jdb["palette"]))
else:
raise ValueError("unknown resource type {}".format(res["type"]))

Expand Down Expand Up @@ -347,9 +348,10 @@ def main():
sdk_path = os.path.expanduser(args.sdk[0])
if not os.path.isdir(sdk_path):
raise ValueError("could not find pebble sdk, please provide one with --sdk")
global crush_png
crush_png = import_crush_png(sdk_path)

rc = ResourceCollection(args.json, root = args.root[0], crush_png = crush_png)
rc = ResourceCollection(args.json, root = args.root[0])

pbpack_name = "{}.pbpack".format(args.basename)
header_name = "{}.h".format(args.basename)
Expand Down
2 changes: 1 addition & 1 deletion lib/neographics
Submodule neographics updated 88 files
+155 −0 CMakeLists.txt
+15 −0 contrib/pebble_env/pebble.c
+72 −0 contrib/pebble_env/pebble.h
+322 −0 contrib/testrunner_pc/resources.c
+21 −0 contrib/testrunner_pc/stb_impl.c
+228 −0 contrib/testrunner_pc/testrunner.c
+56 −0 contrib/testrunner_pc/testrunner.h
+32 −0 contrib/testrunner_pc/tests.c
+99 −0 contrib/testrunner_pc/utils.c
+5 −4 src/context.c
+15 −1 src/context.h
+64 −0 src/gbitmap/blit.h
+80 −0 src/gbitmap/blit_bw.c
+120 −0 src/gbitmap/blit_color.c
+249 −0 src/gbitmap/gbitmap.c
+120 −0 src/gbitmap/gbitmap.h
+6 −4 src/macros.h
+1 −1 src/primitives/rect.c
+13 −2 src/types/color.h
+6 −0 src/types/point.h
+81 −2 src/types/rect.c
+32 −6 src/types/rect.h
+6 −0 src/types/size.h
+ test/resources/blit_bigsmiley.png
+ test/resources/blit_blending.png
+ test/resources/blit_smiley.png
+ test/resources/rect/blit_assign1bit.png
+ test/resources/rect/blit_assign1bitpalette.png
+ test/resources/rect/blit_assign2bitpalette.png
+ test/resources/rect/blit_assign4bitpalette.png
+ test/resources/rect/blit_assign8bit.png
+ test/resources/rect/blit_biggerthanscreen.png
+ test/resources/rect/blit_blending4bitpalette.png
+ test/resources/rect/blit_blending8bit.png
+ test/resources/rect/blit_compopand.png
+ test/resources/rect/blit_compopclear.png
+ test/resources/rect/blit_compopinverted.png
+ test/resources/rect/blit_compopor.png
+ test/resources/rect/blit_compopset.png
+ test/resources/rect/blit_fullyclipped.png
+ test/resources/rect/blit_partiallyclipped.png
+ test/resources/rect/blit_tiling1bit.png
+ test/resources/rect/blit_tiling4bitpalette.png
+ test/resources/rect/blit_tiling8bit.png
+ test/resources/rect/test_checker_full.png
+ test/resources/rect_bw/blit_assign1bit.png
+ test/resources/rect_bw/blit_assign1bitpalette.png
+ test/resources/rect_bw/blit_assign2bitpalette.png
+ test/resources/rect_bw/blit_assign4bitpalette.png
+ test/resources/rect_bw/blit_biggerthanscreen.png
+ test/resources/rect_bw/blit_blending4bitpalette.png
+ test/resources/rect_bw/blit_compopand.png
+ test/resources/rect_bw/blit_compopclear.png
+ test/resources/rect_bw/blit_compopinverted.png
+ test/resources/rect_bw/blit_compopor.png
+ test/resources/rect_bw/blit_compopset.png
+ test/resources/rect_bw/blit_fullyclipped.png
+ test/resources/rect_bw/blit_partiallyclipped.png
+ test/resources/rect_bw/blit_tiling1bit.png
+ test/resources/rect_bw/blit_tiling4bitpalette.png
+ test/resources/rect_bw/test_checker_full.png
+ test/resources/round/blit_assign1bit.png
+ test/resources/round/blit_assign1bitpalette.png
+ test/resources/round/blit_assign2bitpalette.png
+ test/resources/round/blit_assign4bitpalette.png
+ test/resources/round/blit_assign8bit.png
+ test/resources/round/blit_biggerthanscreen.png
+ test/resources/round/blit_blending4bitpalette.png
+ test/resources/round/blit_blending8bit.png
+ test/resources/round/blit_compopand.png
+ test/resources/round/blit_compopclear.png
+ test/resources/round/blit_compopinverted.png
+ test/resources/round/blit_compopor.png
+ test/resources/round/blit_compopset.png
+ test/resources/round/blit_fullyclipped.png
+ test/resources/round/blit_partiallyclipped.png
+ test/resources/round/blit_tiling1bit.png
+ test/resources/round/blit_tiling4bitpalette.png
+ test/resources/round/blit_tiling8bit.png
+ test/resources/round/test_checker_full.png
+ test/resources/test_checker.png
+1 −0 test/resources/test_helloworld.txt
+224 −0 test/test.h
+340 −0 test/test_blit.h
+179 −0 test/test_gbitmap.h
+204 −0 test/test_test.h
+45 −0 test/test_types.h
+4 −0 test/tests.h

0 comments on commit 315c855

Please sign in to comment.