Chromium Code Reviews| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 return CompositorImpl::GetSurfaceManager(); | 168 return CompositorImpl::GetSurfaceManager(); |
| 168 #else | 169 #else |
| 169 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 170 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 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 return BrowserMainLoop::GetInstance()->frame_sink_manager_host(); |
| 178 return CompositorImpl::GetFrameSinkManagerHost(); | |
|
piman
2017/06/09 21:09:28
Should we remove the FrameSinkManagerHost in Compo
Fady Samuel
2017/06/09 21:49:17
Done.
| |
| 179 #else | |
| 180 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | |
| 181 if (!factory) | |
| 182 return nullptr; | |
| 183 return factory->GetContextFactoryPrivate()->GetFrameSinkManagerHost(); | |
| 184 #endif | |
| 185 } | 179 } |
| 186 | 180 |
| 187 void CopyFromCompositingSurfaceHasResult( | 181 void CopyFromCompositingSurfaceHasResult( |
| 188 const gfx::Size& dst_size_in_pixel, | 182 const gfx::Size& dst_size_in_pixel, |
| 189 const SkColorType color_type, | 183 const SkColorType color_type, |
| 190 const ReadbackRequestCallback& callback, | 184 const ReadbackRequestCallback& callback, |
| 191 std::unique_ptr<cc::CopyOutputResult> result) { | 185 std::unique_ptr<cc::CopyOutputResult> result) { |
| 192 if (result->IsEmpty() || result->size().IsEmpty()) { | 186 if (result->IsEmpty() || result->size().IsEmpty()) { |
| 193 callback.Run(SkBitmap(), READBACK_FAILED); | 187 callback.Run(SkBitmap(), READBACK_FAILED); |
| 194 return; | 188 return; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 207 return; | 201 return; |
| 208 } | 202 } |
| 209 | 203 |
| 210 DCHECK(result->HasBitmap()); | 204 DCHECK(result->HasBitmap()); |
| 211 // Software path | 205 // Software path |
| 212 PrepareBitmapCopyOutputResult(output_size_in_pixel, color_type, callback, | 206 PrepareBitmapCopyOutputResult(output_size_in_pixel, color_type, callback, |
| 213 std::move(result)); | 207 std::move(result)); |
| 214 } | 208 } |
| 215 | 209 |
| 216 } // namespace content | 210 } // namespace content |
| OLD | NEW |