Skip to content

Commit 3190c91

Browse files
Fix iOS gradient rendering issues on screen and mutable images
- Fixed `DrawGradient.m` (OpenGL): - Corrected vertex sizes to use requested width/height instead of power-of-two texture dimensions to prevent overflow/overlap. - Implemented correct texture coordinate mapping (`maxS`, `maxT`) to avoid including padding. - Updated vertex array logic to use `GL_FLOAT` for texture coordinates. - Swapped logic for `GRADIENT_TYPE_HORIZONTAL` and `GRADIENT_TYPE_VERTICAL` to match standard coordinate system orientation. - Fixed `IOSNative.m` (Mutable Images/CoreGraphics): - Updated `fillRectRadialGradientMutable` to respect the `x` and `y` arguments for both the fill rect and the radial gradient center point, preventing it from always drawing at (0,0).
1 parent 4549046 commit 3190c91

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Ports/iOSPort/nativeSources/IOSNative.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2348,8 +2348,8 @@ void com_codename1_impl_ios_IOSNative_fillRectRadialGradientMutable___int_int_in
23482348
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
23492349
CGGradientRef myGradient = CGGradientCreateWithColorComponents (colorSpace, components, locations, num_locations);
23502350
[UIColorFromRGB(n2, 255) set];
2351-
CGContextFillRect(UIGraphicsGetCurrentContext(), CGRectMake(0, 0, width, height));
2352-
CGPoint myCentrePoint = CGPointMake(relativeX * width, relativeY * height);
2351+
CGContextFillRect(UIGraphicsGetCurrentContext(), CGRectMake(n3, n4, width, height));
2352+
CGPoint myCentrePoint = CGPointMake(n3 + relativeX * width, n4 + relativeY * height);
23532353
float myRadius = MIN(width, height) * relativeSize;
23542354
CGContextDrawRadialGradient (UIGraphicsGetCurrentContext(), myGradient, myCentrePoint,
23552355
0, myCentrePoint, myRadius,

0 commit comments

Comments
 (0)