aboutsummaryrefslogtreecommitdiff
path: root/src/toolkit/frame.py
diff options
context:
space:
mode:
authortassaron2017-08-12 22:51:46 -0400
committertassaron2017-08-12 22:51:46 -0400
commitd6b6083f80ae609c801ef63285718325cd71d0c9 (patch)
tree7616931b30c5031ef6d5fa5b4d6dd98b0ef0ae03 /src/toolkit/frame.py
parent282f1c4b12b485a567f0d055832a5bf4409404a3 (diff)
rv pointless optimization & remove circular imports (again...)
the last commit does showcase an enlightening bug however
Diffstat (limited to 'src/toolkit/frame.py')
-rw-r--r--src/toolkit/frame.py34
1 files changed, 14 insertions, 20 deletions
diff --git a/src/toolkit/frame.py b/src/toolkit/frame.py
index e4332eb..6174072 100644
--- a/src/toolkit/frame.py
+++ b/src/toolkit/frame.py
@@ -86,31 +86,25 @@ def FloodFrame(width, height, RgbaTuple):
@defaultSize
-def BlankFrame(width, height, blankFrames={}):
+def BlankFrame(width, height):
'''The base frame used by each component to start drawing.'''
- try:
- return blankFrames[(width, height)]
- except KeyError:
- newFrame = FloodFrame(width, height, (0, 0, 0, 0))
- blankFrames[(width, height)] = newFrame
- return newFrame
+ newFrame = FloodFrame(width, height, (0, 0, 0, 0))
+ blankFrames[(width, height)] = newFrame
+ return newFrame
@defaultSize
-def Checkerboard(width, height, checkerboards={}):
+def Checkerboard(width, height):
'''
A checkerboard to represent transparency to the user.
TODO: Would be cool to generate this image with numpy instead.
'''
- try:
- return checkerboards[(width, height)]
- except KeyError:
- log.debug('Creating new %s*%s checkerboard' % (width, height))
- image = FloodFrame(1920, 1080, (0, 0, 0, 0))
- image.paste(Image.open(
- os.path.join(core.Core.wd, "background.png")),
- (0, 0)
- )
- image = image.resize((width, height))
- checkerboards[(width, height)] = image
- return image
+ log.debug('Creating new %s*%s checkerboard' % (width, height))
+ image = FloodFrame(1920, 1080, (0, 0, 0, 0))
+ image.paste(Image.open(
+ os.path.join(core.Core.wd, "background.png")),
+ (0, 0)
+ )
+ image = image.resize((width, height))
+ checkerboards[(width, height)] = image
+ return image