mirror of https://github.com/kivy/kivy.git
Fixed effectwidget to work as RelativeLayout
This commit is contained in:
parent
bc42846dd7
commit
02b2ff7deb
|
@ -113,6 +113,9 @@
|
|||
pos: self.center_x - self.norm_image_size[0] / 2., self.center_y - self.norm_image_size[1] / 2.
|
||||
|
||||
<EffectWidget>:
|
||||
canvas.before:
|
||||
Translate:
|
||||
xy: -self.x, -self.y
|
||||
canvas:
|
||||
Color:
|
||||
rgba: 1, 1, 1, 1
|
||||
|
|
|
@ -644,11 +644,10 @@ class EffectWidget(RelativeLayout):
|
|||
|
||||
with self.fbo.before:
|
||||
PushMatrix()
|
||||
self.fbo_translation = Translate(-self.x, -self.y, 0)
|
||||
with self.fbo:
|
||||
ClearColor(1, 1, 1, 1)
|
||||
Color(*self.background_color)
|
||||
ClearColor(0, 0, 0, 0)
|
||||
ClearBuffers()
|
||||
Color(*self.background_color)
|
||||
self.fbo_rectangle = Rectangle(size=self.size)
|
||||
with self.fbo.after:
|
||||
PopMatrix()
|
||||
|
@ -657,18 +656,11 @@ class EffectWidget(RelativeLayout):
|
|||
|
||||
Clock.schedule_interval(self._update_glsl, 0)
|
||||
|
||||
self.bind(pos=self._update_translation,
|
||||
size=self.refresh_fbo_setup,
|
||||
self.bind(size=self.refresh_fbo_setup,
|
||||
effects=self.refresh_fbo_setup)
|
||||
|
||||
self.refresh_fbo_setup()
|
||||
|
||||
def _update_translation(self, *args):
|
||||
'''(internal) Makes sure everything is translated correctly to
|
||||
appear in the fbo.'''
|
||||
self.fbo_translation.x = -self.x
|
||||
self.fbo_translation.y = -self.y
|
||||
|
||||
def _update_glsl(self, *largs):
|
||||
'''(internal) Passes new time and resolution uniform
|
||||
variables to the shader.
|
||||
|
@ -692,7 +684,6 @@ class EffectWidget(RelativeLayout):
|
|||
new_fbo = EffectFbo(size=self.size)
|
||||
with new_fbo:
|
||||
ClearColor(1, 1, 1, 1)
|
||||
Color(*self.background_color)
|
||||
ClearBuffers()
|
||||
new_fbo.texture_rectangle = Rectangle(size=self.size)
|
||||
|
||||
|
|
Loading…
Reference in New Issue