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/basictypes.h" |
7 #include "base/bind.h" | 8 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 9 #include "base/callback_helpers.h" |
9 #include "base/command_line.h" | 10 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
13 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
14 #include "cc/output/compositor_frame.h" | 15 #include "cc/output/compositor_frame.h" |
15 #include "cc/output/compositor_frame_ack.h" | 16 #include "cc/output/compositor_frame_ack.h" |
16 #include "cc/output/copy_output_request.h" | 17 #include "cc/output/copy_output_request.h" |
17 #include "cc/output/copy_output_result.h" | 18 #include "cc/output/copy_output_result.h" |
18 #include "cc/resources/texture_mailbox.h" | 19 #include "cc/resources/texture_mailbox.h" |
(...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1808 | 1809 |
1809 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock( | 1810 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock( |
1810 new SkAutoLockPixels(*bitmap)); | 1811 new SkAutoLockPixels(*bitmap)); |
1811 uint8* pixels = static_cast<uint8*>(bitmap->getPixels()); | 1812 uint8* pixels = static_cast<uint8*>(bitmap->getPixels()); |
1812 | 1813 |
1813 scoped_ptr<cc::TextureMailbox> texture_mailbox = result->TakeTexture(); | 1814 scoped_ptr<cc::TextureMailbox> texture_mailbox = result->TakeTexture(); |
1814 DCHECK(texture_mailbox->IsTexture()); | 1815 DCHECK(texture_mailbox->IsTexture()); |
1815 if (!texture_mailbox->IsTexture()) | 1816 if (!texture_mailbox->IsTexture()) |
1816 return; | 1817 return; |
1817 | 1818 |
1818 scoped_callback_runner.Release(); | 1819 ignore_result(scoped_callback_runner.Release()); |
1819 | 1820 |
1820 gl_helper->CropScaleReadbackAndCleanMailbox( | 1821 gl_helper->CropScaleReadbackAndCleanMailbox( |
1821 texture_mailbox->name(), | 1822 texture_mailbox->name(), |
1822 texture_mailbox->sync_point(), | 1823 texture_mailbox->sync_point(), |
1823 result->size(), | 1824 result->size(), |
1824 gfx::Rect(result->size()), | 1825 gfx::Rect(result->size()), |
1825 dst_size_in_pixel, | 1826 dst_size_in_pixel, |
1826 pixels, | 1827 pixels, |
1827 base::Bind(&CopyFromCompositingSurfaceFinished, | 1828 base::Bind(&CopyFromCompositingSurfaceFinished, |
1828 callback, | 1829 callback, |
(...skipping 12 matching lines...) Expand all Loading... |
1841 base::ScopedClosureRunner scoped_callback_runner( | 1842 base::ScopedClosureRunner scoped_callback_runner( |
1842 base::Bind(callback, false, SkBitmap())); | 1843 base::Bind(callback, false, SkBitmap())); |
1843 if (!result->HasBitmap()) | 1844 if (!result->HasBitmap()) |
1844 return; | 1845 return; |
1845 | 1846 |
1846 scoped_ptr<SkBitmap> source = result->TakeBitmap(); | 1847 scoped_ptr<SkBitmap> source = result->TakeBitmap(); |
1847 DCHECK(source); | 1848 DCHECK(source); |
1848 if (!source) | 1849 if (!source) |
1849 return; | 1850 return; |
1850 | 1851 |
1851 scoped_callback_runner.Release(); | 1852 ignore_result(scoped_callback_runner.Release()); |
1852 | 1853 |
1853 SkBitmap bitmap = skia::ImageOperations::Resize( | 1854 SkBitmap bitmap = skia::ImageOperations::Resize( |
1854 *source, | 1855 *source, |
1855 skia::ImageOperations::RESIZE_BEST, | 1856 skia::ImageOperations::RESIZE_BEST, |
1856 dst_size_in_pixel.width(), | 1857 dst_size_in_pixel.width(), |
1857 dst_size_in_pixel.height()); | 1858 dst_size_in_pixel.height()); |
1858 callback.Run(true, bitmap); | 1859 callback.Run(true, bitmap); |
1859 } | 1860 } |
1860 | 1861 |
1861 static void CopyFromCompositingSurfaceFinishedForVideo( | 1862 static void CopyFromCompositingSurfaceFinishedForVideo( |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1918 | 1919 |
1919 { | 1920 { |
1920 SkAutoLockPixels scaled_bitmap_locker(scaled_bitmap); | 1921 SkAutoLockPixels scaled_bitmap_locker(scaled_bitmap); |
1921 | 1922 |
1922 media::CopyRGBToVideoFrame( | 1923 media::CopyRGBToVideoFrame( |
1923 reinterpret_cast<uint8*>(scaled_bitmap.getPixels()), | 1924 reinterpret_cast<uint8*>(scaled_bitmap.getPixels()), |
1924 scaled_bitmap.rowBytes(), | 1925 scaled_bitmap.rowBytes(), |
1925 region_in_frame, | 1926 region_in_frame, |
1926 video_frame.get()); | 1927 video_frame.get()); |
1927 } | 1928 } |
1928 scoped_callback_runner.Release(); | 1929 ignore_result(scoped_callback_runner.Release()); |
1929 callback.Run(true); | 1930 callback.Run(true); |
1930 return; | 1931 return; |
1931 } | 1932 } |
1932 | 1933 |
1933 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 1934 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
1934 GLHelper* gl_helper = factory->GetGLHelper(); | 1935 GLHelper* gl_helper = factory->GetGLHelper(); |
1935 if (!gl_helper) | 1936 if (!gl_helper) |
1936 return; | 1937 return; |
1937 | 1938 |
1938 scoped_ptr<cc::TextureMailbox> texture_mailbox = result->TakeTexture(); | 1939 scoped_ptr<cc::TextureMailbox> texture_mailbox = result->TakeTexture(); |
(...skipping 29 matching lines...) Expand all Loading... |
1968 gl_helper->CreateReadbackPipelineYUV(quality, | 1969 gl_helper->CreateReadbackPipelineYUV(quality, |
1969 result_rect.size(), | 1970 result_rect.size(), |
1970 result_rect, | 1971 result_rect, |
1971 video_frame->coded_size(), | 1972 video_frame->coded_size(), |
1972 region_in_frame, | 1973 region_in_frame, |
1973 true, | 1974 true, |
1974 false)); | 1975 false)); |
1975 yuv_readback_pipeline = rwhva->yuv_readback_pipeline_.get(); | 1976 yuv_readback_pipeline = rwhva->yuv_readback_pipeline_.get(); |
1976 } | 1977 } |
1977 | 1978 |
1978 scoped_callback_runner.Release(); | 1979 ignore_result(scoped_callback_runner.Release()); |
1979 base::Callback<void(bool result)> finished_callback = base::Bind( | 1980 base::Callback<void(bool result)> finished_callback = base::Bind( |
1980 &CopyFromCompositingSurfaceFinishedForVideo, | 1981 &CopyFromCompositingSurfaceFinishedForVideo, |
1981 callback, | 1982 callback, |
1982 texture_mailbox->callback()); | 1983 texture_mailbox->callback()); |
1983 yuv_readback_pipeline->ReadbackYUV( | 1984 yuv_readback_pipeline->ReadbackYUV( |
1984 texture_mailbox->name(), | 1985 texture_mailbox->name(), |
1985 texture_mailbox->sync_point(), | 1986 texture_mailbox->sync_point(), |
1986 video_frame.get(), | 1987 video_frame.get(), |
1987 finished_callback); | 1988 finished_callback); |
1988 } | 1989 } |
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3258 RenderWidgetHost* widget) { | 3259 RenderWidgetHost* widget) { |
3259 return new RenderWidgetHostViewAura(widget); | 3260 return new RenderWidgetHostViewAura(widget); |
3260 } | 3261 } |
3261 | 3262 |
3262 // static | 3263 // static |
3263 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3264 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
3264 GetScreenInfoForWindow(results, NULL); | 3265 GetScreenInfoForWindow(results, NULL); |
3265 } | 3266 } |
3266 | 3267 |
3267 } // namespace content | 3268 } // namespace content |
OLD | NEW |