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_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 scoped_ptr<cc::CopyOutputResult> result) { | 1741 scoped_ptr<cc::CopyOutputResult> result) { |
1742 base::ScopedClosureRunner scoped_callback_runner( | 1742 base::ScopedClosureRunner scoped_callback_runner( |
1743 base::Bind(callback, false, SkBitmap())); | 1743 base::Bind(callback, false, SkBitmap())); |
1744 TRACE_EVENT0("cc", | 1744 TRACE_EVENT0("cc", |
1745 "RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult"); | 1745 "RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult"); |
1746 | 1746 |
1747 if (!result->HasTexture() || result->IsEmpty() || result->size().IsEmpty()) | 1747 if (!result->HasTexture() || result->IsEmpty() || result->size().IsEmpty()) |
1748 return; | 1748 return; |
1749 | 1749 |
1750 scoped_ptr<SkBitmap> bitmap(new SkBitmap); | 1750 scoped_ptr<SkBitmap> bitmap(new SkBitmap); |
1751 if (!bitmap->tryAllocPixels(SkImageInfo::Make(dst_size_in_pixel.width(), | 1751 if (!bitmap->allocPixels(SkImageInfo::Make(dst_size_in_pixel.width(), |
1752 dst_size_in_pixel.height(), | 1752 dst_size_in_pixel.height(), |
1753 color_type, | 1753 color_type, |
1754 kOpaque_SkAlphaType))) | 1754 kOpaque_SkAlphaType))) |
1755 return; | 1755 return; |
1756 | 1756 |
1757 ImageTransportFactoryAndroid* factory = | 1757 ImageTransportFactoryAndroid* factory = |
1758 ImageTransportFactoryAndroid::GetInstance(); | 1758 ImageTransportFactoryAndroid::GetInstance(); |
1759 GLHelper* gl_helper = factory->GetGLHelper(); | 1759 GLHelper* gl_helper = factory->GetGLHelper(); |
1760 | 1760 |
1761 if (!gl_helper) | 1761 if (!gl_helper) |
1762 return; | 1762 return; |
1763 | 1763 |
1764 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock( | 1764 scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock( |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1850 results->orientationAngle = display.RotationAsDegree(); | 1850 results->orientationAngle = display.RotationAsDegree(); |
1851 results->orientationType = | 1851 results->orientationType = |
1852 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1852 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
1853 gfx::DeviceDisplayInfo info; | 1853 gfx::DeviceDisplayInfo info; |
1854 results->depth = info.GetBitsPerPixel(); | 1854 results->depth = info.GetBitsPerPixel(); |
1855 results->depthPerComponent = info.GetBitsPerComponent(); | 1855 results->depthPerComponent = info.GetBitsPerComponent(); |
1856 results->isMonochrome = (results->depthPerComponent == 0); | 1856 results->isMonochrome = (results->depthPerComponent == 0); |
1857 } | 1857 } |
1858 | 1858 |
1859 } // namespace content | 1859 } // namespace content |
OLD | NEW |