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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 10815070: Support copying a partial rectangle region from the compositing surface on Aura and GTK. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 8 years, 5 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 439
440 GetInputMethod()->OnCaretBoundsChanged(this); 440 GetInputMethod()->OnCaretBoundsChanged(this);
441 } 441 }
442 442
443 BackingStore* RenderWidgetHostViewAura::AllocBackingStore( 443 BackingStore* RenderWidgetHostViewAura::AllocBackingStore(
444 const gfx::Size& size) { 444 const gfx::Size& size) {
445 return new BackingStoreAura(host_, size); 445 return new BackingStoreAura(host_, size);
446 } 446 }
447 447
448 void RenderWidgetHostViewAura::CopyFromCompositingSurface( 448 void RenderWidgetHostViewAura::CopyFromCompositingSurface(
449 const gfx::Size& size, 449 const gfx::Rect& src_subrect,
450 const gfx::Size& dst_size,
450 const base::Callback<void(bool)>& callback, 451 const base::Callback<void(bool)>& callback,
451 skia::PlatformCanvas* output) { 452 skia::PlatformCanvas* output) {
452 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); 453 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false));
453 ui::Compositor* compositor = GetCompositor(); 454 ui::Compositor* compositor = GetCompositor();
454 if (!compositor) 455 if (!compositor)
455 return; 456 return;
456 457
457 std::map<uint64, scoped_refptr<ui::Texture> >::iterator it = 458 std::map<uint64, scoped_refptr<ui::Texture> >::iterator it =
458 image_transport_clients_.find(current_surface_); 459 image_transport_clients_.find(current_surface_);
459 if (it == image_transport_clients_.end()) 460 if (it == image_transport_clients_.end())
460 return; 461 return;
461 462
462 ui::Texture* container = it->second; 463 ui::Texture* container = it->second;
463 DCHECK(container); 464 DCHECK(container);
464 465
465 gfx::Size size_in_pixel = ConvertSizeToPixel(this, size); 466 gfx::Size dst_size_in_pixel = ConvertSizeToPixel(this, dst_size);
466 if (!output->initialize( 467 if (!output->initialize(
467 size_in_pixel.width(), size_in_pixel.height(), true)) 468 dst_size_in_pixel.width(), dst_size_in_pixel.height(), true))
468 return; 469 return;
469 470
470 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 471 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
471 GLHelper* gl_helper = factory->GetGLHelper(compositor); 472 GLHelper* gl_helper = factory->GetGLHelper(compositor);
472 if (!gl_helper) 473 if (!gl_helper)
473 return; 474 return;
474 475
475 unsigned char* addr = static_cast<unsigned char*>( 476 unsigned char* addr = static_cast<unsigned char*>(
476 output->getTopDevice()->accessBitmap(true).getPixels()); 477 output->getTopDevice()->accessBitmap(true).getPixels());
477 scoped_callback_runner.Release(); 478 scoped_callback_runner.Release();
479 gfx::Rect src_subrect_in_pixel = ConvertRectToPixel(this, src_subrect);
478 gl_helper->CopyTextureTo(container->texture_id(), 480 gl_helper->CopyTextureTo(container->texture_id(),
479 container->size(), 481 container->size(),
480 size_in_pixel, 482 src_subrect_in_pixel,
483 dst_size_in_pixel,
481 addr, 484 addr,
482 callback); 485 callback);
483 } 486 }
484 487
485 void RenderWidgetHostViewAura::OnAcceleratedCompositingStateChange() { 488 void RenderWidgetHostViewAura::OnAcceleratedCompositingStateChange() {
486 // Delay processing the state change until we either get a software frame if 489 // Delay processing the state change until we either get a software frame if
487 // switching to software mode or receive a buffers swapped notification 490 // switching to software mode or receive a buffers swapped notification
488 // if switching to accelerated mode. 491 // if switching to accelerated mode.
489 // Sometimes (e.g. on a page load) the renderer will spuriously disable then 492 // Sometimes (e.g. on a page load) the renderer will spuriously disable then
490 // re-enable accelerated compositing, causing us to flash. 493 // re-enable accelerated compositing, causing us to flash.
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 RenderWidgetHost* widget) { 1497 RenderWidgetHost* widget) {
1495 return new RenderWidgetHostViewAura(widget); 1498 return new RenderWidgetHostViewAura(widget);
1496 } 1499 }
1497 1500
1498 // static 1501 // static
1499 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 1502 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
1500 GetScreenInfoForWindow(results, NULL); 1503 GetScreenInfoForWindow(results, NULL);
1501 } 1504 }
1502 1505
1503 } // namespace content 1506 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698