diff --git a/RNGL/GLTexture.m b/RNGL/GLTexture.m index 9de818c3751a61896fb7df87bacfa20f183e9adf..8393520b55157480eb99cb4747d38919dbd8104b 100644 --- a/RNGL/GLTexture.m +++ b/RNGL/GLTexture.m @@ -1,5 +1,6 @@ #import "GLTexture.h" #import "RCTLog.h" +#import "RCTUtils.h" GLImageData* genPixelsEmpty (int width, int height) { @@ -53,13 +54,14 @@ GLImageData* genPixelsWithImage (UIImage *image) GLImageData* genPixelsWithView (UIView *view) { - int width = view.bounds.size.width; - int height = view.bounds.size.height; + float width = RCTScreenScale() * view.bounds.size.width; + float height = RCTScreenScale() * view.bounds.size.height; GLubyte *data = (GLubyte *)malloc(4 * width * height); CGColorSpaceRef colourSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef ctx = CGBitmapContextCreate(data, width, height, 8, 4 * width, colourSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); CGColorSpaceRelease(colourSpace); - CGContextClearRect(ctx, view.bounds); + CGContextClearRect(ctx, CGRectMake(0.0, 0.0, width, height)); + CGContextScaleCTM(ctx, RCTScreenScale(), RCTScreenScale()); [view.layer renderInContext:ctx]; CGContextRelease(ctx); return [[GLImageData alloc] initWithData:data withWidth:width withHeight:height];