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/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 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1043 } | 1043 } |
| 1044 | 1044 |
| 1045 BackingStore* RenderWidgetHostViewAura::AllocBackingStore( | 1045 BackingStore* RenderWidgetHostViewAura::AllocBackingStore( |
| 1046 const gfx::Size& size) { | 1046 const gfx::Size& size) { |
| 1047 return new BackingStoreAura(host_, size); | 1047 return new BackingStoreAura(host_, size); |
| 1048 } | 1048 } |
| 1049 | 1049 |
| 1050 void RenderWidgetHostViewAura::CopyFromCompositingSurface( | 1050 void RenderWidgetHostViewAura::CopyFromCompositingSurface( |
| 1051 const gfx::Rect& src_subrect, | 1051 const gfx::Rect& src_subrect, |
| 1052 const gfx::Size& dst_size, | 1052 const gfx::Size& dst_size, |
| 1053 const base::Callback<void(bool, const SkBitmap&)>& callback) { | 1053 const base::Callback<void(bool, const SkBitmap&)>& callback, |
| 1054 bool readback_config_rgb565) { | |
| 1054 if (!CanCopyToBitmap()) { | 1055 if (!CanCopyToBitmap()) { |
| 1055 callback.Run(false, SkBitmap()); | 1056 callback.Run(false, SkBitmap()); |
| 1056 return; | 1057 return; |
| 1057 } | 1058 } |
| 1058 | 1059 |
| 1059 const gfx::Size& dst_size_in_pixel = ConvertViewSizeToPixel(this, dst_size); | 1060 const gfx::Size& dst_size_in_pixel = ConvertViewSizeToPixel(this, dst_size); |
| 1060 scoped_ptr<cc::CopyOutputRequest> request = | 1061 scoped_ptr<cc::CopyOutputRequest> request = |
| 1061 cc::CopyOutputRequest::CreateRequest(base::Bind( | 1062 cc::CopyOutputRequest::CreateRequest(base::Bind( |
| 1062 &RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult, | 1063 &RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult, |
| 1063 dst_size_in_pixel, | 1064 dst_size_in_pixel, |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1802 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult( | 1803 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult( |
| 1803 const gfx::Size& dst_size_in_pixel, | 1804 const gfx::Size& dst_size_in_pixel, |
| 1804 const base::Callback<void(bool, const SkBitmap&)>& callback, | 1805 const base::Callback<void(bool, const SkBitmap&)>& callback, |
| 1805 scoped_ptr<cc::CopyOutputResult> result) { | 1806 scoped_ptr<cc::CopyOutputResult> result) { |
| 1806 if (result->IsEmpty() || result->size().IsEmpty()) { | 1807 if (result->IsEmpty() || result->size().IsEmpty()) { |
| 1807 callback.Run(false, SkBitmap()); | 1808 callback.Run(false, SkBitmap()); |
| 1808 return; | 1809 return; |
| 1809 } | 1810 } |
| 1810 | 1811 |
| 1811 if (result->HasTexture()) { | 1812 if (result->HasTexture()) { |
| 1812 PrepareTextureCopyOutputResult(dst_size_in_pixel, callback, result.Pass()); | 1813 PrepareTextureCopyOutputResult(dst_size_in_pixel, false, |
|
piman
2014/01/09 18:12:15
Well, it sounds like readback_config_rgb565 should
sivag
2014/01/10 12:20:01
Do you mean add this support to CopyFromCompositin
piman
2014/01/10 22:38:33
Right... in CopyFromCompositingSurface the paramet
sivag
2014/01/15 15:24:13
Done.
| |
| 1814 callback, | |
| 1815 result.Pass()); | |
| 1813 return; | 1816 return; |
| 1814 } | 1817 } |
| 1815 | 1818 |
| 1816 DCHECK(result->HasBitmap()); | 1819 DCHECK(result->HasBitmap()); |
| 1817 PrepareBitmapCopyOutputResult(dst_size_in_pixel, callback, result.Pass()); | 1820 PrepareBitmapCopyOutputResult(dst_size_in_pixel, callback, result.Pass()); |
| 1818 } | 1821 } |
| 1819 | 1822 |
| 1820 static void CopyFromCompositingSurfaceFinished( | 1823 static void CopyFromCompositingSurfaceFinished( |
| 1821 const base::Callback<void(bool, const SkBitmap&)>& callback, | 1824 const base::Callback<void(bool, const SkBitmap&)>& callback, |
| 1822 scoped_ptr<cc::SingleReleaseCallback> release_callback, | 1825 scoped_ptr<cc::SingleReleaseCallback> release_callback, |
| 1823 scoped_ptr<SkBitmap> bitmap, | 1826 scoped_ptr<SkBitmap> bitmap, |
| 1824 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock, | 1827 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock, |
| 1825 bool result) { | 1828 bool result) { |
| 1826 bitmap_pixels_lock.reset(); | 1829 bitmap_pixels_lock.reset(); |
| 1827 release_callback->Run(0, false); | 1830 release_callback->Run(0, false); |
| 1828 callback.Run(result, *bitmap); | 1831 callback.Run(result, *bitmap); |
| 1829 } | 1832 } |
| 1830 | 1833 |
| 1831 // static | 1834 // static |
| 1832 void RenderWidgetHostViewAura::PrepareTextureCopyOutputResult( | 1835 void RenderWidgetHostViewAura::PrepareTextureCopyOutputResult( |
| 1833 const gfx::Size& dst_size_in_pixel, | 1836 const gfx::Size& dst_size_in_pixel, |
| 1837 bool readback_config_rgb565, | |
| 1834 const base::Callback<void(bool, const SkBitmap&)>& callback, | 1838 const base::Callback<void(bool, const SkBitmap&)>& callback, |
| 1835 scoped_ptr<cc::CopyOutputResult> result) { | 1839 scoped_ptr<cc::CopyOutputResult> result) { |
| 1836 base::ScopedClosureRunner scoped_callback_runner( | 1840 base::ScopedClosureRunner scoped_callback_runner( |
| 1837 base::Bind(callback, false, SkBitmap())); | 1841 base::Bind(callback, false, SkBitmap())); |
| 1838 | 1842 |
| 1839 DCHECK(result->HasTexture()); | 1843 DCHECK(result->HasTexture()); |
| 1840 if (!result->HasTexture()) | 1844 if (!result->HasTexture()) |
| 1841 return; | 1845 return; |
| 1842 | 1846 |
| 1843 scoped_ptr<SkBitmap> bitmap(new SkBitmap); | 1847 scoped_ptr<SkBitmap> bitmap(new SkBitmap); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 1864 return; | 1868 return; |
| 1865 | 1869 |
| 1866 ignore_result(scoped_callback_runner.Release()); | 1870 ignore_result(scoped_callback_runner.Release()); |
| 1867 | 1871 |
| 1868 gl_helper->CropScaleReadbackAndCleanMailbox( | 1872 gl_helper->CropScaleReadbackAndCleanMailbox( |
| 1869 texture_mailbox.name(), | 1873 texture_mailbox.name(), |
| 1870 texture_mailbox.sync_point(), | 1874 texture_mailbox.sync_point(), |
| 1871 result->size(), | 1875 result->size(), |
| 1872 gfx::Rect(result->size()), | 1876 gfx::Rect(result->size()), |
| 1873 dst_size_in_pixel, | 1877 dst_size_in_pixel, |
| 1878 readback_config_rgb565, | |
| 1874 pixels, | 1879 pixels, |
| 1875 base::Bind(&CopyFromCompositingSurfaceFinished, | 1880 base::Bind(&CopyFromCompositingSurfaceFinished, |
| 1876 callback, | 1881 callback, |
| 1877 base::Passed(&release_callback), | 1882 base::Passed(&release_callback), |
| 1878 base::Passed(&bitmap), | 1883 base::Passed(&bitmap), |
| 1879 base::Passed(&bitmap_pixels_lock))); | 1884 base::Passed(&bitmap_pixels_lock))); |
| 1880 } | 1885 } |
| 1881 | 1886 |
| 1882 // static | 1887 // static |
| 1883 void RenderWidgetHostViewAura::PrepareBitmapCopyOutputResult( | 1888 void RenderWidgetHostViewAura::PrepareBitmapCopyOutputResult( |
| (...skipping 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3502 RenderWidgetHost* widget) { | 3507 RenderWidgetHost* widget) { |
| 3503 return new RenderWidgetHostViewAura(widget); | 3508 return new RenderWidgetHostViewAura(widget); |
| 3504 } | 3509 } |
| 3505 | 3510 |
| 3506 // static | 3511 // static |
| 3507 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3512 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 3508 GetScreenInfoForWindow(results, NULL); | 3513 GetScreenInfoForWindow(results, NULL); |
| 3509 } | 3514 } |
| 3510 | 3515 |
| 3511 } // namespace content | 3516 } // namespace content |
| OLD | NEW |