react-native-rectangle-doc-scanner 3.14.0 → 3.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -82,6 +82,7 @@
|
|
|
82
82
|
{
|
|
83
83
|
if (self.context) return;
|
|
84
84
|
|
|
85
|
+
NSLog(@"[IPDFCamera] createGLKView - self.bounds: %@", NSStringFromCGRect(self.bounds));
|
|
85
86
|
self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
|
|
86
87
|
GLKView *view = [[GLKView alloc] initWithFrame:self.bounds];
|
|
87
88
|
view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
@@ -91,6 +92,7 @@
|
|
|
91
92
|
view.drawableDepthFormat = GLKViewDrawableDepthFormat24;
|
|
92
93
|
[self insertSubview:view atIndex:0];
|
|
93
94
|
_glkView = view;
|
|
95
|
+
NSLog(@"[IPDFCamera] createGLKView - created GLKView with frame: %@", NSStringFromCGRect(view.frame));
|
|
94
96
|
glGenRenderbuffers(1, &_renderBuffer);
|
|
95
97
|
glBindRenderbuffer(GL_RENDERBUFFER, _renderBuffer);
|
|
96
98
|
_coreImageContext = [CIContext contextWithEAGLContext:self.context];
|
|
@@ -101,6 +103,13 @@
|
|
|
101
103
|
{
|
|
102
104
|
[self createGLKView];
|
|
103
105
|
|
|
106
|
+
// Explicitly set GLKView frame to match current bounds
|
|
107
|
+
if (_glkView) {
|
|
108
|
+
NSLog(@"[IPDFCamera] setupCameraView - setting _glkView.frame to self.bounds: %@", NSStringFromCGRect(self.bounds));
|
|
109
|
+
_glkView.frame = self.bounds;
|
|
110
|
+
NSLog(@"[IPDFCamera] setupCameraView - _glkView.frame is now: %@", NSStringFromCGRect(_glkView.frame));
|
|
111
|
+
}
|
|
112
|
+
|
|
104
113
|
AVCaptureDevice *device = nil;
|
|
105
114
|
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
|
|
106
115
|
for (AVCaptureDevice *possibleDevice in devices) {
|
|
@@ -211,15 +220,15 @@
|
|
|
211
220
|
}
|
|
212
221
|
}
|
|
213
222
|
|
|
214
|
-
if (self.context && _coreImageContext)
|
|
223
|
+
if (self.context && _coreImageContext && _glkView)
|
|
215
224
|
{
|
|
216
225
|
// Calculate the rect to draw the image with aspect fill
|
|
217
|
-
CGRect
|
|
226
|
+
CGRect viewBounds = _glkView.bounds;
|
|
218
227
|
CGRect imageExtent = image.extent;
|
|
219
228
|
|
|
220
229
|
// Calculate aspect ratios
|
|
221
230
|
CGFloat imageAspect = imageExtent.size.width / imageExtent.size.height;
|
|
222
|
-
CGFloat viewAspect =
|
|
231
|
+
CGFloat viewAspect = viewBounds.size.width / viewBounds.size.height;
|
|
223
232
|
|
|
224
233
|
CGRect fromRect = imageExtent;
|
|
225
234
|
|
|
@@ -236,6 +245,12 @@
|
|
|
236
245
|
fromRect = CGRectMake(0, yOffset, imageExtent.size.width, newHeight);
|
|
237
246
|
}
|
|
238
247
|
|
|
248
|
+
// GLKView renderbuffer expects pixel dimensions, not point-based bounds
|
|
249
|
+
CGRect drawRect = CGRectMake(0,
|
|
250
|
+
0,
|
|
251
|
+
(CGFloat)_glkView.drawableWidth,
|
|
252
|
+
(CGFloat)_glkView.drawableHeight);
|
|
253
|
+
|
|
239
254
|
[_coreImageContext drawImage:image inRect:drawRect fromRect:fromRect];
|
|
240
255
|
[self.context presentRenderbuffer:GL_RENDERBUFFER];
|
|
241
256
|
|