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/display_compositor/gl_helper.h" | 13 #include "components/display_compositor/gl_helper.h" |
| 14 #include "content/browser/compositor/frame_sink_manager_host.h" |
14 #include "skia/ext/image_operations.h" | 15 #include "skia/ext/image_operations.h" |
15 #include "third_party/skia/include/core/SkCanvas.h" | 16 #include "third_party/skia/include/core/SkCanvas.h" |
16 #include "third_party/skia/include/core/SkColorFilter.h" | 17 #include "third_party/skia/include/core/SkColorFilter.h" |
17 #include "third_party/skia/include/core/SkPaint.h" | 18 #include "third_party/skia/include/core/SkPaint.h" |
18 #include "third_party/skia/include/effects/SkLumaColorFilter.h" | 19 #include "third_party/skia/include/effects/SkLumaColorFilter.h" |
19 #include "ui/gfx/geometry/rect.h" | 20 #include "ui/gfx/geometry/rect.h" |
20 | 21 |
21 #if defined(OS_ANDROID) | 22 #if defined(OS_ANDROID) |
22 #include "content/browser/renderer_host/compositor_impl_android.h" | 23 #include "content/browser/renderer_host/compositor_impl_android.h" |
23 #else | 24 #else |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 #if defined(OS_ANDROID) | 172 #if defined(OS_ANDROID) |
172 return CompositorImpl::GetSurfaceManager(); | 173 return CompositorImpl::GetSurfaceManager(); |
173 #else | 174 #else |
174 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 175 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
175 if (factory == NULL) | 176 if (factory == NULL) |
176 return nullptr; | 177 return nullptr; |
177 return factory->GetContextFactoryPrivate()->GetSurfaceManager(); | 178 return factory->GetContextFactoryPrivate()->GetSurfaceManager(); |
178 #endif | 179 #endif |
179 } | 180 } |
180 | 181 |
| 182 FrameSinkManagerHost* GetFrameSinkManagerHost() { |
| 183 #if defined(OS_ANDROID) |
| 184 return CompositorImpl::GetFrameSinkManagerHost(); |
| 185 #else |
| 186 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 187 if (!factory) |
| 188 return nullptr; |
| 189 return factory->GetFrameSinkManagerHost(); |
| 190 #endif |
| 191 } |
| 192 |
181 void CopyFromCompositingSurfaceHasResult( | 193 void CopyFromCompositingSurfaceHasResult( |
182 const gfx::Size& dst_size_in_pixel, | 194 const gfx::Size& dst_size_in_pixel, |
183 const SkColorType color_type, | 195 const SkColorType color_type, |
184 const ReadbackRequestCallback& callback, | 196 const ReadbackRequestCallback& callback, |
185 std::unique_ptr<cc::CopyOutputResult> result) { | 197 std::unique_ptr<cc::CopyOutputResult> result) { |
186 if (result->IsEmpty() || result->size().IsEmpty()) { | 198 if (result->IsEmpty() || result->size().IsEmpty()) { |
187 callback.Run(SkBitmap(), READBACK_FAILED); | 199 callback.Run(SkBitmap(), READBACK_FAILED); |
188 return; | 200 return; |
189 } | 201 } |
190 | 202 |
(...skipping 10 matching lines...) Expand all Loading... |
201 return; | 213 return; |
202 } | 214 } |
203 | 215 |
204 DCHECK(result->HasBitmap()); | 216 DCHECK(result->HasBitmap()); |
205 // Software path | 217 // Software path |
206 PrepareBitmapCopyOutputResult(output_size_in_pixel, color_type, callback, | 218 PrepareBitmapCopyOutputResult(output_size_in_pixel, color_type, callback, |
207 std::move(result)); | 219 std::move(result)); |
208 } | 220 } |
209 | 221 |
210 } // namespace content | 222 } // namespace content |
OLD | NEW |