| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/compositor/surface_utils.h" | 5 #include "content/browser/compositor/surface_utils.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "cc/output/copy_output_result.h" | 11 #include "cc/output/copy_output_result.h" |
| 12 #include "cc/resources/single_release_callback.h" | 12 #include "cc/resources/single_release_callback.h" |
| 13 #include "components/viz/display_compositor/gl_helper.h" | 13 #include "components/viz/display_compositor/gl_helper.h" |
| 14 #include "components/viz/host/frame_sink_manager_host.h" | 14 #include "components/viz/host/frame_sink_manager_host.h" |
| 15 #include "content/browser/browser_main_loop.h" |
| 15 #include "skia/ext/image_operations.h" | 16 #include "skia/ext/image_operations.h" |
| 16 #include "third_party/skia/include/core/SkCanvas.h" | 17 #include "third_party/skia/include/core/SkCanvas.h" |
| 17 #include "third_party/skia/include/core/SkColorFilter.h" | 18 #include "third_party/skia/include/core/SkColorFilter.h" |
| 18 #include "third_party/skia/include/core/SkPaint.h" | 19 #include "third_party/skia/include/core/SkPaint.h" |
| 19 #include "third_party/skia/include/effects/SkLumaColorFilter.h" | 20 #include "third_party/skia/include/effects/SkLumaColorFilter.h" |
| 20 #include "ui/gfx/geometry/rect.h" | 21 #include "ui/gfx/geometry/rect.h" |
| 21 | 22 |
| 22 #if defined(OS_ANDROID) | 23 #if defined(OS_ANDROID) |
| 23 #include "content/browser/renderer_host/compositor_impl_android.h" | 24 #include "content/browser/renderer_host/compositor_impl_android.h" |
| 24 #else | 25 #else |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 if (factory == NULL) | 171 if (factory == NULL) |
| 171 return nullptr; | 172 return nullptr; |
| 172 return factory->GetContextFactoryPrivate()->GetSurfaceManager(); | 173 return factory->GetContextFactoryPrivate()->GetSurfaceManager(); |
| 173 #endif | 174 #endif |
| 174 } | 175 } |
| 175 | 176 |
| 176 viz::FrameSinkManagerHost* GetFrameSinkManagerHost() { | 177 viz::FrameSinkManagerHost* GetFrameSinkManagerHost() { |
| 177 #if defined(OS_ANDROID) | 178 #if defined(OS_ANDROID) |
| 178 return CompositorImpl::GetFrameSinkManagerHost(); | 179 return CompositorImpl::GetFrameSinkManagerHost(); |
| 179 #else | 180 #else |
| 180 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 181 return BrowserMainLoop::GetInstance()->frame_sink_manager_host(); |
| 181 if (!factory) | |
| 182 return nullptr; | |
| 183 return factory->GetContextFactoryPrivate()->GetFrameSinkManagerHost(); | |
| 184 #endif | 182 #endif |
| 185 } | 183 } |
| 186 | 184 |
| 187 void CopyFromCompositingSurfaceHasResult( | 185 void CopyFromCompositingSurfaceHasResult( |
| 188 const gfx::Size& dst_size_in_pixel, | 186 const gfx::Size& dst_size_in_pixel, |
| 189 const SkColorType color_type, | 187 const SkColorType color_type, |
| 190 const ReadbackRequestCallback& callback, | 188 const ReadbackRequestCallback& callback, |
| 191 std::unique_ptr<cc::CopyOutputResult> result) { | 189 std::unique_ptr<cc::CopyOutputResult> result) { |
| 192 if (result->IsEmpty() || result->size().IsEmpty()) { | 190 if (result->IsEmpty() || result->size().IsEmpty()) { |
| 193 callback.Run(SkBitmap(), READBACK_FAILED); | 191 callback.Run(SkBitmap(), READBACK_FAILED); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 207 return; | 205 return; |
| 208 } | 206 } |
| 209 | 207 |
| 210 DCHECK(result->HasBitmap()); | 208 DCHECK(result->HasBitmap()); |
| 211 // Software path | 209 // Software path |
| 212 PrepareBitmapCopyOutputResult(output_size_in_pixel, color_type, callback, | 210 PrepareBitmapCopyOutputResult(output_size_in_pixel, color_type, callback, |
| 213 std::move(result)); | 211 std::move(result)); |
| 214 } | 212 } |
| 215 | 213 |
| 216 } // namespace content | 214 } // namespace content |
| OLD | NEW |