mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-21 14:25:14 +00:00
fix transparent bug
This commit is contained in:
@@ -45,14 +45,15 @@
|
|||||||
- (void)renderTo:(CGContextRef)context
|
- (void)renderTo:(CGContextRef)context
|
||||||
{
|
{
|
||||||
float opacity = self.opacity;
|
float opacity = self.opacity;
|
||||||
BOOL transparent = NO;
|
|
||||||
if (opacity <= 0) {
|
if (opacity <= 0) {
|
||||||
// Nothing to paint
|
// Nothing to paint
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (opacity >= 1) {
|
|
||||||
|
BOOL transparent = opacity < 1;
|
||||||
|
if (!transparent) {
|
||||||
opacity = 1;
|
opacity = 1;
|
||||||
transparent = YES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This needs to be painted on a layer before being composited.
|
// This needs to be painted on a layer before being composited.
|
||||||
@@ -61,7 +62,6 @@
|
|||||||
CGContextSetAlpha(context, opacity);
|
CGContextSetAlpha(context, opacity);
|
||||||
if (transparent) {
|
if (transparent) {
|
||||||
CGContextBeginTransparencyLayer(context, NULL);
|
CGContextBeginTransparencyLayer(context, NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
[self renderLayerTo:context];
|
[self renderLayerTo:context];
|
||||||
if (transparent) {
|
if (transparent) {
|
||||||
|
|||||||
Reference in New Issue
Block a user