Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: plugin/mac/plugin_mac.mm

Issue 5843001: Fix ON_DEMAND_RENDER mode on Mac OSX.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « plugin/mac/o3d_layer.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 continue; 244 continue;
245 } 245 }
246 246
247 bool in_fullscreen = obj->GetFullscreenMacWindow(); 247 bool in_fullscreen = obj->GetFullscreenMacWindow();
248 248
249 if (obj->drawing_model_ == NPDrawingModelCoreAnimation && 249 if (obj->drawing_model_ == NPDrawingModelCoreAnimation &&
250 !in_fullscreen) { 250 !in_fullscreen) {
251 O3DLayer* o3dLayer = static_cast<O3DLayer*>(obj->gl_layer_); 251 O3DLayer* o3dLayer = static_cast<O3DLayer*>(obj->gl_layer_);
252 if (o3dLayer) { 252 if (o3dLayer) {
253 obj->client()->Tick(); 253 obj->client()->Tick();
254 [o3dLayer setNeedsDisplay]; 254
255 if (obj->client()->NeedsRender()) {
256 [o3dLayer setNeedsDisplay];
257 }
255 } 258 }
256 continue; 259 continue;
257 } 260 }
258 261
259 ManageSafariTabSwitching(obj); 262 ManageSafariTabSwitching(obj);
260 obj->client()->Tick(); 263 obj->client()->Tick();
261 264
262 // It's possible that event processing may have torn down the 265 // It's possible that event processing may have torn down the
263 // full-screen window in the call above. 266 // full-screen window in the call above.
264 in_fullscreen = obj->GetFullscreenMacWindow(); 267 in_fullscreen = obj->GetFullscreenMacWindow();
265 268
266 if (in_fullscreen) { 269 if (in_fullscreen) {
267 obj->GetFullscreenMacWindow()->IdleCallback(); 270 obj->GetFullscreenMacWindow()->IdleCallback();
268 } 271 }
269 272
270 // We're visible if (a) we are in fullscreen mode, (b) our cliprect 273 // We're visible if (a) we are in fullscreen mode, (b) our cliprect
271 // height and width are both a sensible size, ie > 1 pixel, or (c) if 274 // height and width are both a sensible size, ie > 1 pixel, or (c) if
272 // we are rendering to render surfaces (CoreGraphics drawing model, 275 // we are rendering to render surfaces (CoreGraphics drawing model,
273 // essentially offscreen rendering). 276 // essentially offscreen rendering).
274 // 277 //
275 // We don't check for 0 as we have to size to 1 x 1 on occasion rather than 278 // We don't check for 0 as we have to size to 1 x 1 on occasion rather than
276 // 0 x 0 to avoid crashing the Apple software renderer, but do not want to 279 // 0 x 0 to avoid crashing the Apple software renderer, but do not want to
277 // actually draw to a 1 x 1 pixel area. 280 // actually draw to a 1 x 1 pixel area.
278 bool plugin_visible = in_fullscreen || 281 bool plugin_visible = in_fullscreen ||
279 (obj->last_buffer_rect_[2] > 1 && obj->last_buffer_rect_[3] > 1) || 282 (obj->last_buffer_rect_[2] > 1 && obj->last_buffer_rect_[3] > 1) ||
280 obj->IsOffscreenRenderingEnabled(); 283 obj->IsOffscreenRenderingEnabled();
281 284
282 if (plugin_visible && obj->renderer()) { 285 if (plugin_visible && obj->renderer()) {
283 if (obj->client()->NeedsContinuousRender() || 286 if (obj->client()->NeedsRender()) {
284 obj->renderer()->need_to_render()) {
285 // Force a sync to the VBL (once per timer callback) 287 // Force a sync to the VBL (once per timer callback)
286 // to avoid tearing 288 // to avoid tearing
287 GLint sync = (i == 0); 289 GLint sync = (i == 0);
288 if (obj->mac_cgl_context_) { 290 if (obj->mac_cgl_context_) {
289 CGLSetParameter(obj->mac_cgl_context_, kCGLCPSwapInterval, &sync); 291 CGLSetParameter(obj->mac_cgl_context_, kCGLCPSwapInterval, &sync);
290 } else if (obj->mac_agl_context_) { 292 } else if (obj->mac_agl_context_) {
291 aglSetInteger(obj->mac_agl_context_, AGL_SWAP_INTERVAL, &sync); 293 aglSetInteger(obj->mac_agl_context_, AGL_SWAP_INTERVAL, &sync);
292 } 294 }
293 295
294 if (obj->IsOffscreenRenderingEnabled()) { 296 if (obj->IsOffscreenRenderingEnabled()) {
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 #ifdef RENDERER_GLES2 692 #ifdef RENDERER_GLES2
691 ((o3d::RendererGLES2*) renderer_)->set_mac_cgl_context(context); 693 ((o3d::RendererGLES2*) renderer_)->set_mac_cgl_context(context);
692 #else 694 #else
693 ((o3d::RendererGL*) renderer_)->set_mac_cgl_context(context); 695 ((o3d::RendererGL*) renderer_)->set_mac_cgl_context(context);
694 #endif 696 #endif
695 } 697 }
696 } 698 }
697 699
698 } // namespace glue 700 } // namespace glue
699 } // namespace o3d 701 } // namespace o3d
OLDNEW
« no previous file with comments | « plugin/mac/o3d_layer.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698