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

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

Issue 88033002: Add RGB565 Texture readback support in gl_helper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes done as per review comments (WIP: gl_helper_unittests) Created 6 years, 11 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
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/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 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 } 1049 }
1050 1050
1051 BackingStore* RenderWidgetHostViewAura::AllocBackingStore( 1051 BackingStore* RenderWidgetHostViewAura::AllocBackingStore(
1052 const gfx::Size& size) { 1052 const gfx::Size& size) {
1053 return new BackingStoreAura(host_, size); 1053 return new BackingStoreAura(host_, size);
1054 } 1054 }
1055 1055
1056 void RenderWidgetHostViewAura::CopyFromCompositingSurface( 1056 void RenderWidgetHostViewAura::CopyFromCompositingSurface(
1057 const gfx::Rect& src_subrect, 1057 const gfx::Rect& src_subrect,
1058 const gfx::Size& dst_size, 1058 const gfx::Size& dst_size,
1059 const base::Callback<void(bool, const SkBitmap&)>& callback) { 1059 const base::Callback<void(bool, const SkBitmap&)>& callback,
1060 bool readback_config_rgb565) {
1060 if (!CanCopyToBitmap()) { 1061 if (!CanCopyToBitmap()) {
1061 callback.Run(false, SkBitmap()); 1062 callback.Run(false, SkBitmap());
1062 return; 1063 return;
1063 } 1064 }
1064 1065
1065 const gfx::Size& dst_size_in_pixel = ConvertViewSizeToPixel(this, dst_size); 1066 const gfx::Size& dst_size_in_pixel = ConvertViewSizeToPixel(this, dst_size);
1066 scoped_ptr<cc::CopyOutputRequest> request = 1067 scoped_ptr<cc::CopyOutputRequest> request =
1067 cc::CopyOutputRequest::CreateRequest(base::Bind( 1068 cc::CopyOutputRequest::CreateRequest(base::Bind(
1068 &RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult, 1069 &RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult,
1069 dst_size_in_pixel, 1070 dst_size_in_pixel,
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult( 1811 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult(
1811 const gfx::Size& dst_size_in_pixel, 1812 const gfx::Size& dst_size_in_pixel,
1812 const base::Callback<void(bool, const SkBitmap&)>& callback, 1813 const base::Callback<void(bool, const SkBitmap&)>& callback,
1813 scoped_ptr<cc::CopyOutputResult> result) { 1814 scoped_ptr<cc::CopyOutputResult> result) {
1814 if (result->IsEmpty() || result->size().IsEmpty()) { 1815 if (result->IsEmpty() || result->size().IsEmpty()) {
1815 callback.Run(false, SkBitmap()); 1816 callback.Run(false, SkBitmap());
1816 return; 1817 return;
1817 } 1818 }
1818 1819
1819 if (result->HasTexture()) { 1820 if (result->HasTexture()) {
1820 PrepareTextureCopyOutputResult(dst_size_in_pixel, callback, result.Pass()); 1821 PrepareTextureCopyOutputResult(dst_size_in_pixel, false,
1822 callback,
1823 result.Pass());
1821 return; 1824 return;
1822 } 1825 }
1823 1826
1824 DCHECK(result->HasBitmap()); 1827 DCHECK(result->HasBitmap());
1825 PrepareBitmapCopyOutputResult(dst_size_in_pixel, callback, result.Pass()); 1828 PrepareBitmapCopyOutputResult(dst_size_in_pixel, callback, result.Pass());
1826 } 1829 }
1827 1830
1828 static void CopyFromCompositingSurfaceFinished( 1831 static void CopyFromCompositingSurfaceFinished(
1829 const base::Callback<void(bool, const SkBitmap&)>& callback, 1832 const base::Callback<void(bool, const SkBitmap&)>& callback,
1830 scoped_ptr<cc::SingleReleaseCallback> release_callback, 1833 scoped_ptr<cc::SingleReleaseCallback> release_callback,
1831 scoped_ptr<SkBitmap> bitmap, 1834 scoped_ptr<SkBitmap> bitmap,
1832 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock, 1835 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock,
1833 bool result) { 1836 bool result) {
1834 bitmap_pixels_lock.reset(); 1837 bitmap_pixels_lock.reset();
1835 release_callback->Run(0, false); 1838 release_callback->Run(0, false);
1836 callback.Run(result, *bitmap); 1839 callback.Run(result, *bitmap);
1837 } 1840 }
1838 1841
1839 // static 1842 // static
1840 void RenderWidgetHostViewAura::PrepareTextureCopyOutputResult( 1843 void RenderWidgetHostViewAura::PrepareTextureCopyOutputResult(
1841 const gfx::Size& dst_size_in_pixel, 1844 const gfx::Size& dst_size_in_pixel,
1845 bool readback_config_rgb565,
1842 const base::Callback<void(bool, const SkBitmap&)>& callback, 1846 const base::Callback<void(bool, const SkBitmap&)>& callback,
1843 scoped_ptr<cc::CopyOutputResult> result) { 1847 scoped_ptr<cc::CopyOutputResult> result) {
1844 base::ScopedClosureRunner scoped_callback_runner( 1848 base::ScopedClosureRunner scoped_callback_runner(
1845 base::Bind(callback, false, SkBitmap())); 1849 base::Bind(callback, false, SkBitmap()));
1846 1850
1847 DCHECK(result->HasTexture()); 1851 DCHECK(result->HasTexture());
1848 if (!result->HasTexture()) 1852 if (!result->HasTexture())
1849 return; 1853 return;
1850 1854
1851 scoped_ptr<SkBitmap> bitmap(new SkBitmap); 1855 scoped_ptr<SkBitmap> bitmap(new SkBitmap);
(...skipping 20 matching lines...) Expand all
1872 return; 1876 return;
1873 1877
1874 ignore_result(scoped_callback_runner.Release()); 1878 ignore_result(scoped_callback_runner.Release());
1875 1879
1876 gl_helper->CropScaleReadbackAndCleanMailbox( 1880 gl_helper->CropScaleReadbackAndCleanMailbox(
1877 texture_mailbox.name(), 1881 texture_mailbox.name(),
1878 texture_mailbox.sync_point(), 1882 texture_mailbox.sync_point(),
1879 result->size(), 1883 result->size(),
1880 gfx::Rect(result->size()), 1884 gfx::Rect(result->size()),
1881 dst_size_in_pixel, 1885 dst_size_in_pixel,
1886 readback_config_rgb565,
1882 pixels, 1887 pixels,
1883 base::Bind(&CopyFromCompositingSurfaceFinished, 1888 base::Bind(&CopyFromCompositingSurfaceFinished,
1884 callback, 1889 callback,
1885 base::Passed(&release_callback), 1890 base::Passed(&release_callback),
1886 base::Passed(&bitmap), 1891 base::Passed(&bitmap),
1887 base::Passed(&bitmap_pixels_lock))); 1892 base::Passed(&bitmap_pixels_lock)));
1888 } 1893 }
1889 1894
1890 // static 1895 // static
1891 void RenderWidgetHostViewAura::PrepareBitmapCopyOutputResult( 1896 void RenderWidgetHostViewAura::PrepareBitmapCopyOutputResult(
(...skipping 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after
3539 RenderWidgetHost* widget) { 3544 RenderWidgetHost* widget) {
3540 return new RenderWidgetHostViewAura(widget); 3545 return new RenderWidgetHostViewAura(widget);
3541 } 3546 }
3542 3547
3543 // static 3548 // static
3544 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 3549 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
3545 GetScreenInfoForWindow(results, NULL); 3550 GetScreenInfoForWindow(results, NULL);
3546 } 3551 }
3547 3552
3548 } // namespace content 3553 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698