Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 503 unsigned char* addr = static_cast<unsigned char*>( | 503 unsigned char* addr = static_cast<unsigned char*>( |
| 504 output->getTopDevice()->accessBitmap(true).getPixels()); | 504 output->getTopDevice()->accessBitmap(true).getPixels()); |
| 505 scoped_callback_runner.Release(); | 505 scoped_callback_runner.Release(); |
| 506 // Wrap the callback with an internal handler so that we can inject our | 506 // Wrap the callback with an internal handler so that we can inject our |
| 507 // own completion handlers (where we can call AdjustSurfaceProtection). | 507 // own completion handlers (where we can call AdjustSurfaceProtection). |
| 508 base::Callback<void(bool)> wrapper_callback = base::Bind( | 508 base::Callback<void(bool)> wrapper_callback = base::Bind( |
| 509 &RenderWidgetHostViewAura::CopyFromCompositingSurfaceFinished, | 509 &RenderWidgetHostViewAura::CopyFromCompositingSurfaceFinished, |
| 510 AsWeakPtr(), | 510 AsWeakPtr(), |
| 511 callback); | 511 callback); |
| 512 pending_thumbnail_tasks_.push_back(callback); | 512 pending_thumbnail_tasks_.push_back(callback); |
| 513 gfx::Rect src_subrect_in_pixel = ConvertRectToPixel(this, src_subrect); | 513 |
| 514 // Convert |src_subrect| from the views coordinate (upper-left origin) into | |
| 515 // the OpenGL coordinate (lower-left origin). | |
| 516 gfx::Rect src_subrect_in_gl = src_subrect; | |
| 517 src_subrect_in_gl.set_y( | |
| 518 GetViewBounds().height() - src_subrect.y() - src_subrect.height()); | |
|
Nico
2012/07/27 23:41:24
- src_subrect.bottom() is a bit shorter and does t
mazda
2012/07/28 00:31:44
Done.
Scaling is done by ConvertRectToPixel below
| |
| 519 | |
| 520 gfx::Rect src_subrect_in_pixel = ConvertRectToPixel(this, src_subrect_in_gl); | |
| 514 gl_helper->CopyTextureTo(container->texture_id(), | 521 gl_helper->CopyTextureTo(container->texture_id(), |
| 515 container->size(), | 522 container->size(), |
| 516 src_subrect_in_pixel, | 523 src_subrect_in_pixel, |
| 517 dst_size_in_pixel, | 524 dst_size_in_pixel, |
| 518 addr, | 525 addr, |
| 519 wrapper_callback); | 526 wrapper_callback); |
| 520 } | 527 } |
| 521 | 528 |
| 522 void RenderWidgetHostViewAura::OnAcceleratedCompositingStateChange() { | 529 void RenderWidgetHostViewAura::OnAcceleratedCompositingStateChange() { |
| 523 // Delay processing the state change until we either get a software frame if | 530 // Delay processing the state change until we either get a software frame if |
| (...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1642 RenderWidgetHost* widget) { | 1649 RenderWidgetHost* widget) { |
| 1643 return new RenderWidgetHostViewAura(widget); | 1650 return new RenderWidgetHostViewAura(widget); |
| 1644 } | 1651 } |
| 1645 | 1652 |
| 1646 // static | 1653 // static |
| 1647 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 1654 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 1648 GetScreenInfoForWindow(results, NULL); | 1655 GetScreenInfoForWindow(results, NULL); |
| 1649 } | 1656 } |
| 1650 | 1657 |
| 1651 } // namespace content | 1658 } // namespace content |
| OLD | NEW |