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/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1808 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult( | 1808 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult( |
1809 const gfx::Size& dst_size_in_pixel, | 1809 const gfx::Size& dst_size_in_pixel, |
1810 const base::Callback<void(bool, const SkBitmap&)>& callback, | 1810 const base::Callback<void(bool, const SkBitmap&)>& callback, |
1811 scoped_ptr<cc::CopyOutputResult> result) { | 1811 scoped_ptr<cc::CopyOutputResult> result) { |
1812 if (result->IsEmpty() || result->size().IsEmpty()) { | 1812 if (result->IsEmpty() || result->size().IsEmpty()) { |
1813 callback.Run(false, SkBitmap()); | 1813 callback.Run(false, SkBitmap()); |
1814 return; | 1814 return; |
1815 } | 1815 } |
1816 | 1816 |
1817 if (result->HasTexture()) { | 1817 if (result->HasTexture()) { |
1818 PrepareTextureCopyOutputResult(dst_size_in_pixel, callback, result.Pass()); | 1818 PrepareTextureCopyOutputResult(dst_size_in_pixel, false, |
| 1819 callback, |
| 1820 result.Pass()); |
1819 return; | 1821 return; |
1820 } | 1822 } |
1821 | 1823 |
1822 DCHECK(result->HasBitmap()); | 1824 DCHECK(result->HasBitmap()); |
1823 PrepareBitmapCopyOutputResult(dst_size_in_pixel, callback, result.Pass()); | 1825 PrepareBitmapCopyOutputResult(dst_size_in_pixel, callback, result.Pass()); |
1824 } | 1826 } |
1825 | 1827 |
1826 static void CopyFromCompositingSurfaceFinished( | 1828 static void CopyFromCompositingSurfaceFinished( |
1827 const base::Callback<void(bool, const SkBitmap&)>& callback, | 1829 const base::Callback<void(bool, const SkBitmap&)>& callback, |
1828 scoped_ptr<cc::SingleReleaseCallback> release_callback, | 1830 scoped_ptr<cc::SingleReleaseCallback> release_callback, |
1829 scoped_ptr<SkBitmap> bitmap, | 1831 scoped_ptr<SkBitmap> bitmap, |
1830 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock, | 1832 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock, |
1831 bool result) { | 1833 bool result) { |
1832 bitmap_pixels_lock.reset(); | 1834 bitmap_pixels_lock.reset(); |
1833 release_callback->Run(0, false); | 1835 release_callback->Run(0, false); |
1834 callback.Run(result, *bitmap); | 1836 callback.Run(result, *bitmap); |
1835 } | 1837 } |
1836 | 1838 |
1837 // static | 1839 // static |
1838 void RenderWidgetHostViewAura::PrepareTextureCopyOutputResult( | 1840 void RenderWidgetHostViewAura::PrepareTextureCopyOutputResult( |
1839 const gfx::Size& dst_size_in_pixel, | 1841 const gfx::Size& dst_size_in_pixel, |
| 1842 bool readback_config_rgb565, |
1840 const base::Callback<void(bool, const SkBitmap&)>& callback, | 1843 const base::Callback<void(bool, const SkBitmap&)>& callback, |
1841 scoped_ptr<cc::CopyOutputResult> result) { | 1844 scoped_ptr<cc::CopyOutputResult> result) { |
1842 base::ScopedClosureRunner scoped_callback_runner( | 1845 base::ScopedClosureRunner scoped_callback_runner( |
1843 base::Bind(callback, false, SkBitmap())); | 1846 base::Bind(callback, false, SkBitmap())); |
1844 | 1847 |
1845 DCHECK(result->HasTexture()); | 1848 DCHECK(result->HasTexture()); |
1846 if (!result->HasTexture()) | 1849 if (!result->HasTexture()) |
1847 return; | 1850 return; |
1848 | 1851 |
1849 scoped_ptr<SkBitmap> bitmap(new SkBitmap); | 1852 scoped_ptr<SkBitmap> bitmap(new SkBitmap); |
(...skipping 20 matching lines...) Expand all Loading... |
1870 return; | 1873 return; |
1871 | 1874 |
1872 ignore_result(scoped_callback_runner.Release()); | 1875 ignore_result(scoped_callback_runner.Release()); |
1873 | 1876 |
1874 gl_helper->CropScaleReadbackAndCleanMailbox( | 1877 gl_helper->CropScaleReadbackAndCleanMailbox( |
1875 texture_mailbox.name(), | 1878 texture_mailbox.name(), |
1876 texture_mailbox.sync_point(), | 1879 texture_mailbox.sync_point(), |
1877 result->size(), | 1880 result->size(), |
1878 gfx::Rect(result->size()), | 1881 gfx::Rect(result->size()), |
1879 dst_size_in_pixel, | 1882 dst_size_in_pixel, |
| 1883 readback_config_rgb565, |
1880 pixels, | 1884 pixels, |
1881 base::Bind(&CopyFromCompositingSurfaceFinished, | 1885 base::Bind(&CopyFromCompositingSurfaceFinished, |
1882 callback, | 1886 callback, |
1883 base::Passed(&release_callback), | 1887 base::Passed(&release_callback), |
1884 base::Passed(&bitmap), | 1888 base::Passed(&bitmap), |
1885 base::Passed(&bitmap_pixels_lock))); | 1889 base::Passed(&bitmap_pixels_lock))); |
1886 } | 1890 } |
1887 | 1891 |
1888 // static | 1892 // static |
1889 void RenderWidgetHostViewAura::PrepareBitmapCopyOutputResult( | 1893 void RenderWidgetHostViewAura::PrepareBitmapCopyOutputResult( |
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3486 RenderWidgetHost* widget) { | 3490 RenderWidgetHost* widget) { |
3487 return new RenderWidgetHostViewAura(widget); | 3491 return new RenderWidgetHostViewAura(widget); |
3488 } | 3492 } |
3489 | 3493 |
3490 // static | 3494 // static |
3491 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3495 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
3492 GetScreenInfoForWindow(results, NULL); | 3496 GetScreenInfoForWindow(results, NULL); |
3493 } | 3497 } |
3494 | 3498 |
3495 } // namespace content | 3499 } // namespace content |
OLD | NEW |