| 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 1828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1839 } | 1839 } |
| 1840 | 1840 |
| 1841 if (result->HasTexture()) { | 1841 if (result->HasTexture()) { |
| 1842 PrepareTextureCopyOutputResult(dst_size_in_pixel, config, | 1842 PrepareTextureCopyOutputResult(dst_size_in_pixel, config, |
| 1843 callback, | 1843 callback, |
| 1844 result.Pass()); | 1844 result.Pass()); |
| 1845 return; | 1845 return; |
| 1846 } | 1846 } |
| 1847 | 1847 |
| 1848 DCHECK(result->HasBitmap()); | 1848 DCHECK(result->HasBitmap()); |
| 1849 PrepareBitmapCopyOutputResult(dst_size_in_pixel, callback, result.Pass()); | 1849 PrepareBitmapCopyOutputResult(dst_size_in_pixel, config, callback, |
| 1850 result.Pass()); |
| 1850 } | 1851 } |
| 1851 | 1852 |
| 1852 static void CopyFromCompositingSurfaceFinished( | 1853 static void CopyFromCompositingSurfaceFinished( |
| 1853 const base::Callback<void(bool, const SkBitmap&)>& callback, | 1854 const base::Callback<void(bool, const SkBitmap&)>& callback, |
| 1854 scoped_ptr<cc::SingleReleaseCallback> release_callback, | 1855 scoped_ptr<cc::SingleReleaseCallback> release_callback, |
| 1855 scoped_ptr<SkBitmap> bitmap, | 1856 scoped_ptr<SkBitmap> bitmap, |
| 1856 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock, | 1857 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock, |
| 1857 bool result) { | 1858 bool result) { |
| 1858 bitmap_pixels_lock.reset(); | 1859 bitmap_pixels_lock.reset(); |
| 1859 | 1860 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1872 void RenderWidgetHostViewAura::PrepareTextureCopyOutputResult( | 1873 void RenderWidgetHostViewAura::PrepareTextureCopyOutputResult( |
| 1873 const gfx::Size& dst_size_in_pixel, | 1874 const gfx::Size& dst_size_in_pixel, |
| 1874 const SkBitmap::Config config, | 1875 const SkBitmap::Config config, |
| 1875 const base::Callback<void(bool, const SkBitmap&)>& callback, | 1876 const base::Callback<void(bool, const SkBitmap&)>& callback, |
| 1876 scoped_ptr<cc::CopyOutputResult> result) { | 1877 scoped_ptr<cc::CopyOutputResult> result) { |
| 1877 DCHECK(result->HasTexture()); | 1878 DCHECK(result->HasTexture()); |
| 1878 base::ScopedClosureRunner scoped_callback_runner( | 1879 base::ScopedClosureRunner scoped_callback_runner( |
| 1879 base::Bind(callback, false, SkBitmap())); | 1880 base::Bind(callback, false, SkBitmap())); |
| 1880 | 1881 |
| 1881 scoped_ptr<SkBitmap> bitmap(new SkBitmap); | 1882 scoped_ptr<SkBitmap> bitmap(new SkBitmap); |
| 1882 bitmap->setConfig(SkBitmap::kARGB_8888_Config, | 1883 bitmap->setConfig(config, |
| 1883 dst_size_in_pixel.width(), dst_size_in_pixel.height(), | 1884 dst_size_in_pixel.width(), dst_size_in_pixel.height(), |
| 1884 0, kOpaque_SkAlphaType); | 1885 0, kOpaque_SkAlphaType); |
| 1885 if (!bitmap->allocPixels()) | 1886 if (!bitmap->allocPixels()) |
| 1886 return; | 1887 return; |
| 1887 | 1888 |
| 1888 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 1889 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 1889 GLHelper* gl_helper = factory->GetGLHelper(); | 1890 GLHelper* gl_helper = factory->GetGLHelper(); |
| 1890 if (!gl_helper) | 1891 if (!gl_helper) |
| 1891 return; | 1892 return; |
| 1892 | 1893 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1914 base::Bind(&CopyFromCompositingSurfaceFinished, | 1915 base::Bind(&CopyFromCompositingSurfaceFinished, |
| 1915 callback, | 1916 callback, |
| 1916 base::Passed(&release_callback), | 1917 base::Passed(&release_callback), |
| 1917 base::Passed(&bitmap), | 1918 base::Passed(&bitmap), |
| 1918 base::Passed(&bitmap_pixels_lock))); | 1919 base::Passed(&bitmap_pixels_lock))); |
| 1919 } | 1920 } |
| 1920 | 1921 |
| 1921 // static | 1922 // static |
| 1922 void RenderWidgetHostViewAura::PrepareBitmapCopyOutputResult( | 1923 void RenderWidgetHostViewAura::PrepareBitmapCopyOutputResult( |
| 1923 const gfx::Size& dst_size_in_pixel, | 1924 const gfx::Size& dst_size_in_pixel, |
| 1925 const SkBitmap::Config config, |
| 1924 const base::Callback<void(bool, const SkBitmap&)>& callback, | 1926 const base::Callback<void(bool, const SkBitmap&)>& callback, |
| 1925 scoped_ptr<cc::CopyOutputResult> result) { | 1927 scoped_ptr<cc::CopyOutputResult> result) { |
| 1928 if (config != SkBitmap::kARGB_8888_Config) { |
| 1929 NOTIMPLEMENTED(); |
| 1930 callback.Run(false, SkBitmap()); |
| 1931 return; |
| 1932 } |
| 1926 DCHECK(result->HasBitmap()); | 1933 DCHECK(result->HasBitmap()); |
| 1927 base::ScopedClosureRunner scoped_callback_runner( | 1934 base::ScopedClosureRunner scoped_callback_runner( |
| 1928 base::Bind(callback, false, SkBitmap())); | 1935 base::Bind(callback, false, SkBitmap())); |
| 1929 | 1936 |
| 1930 scoped_ptr<SkBitmap> source = result->TakeBitmap(); | 1937 scoped_ptr<SkBitmap> source = result->TakeBitmap(); |
| 1931 DCHECK(source); | 1938 DCHECK(source); |
| 1932 if (!source) | 1939 if (!source) |
| 1933 return; | 1940 return; |
| 1934 | 1941 |
| 1935 ignore_result(scoped_callback_runner.Release()); | 1942 ignore_result(scoped_callback_runner.Release()); |
| (...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3556 RenderWidgetHost* widget) { | 3563 RenderWidgetHost* widget) { |
| 3557 return new RenderWidgetHostViewAura(widget); | 3564 return new RenderWidgetHostViewAura(widget); |
| 3558 } | 3565 } |
| 3559 | 3566 |
| 3560 // static | 3567 // static |
| 3561 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3568 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 3562 GetScreenInfoForWindow(results, NULL); | 3569 GetScreenInfoForWindow(results, NULL); |
| 3563 } | 3570 } |
| 3564 | 3571 |
| 3565 } // namespace content | 3572 } // namespace content |
| OLD | NEW |