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

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

Issue 11031055: Introduce PlatformBitmap, which is a minimal helper class that wraps an SkBitmap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 627
628 BackingStore* RenderWidgetHostViewAura::AllocBackingStore( 628 BackingStore* RenderWidgetHostViewAura::AllocBackingStore(
629 const gfx::Size& size) { 629 const gfx::Size& size) {
630 return new BackingStoreAura(host_, size); 630 return new BackingStoreAura(host_, size);
631 } 631 }
632 632
633 void RenderWidgetHostViewAura::CopyFromCompositingSurface( 633 void RenderWidgetHostViewAura::CopyFromCompositingSurface(
634 const gfx::Rect& src_subrect, 634 const gfx::Rect& src_subrect,
635 const gfx::Size& dst_size, 635 const gfx::Size& dst_size,
636 const base::Callback<void(bool)>& callback, 636 const base::Callback<void(bool)>& callback,
637 skia::PlatformCanvas* output) { 637 skia::PlatformBitmap* output) {
638 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); 638 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false));
639 639
640 std::map<uint64, scoped_refptr<ui::Texture> >::iterator it = 640 std::map<uint64, scoped_refptr<ui::Texture> >::iterator it =
641 image_transport_clients_.find(current_surface_); 641 image_transport_clients_.find(current_surface_);
642 if (it == image_transport_clients_.end()) 642 if (it == image_transport_clients_.end())
643 return; 643 return;
644 644
645 ui::Texture* container = it->second; 645 ui::Texture* container = it->second;
646 DCHECK(container); 646 DCHECK(container);
647 647
648 gfx::Size dst_size_in_pixel = ConvertSizeToPixel(this, dst_size); 648 gfx::Size dst_size_in_pixel = ConvertSizeToPixel(this, dst_size);
649 if (!output->initialize( 649 if (!output->Allocate(
650 dst_size_in_pixel.width(), dst_size_in_pixel.height(), true)) 650 dst_size_in_pixel.width(), dst_size_in_pixel.height(), true))
651 return; 651 return;
652 652
653 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 653 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
654 GLHelper* gl_helper = factory->GetGLHelper(); 654 GLHelper* gl_helper = factory->GetGLHelper();
655 if (!gl_helper) 655 if (!gl_helper)
656 return; 656 return;
657 657
658 unsigned char* addr = static_cast<unsigned char*>( 658 unsigned char* addr = static_cast<unsigned char*>(
659 output->getTopDevice()->accessBitmap(true).getPixels()); 659 output->GetBitmap().getPixels());
660 scoped_callback_runner.Release(); 660 scoped_callback_runner.Release();
661 // Wrap the callback with an internal handler so that we can inject our 661 // Wrap the callback with an internal handler so that we can inject our
662 // own completion handlers (where we can call AdjustSurfaceProtection). 662 // own completion handlers (where we can call AdjustSurfaceProtection).
663 base::Callback<void(bool)> wrapper_callback = base::Bind( 663 base::Callback<void(bool)> wrapper_callback = base::Bind(
664 &RenderWidgetHostViewAura::CopyFromCompositingSurfaceFinished, 664 &RenderWidgetHostViewAura::CopyFromCompositingSurfaceFinished,
665 AsWeakPtr(), 665 AsWeakPtr(),
666 callback); 666 callback);
667 pending_thumbnail_tasks_.push_back(callback); 667 pending_thumbnail_tasks_.push_back(callback);
668 668
669 // Convert |src_subrect| from the views coordinate (upper-left origin) into 669 // Convert |src_subrect| from the views coordinate (upper-left origin) into
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 RenderWidgetHost* widget) { 1874 RenderWidgetHost* widget) {
1875 return new RenderWidgetHostViewAura(widget); 1875 return new RenderWidgetHostViewAura(widget);
1876 } 1876 }
1877 1877
1878 // static 1878 // static
1879 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 1879 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
1880 GetScreenInfoForWindow(results, NULL); 1880 GetScreenInfoForWindow(results, NULL);
1881 } 1881 }
1882 1882
1883 } // namespace content 1883 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698