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 "skia/ext/image_operations.h" | 14 #include "skia/ext/image_operations.h" |
15 #include "third_party/skia/include/core/SkCanvas.h" | 15 #include "third_party/skia/include/core/SkCanvas.h" |
16 #include "third_party/skia/include/core/SkColorFilter.h" | 16 #include "third_party/skia/include/core/SkColorFilter.h" |
17 #include "third_party/skia/include/core/SkPaint.h" | 17 #include "third_party/skia/include/core/SkPaint.h" |
18 #include "third_party/skia/include/effects/SkLumaColorFilter.h" | 18 #include "third_party/skia/include/effects/SkLumaColorFilter.h" |
19 #include "ui/gfx/geometry/rect.h" | 19 #include "ui/gfx/geometry/rect.h" |
20 | 20 |
21 #if defined(OS_ANDROID) | 21 #if defined(OS_ANDROID) |
22 #include "content/browser/renderer_host/context_provider_factory_impl_android.h" | 22 #include "content/browser/renderer_host/compositor_impl_android.h" |
23 #else | 23 #else |
24 #include "content/browser/compositor/image_transport_factory.h" | 24 #include "content/browser/compositor/image_transport_factory.h" |
25 #include "ui/compositor/compositor.h" // nogncheck | 25 #include "ui/compositor/compositor.h" // nogncheck |
26 #endif | 26 #endif |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 #if !defined(OS_ANDROID) || defined(USE_AURA) | 30 #if !defined(OS_ANDROID) || defined(USE_AURA) |
31 void CopyFromCompositingSurfaceFinished( | 31 void CopyFromCompositingSurfaceFinished( |
32 const content::ReadbackRequestCallback& callback, | 32 const content::ReadbackRequestCallback& callback, |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 canvas.drawBitmap(scaled_bitmap, SkIntToScalar(0), SkIntToScalar(0), &paint); | 153 canvas.drawBitmap(scaled_bitmap, SkIntToScalar(0), SkIntToScalar(0), &paint); |
154 callback.Run(grayscale_bitmap, content::READBACK_SUCCESS); | 154 callback.Run(grayscale_bitmap, content::READBACK_SUCCESS); |
155 } | 155 } |
156 | 156 |
157 } // namespace | 157 } // namespace |
158 | 158 |
159 namespace content { | 159 namespace content { |
160 | 160 |
161 cc::FrameSinkId AllocateFrameSinkId() { | 161 cc::FrameSinkId AllocateFrameSinkId() { |
162 #if defined(OS_ANDROID) | 162 #if defined(OS_ANDROID) |
163 return ContextProviderFactoryImpl::GetInstance()->AllocateFrameSinkId(); | 163 return CompositorImpl::AllocateFrameSinkId(); |
164 #else | 164 #else |
165 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 165 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
166 return factory->GetContextFactoryPrivate()->AllocateFrameSinkId(); | 166 return factory->GetContextFactoryPrivate()->AllocateFrameSinkId(); |
167 #endif | 167 #endif |
168 } | 168 } |
169 | 169 |
170 cc::SurfaceManager* GetSurfaceManager() { | 170 cc::SurfaceManager* GetSurfaceManager() { |
171 #if defined(OS_ANDROID) | 171 #if defined(OS_ANDROID) |
172 return ContextProviderFactoryImpl::GetInstance()->GetSurfaceManager(); | 172 return CompositorImpl::GetSurfaceManager(); |
173 #else | 173 #else |
174 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 174 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
175 if (factory == NULL) | 175 if (factory == NULL) |
176 return nullptr; | 176 return nullptr; |
177 return factory->GetContextFactoryPrivate()->GetSurfaceManager(); | 177 return factory->GetContextFactoryPrivate()->GetSurfaceManager(); |
178 #endif | 178 #endif |
179 } | 179 } |
180 | 180 |
181 void CopyFromCompositingSurfaceHasResult( | 181 void CopyFromCompositingSurfaceHasResult( |
182 const gfx::Size& dst_size_in_pixel, | 182 const gfx::Size& dst_size_in_pixel, |
(...skipping 18 matching lines...) Expand all Loading... |
201 return; | 201 return; |
202 } | 202 } |
203 | 203 |
204 DCHECK(result->HasBitmap()); | 204 DCHECK(result->HasBitmap()); |
205 // Software path | 205 // Software path |
206 PrepareBitmapCopyOutputResult(output_size_in_pixel, color_type, callback, | 206 PrepareBitmapCopyOutputResult(output_size_in_pixel, color_type, callback, |
207 std::move(result)); | 207 std::move(result)); |
208 } | 208 } |
209 | 209 |
210 } // namespace content | 210 } // namespace content |
OLD | NEW |