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 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1803 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult( | 1803 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult( |
1804 const gfx::Size& dst_size_in_pixel, | 1804 const gfx::Size& dst_size_in_pixel, |
1805 const base::Callback<void(bool, const SkBitmap&)>& callback, | 1805 const base::Callback<void(bool, const SkBitmap&)>& callback, |
1806 scoped_ptr<cc::CopyOutputResult> result) { | 1806 scoped_ptr<cc::CopyOutputResult> result) { |
1807 if (result->IsEmpty() || result->size().IsEmpty()) { | 1807 if (result->IsEmpty() || result->size().IsEmpty()) { |
1808 callback.Run(false, SkBitmap()); | 1808 callback.Run(false, SkBitmap()); |
1809 return; | 1809 return; |
1810 } | 1810 } |
1811 | 1811 |
1812 if (result->HasTexture()) { | 1812 if (result->HasTexture()) { |
1813 PrepareTextureCopyOutputResult(dst_size_in_pixel, callback, result.Pass()); | 1813 PrepareTextureCopyOutputResult(dst_size_in_pixel, false, |
| 1814 callback, |
| 1815 result.Pass()); |
1814 return; | 1816 return; |
1815 } | 1817 } |
1816 | 1818 |
1817 DCHECK(result->HasBitmap()); | 1819 DCHECK(result->HasBitmap()); |
1818 PrepareBitmapCopyOutputResult(dst_size_in_pixel, callback, result.Pass()); | 1820 PrepareBitmapCopyOutputResult(dst_size_in_pixel, callback, result.Pass()); |
1819 } | 1821 } |
1820 | 1822 |
1821 static void CopyFromCompositingSurfaceFinished( | 1823 static void CopyFromCompositingSurfaceFinished( |
1822 const base::Callback<void(bool, const SkBitmap&)>& callback, | 1824 const base::Callback<void(bool, const SkBitmap&)>& callback, |
1823 scoped_ptr<cc::SingleReleaseCallback> release_callback, | 1825 scoped_ptr<cc::SingleReleaseCallback> release_callback, |
1824 scoped_ptr<SkBitmap> bitmap, | 1826 scoped_ptr<SkBitmap> bitmap, |
1825 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock, | 1827 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock, |
1826 bool result) { | 1828 bool result) { |
1827 bitmap_pixels_lock.reset(); | 1829 bitmap_pixels_lock.reset(); |
1828 release_callback->Run(0, false); | 1830 release_callback->Run(0, false); |
1829 callback.Run(result, *bitmap); | 1831 callback.Run(result, *bitmap); |
1830 } | 1832 } |
1831 | 1833 |
1832 // static | 1834 // static |
1833 void RenderWidgetHostViewAura::PrepareTextureCopyOutputResult( | 1835 void RenderWidgetHostViewAura::PrepareTextureCopyOutputResult( |
1834 const gfx::Size& dst_size_in_pixel, | 1836 const gfx::Size& dst_size_in_pixel, |
| 1837 bool readback_config_rgb565, |
1835 const base::Callback<void(bool, const SkBitmap&)>& callback, | 1838 const base::Callback<void(bool, const SkBitmap&)>& callback, |
1836 scoped_ptr<cc::CopyOutputResult> result) { | 1839 scoped_ptr<cc::CopyOutputResult> result) { |
1837 base::ScopedClosureRunner scoped_callback_runner( | 1840 base::ScopedClosureRunner scoped_callback_runner( |
1838 base::Bind(callback, false, SkBitmap())); | 1841 base::Bind(callback, false, SkBitmap())); |
1839 | 1842 |
1840 DCHECK(result->HasTexture()); | 1843 DCHECK(result->HasTexture()); |
1841 if (!result->HasTexture()) | 1844 if (!result->HasTexture()) |
1842 return; | 1845 return; |
1843 | 1846 |
1844 scoped_ptr<SkBitmap> bitmap(new SkBitmap); | 1847 scoped_ptr<SkBitmap> bitmap(new SkBitmap); |
(...skipping 20 matching lines...) Expand all Loading... |
1865 return; | 1868 return; |
1866 | 1869 |
1867 ignore_result(scoped_callback_runner.Release()); | 1870 ignore_result(scoped_callback_runner.Release()); |
1868 | 1871 |
1869 gl_helper->CropScaleReadbackAndCleanMailbox( | 1872 gl_helper->CropScaleReadbackAndCleanMailbox( |
1870 texture_mailbox.name(), | 1873 texture_mailbox.name(), |
1871 texture_mailbox.sync_point(), | 1874 texture_mailbox.sync_point(), |
1872 result->size(), | 1875 result->size(), |
1873 gfx::Rect(result->size()), | 1876 gfx::Rect(result->size()), |
1874 dst_size_in_pixel, | 1877 dst_size_in_pixel, |
| 1878 readback_config_rgb565, |
1875 pixels, | 1879 pixels, |
1876 base::Bind(&CopyFromCompositingSurfaceFinished, | 1880 base::Bind(&CopyFromCompositingSurfaceFinished, |
1877 callback, | 1881 callback, |
1878 base::Passed(&release_callback), | 1882 base::Passed(&release_callback), |
1879 base::Passed(&bitmap), | 1883 base::Passed(&bitmap), |
1880 base::Passed(&bitmap_pixels_lock))); | 1884 base::Passed(&bitmap_pixels_lock))); |
1881 } | 1885 } |
1882 | 1886 |
1883 // static | 1887 // static |
1884 void RenderWidgetHostViewAura::PrepareBitmapCopyOutputResult( | 1888 void RenderWidgetHostViewAura::PrepareBitmapCopyOutputResult( |
(...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3475 RenderWidgetHost* widget) { | 3479 RenderWidgetHost* widget) { |
3476 return new RenderWidgetHostViewAura(widget); | 3480 return new RenderWidgetHostViewAura(widget); |
3477 } | 3481 } |
3478 | 3482 |
3479 // static | 3483 // static |
3480 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3484 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
3481 GetScreenInfoForWindow(results, NULL); | 3485 GetScreenInfoForWindow(results, NULL); |
3482 } | 3486 } |
3483 | 3487 |
3484 } // namespace content | 3488 } // namespace content |
OLD | NEW |