OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/renderer_host/compositing_iosurface_layer_mac.h" | 5 #include "content/browser/renderer_host/compositing_iosurface_layer_mac.h" |
6 | 6 |
7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
8 #include <OpenGL/gl.h> | 8 #include <OpenGL/gl.h> |
9 | 9 |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 GLint viewport[4]; | 199 GLint viewport[4]; |
200 glGetIntegerv(GL_VIEWPORT, viewport); | 200 glGetIntegerv(GL_VIEWPORT, viewport); |
201 gfx::Rect window_rect(viewport[0], viewport[1], viewport[2], viewport[3]); | 201 gfx::Rect window_rect(viewport[0], viewport[1], viewport[2], viewport[3]); |
202 float window_scale_factor = 1.f; | 202 float window_scale_factor = 1.f; |
203 if ([self respondsToSelector:(@selector(contentsScale))]) | 203 if ([self respondsToSelector:(@selector(contentsScale))]) |
204 window_scale_factor = [self contentsScale]; | 204 window_scale_factor = [self contentsScale]; |
205 window_rect = ToNearestRect( | 205 window_rect = ToNearestRect( |
206 gfx::ScaleRect(window_rect, 1.f/window_scale_factor)); | 206 gfx::ScaleRect(window_rect, 1.f/window_scale_factor)); |
207 | 207 |
208 bool draw_succeeded = iosurface_->DrawIOSurface( | 208 bool draw_succeeded = iosurface_->DrawIOSurface( |
209 context_, window_rect, window_scale_factor, false); | 209 context_, window_rect, window_scale_factor); |
210 | 210 |
211 [self ackPendingFrame:draw_succeeded]; | 211 [self ackPendingFrame:draw_succeeded]; |
212 needs_display_ = NO; | 212 needs_display_ = NO; |
213 | 213 |
214 [super drawInCGLContext:glContext | 214 [super drawInCGLContext:glContext |
215 pixelFormat:pixelFormat | 215 pixelFormat:pixelFormat |
216 forLayerTime:timeInterval | 216 forLayerTime:timeInterval |
217 displayTime:timeStamp]; | 217 displayTime:timeStamp]; |
218 } | 218 } |
219 | 219 |
220 @end | 220 @end |
OLD | NEW |