Commit 159cdcae authored by Gaëtan Renaudeau's avatar Gaëtan Renaudeau

Fix GL.Target rasterization for Retina screens. Fix #4

parent 0e42382e
#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];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment