Skip to content

Commit

Permalink
Use a list for renderers without gradient transform support (so far)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinD42 committed Aug 2, 2019
1 parent 9c998c0 commit 4a79f46
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions wx/svg/__init__.py
Expand Up @@ -17,6 +17,7 @@
from ._version import __version__
from ._nanosvg import *

_RenderersWithoutGradientTransforms = ['wxGDIPlusRenderer', 'wxD2DRenderer']

class SVGimage(SVGimageBase):
"""
Expand Down Expand Up @@ -134,7 +135,7 @@ def _makeBrush(self, ctx, shape):
# ourselves. This is only an approximation of the desired outcome
# however, as things like scale and shear in the transform will not
# be applied to the rest of the fill.
if ctx.Renderer.Type == 'wxGDIPlusRenderer':
if ctx.Renderer.Type in _RenderersWithoutGradientTransforms:
matrix.Invert()
x1, y1 = matrix.TransformPoint(x1, y1)
x2, y2 = matrix.TransformPoint(x2, y2)
Expand All @@ -155,7 +156,7 @@ def _makeBrush(self, ctx, shape):
matrix = ctx.CreateMatrix(*gradient.xform)

# Except for GDI+... See note above
if ctx.Renderer.Type == 'wxGDIPlusRenderer':
if ctx.Renderer.Type in _RenderersWithoutGradientTransforms:
matrix.Invert()
cx, cy = matrix.TransformPoint(cx, cy)
r1, r2 = matrix.TransformPoint(0, 1)
Expand Down Expand Up @@ -198,7 +199,7 @@ def _makePen(self, ctx, shape):
matrix = ctx.CreateMatrix(*gradient.xform)

# Except for GDI+... See note above
if ctx.Renderer.Type == 'wxGDIPlusRenderer':
if ctx.Renderer.Type in _RenderersWithoutGradientTransforms:
matrix.Invert()
x1, y1 = matrix.TransformPoint(x1, y1)
x2, y2 = matrix.TransformPoint(x2, y2)
Expand All @@ -216,7 +217,7 @@ def _makePen(self, ctx, shape):
matrix = ctx.CreateMatrix(*gradient.xform)

# Except for GDI+... See note above
if ctx.Renderer.Type == 'wxGDIPlusRenderer':
if ctx.Renderer.Type in _RenderersWithoutGradientTransforms:
matrix.Invert()
cx, cy = matrix.TransformPoint(cx, cy)
r1, r2 = matrix.TransformPoint(0, 1)
Expand Down

0 comments on commit 4a79f46

Please sign in to comment.