| 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/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "cc/output/copy_output_result.h" | 10 #include "cc/output/copy_output_result.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 165 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 166 return factory->GetContextFactory()->CreateSurfaceIdAllocator(); | 166 return factory->GetContextFactory()->CreateSurfaceIdAllocator(); |
| 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 CompositorImpl::GetSurfaceManager(); | 172 return CompositorImpl::GetSurfaceManager(); |
| 173 #else | 173 #else |
| 174 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 174 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 175 if (factory == NULL) |
| 176 return nullptr; |
| 175 return factory->GetSurfaceManager(); | 177 return factory->GetSurfaceManager(); |
| 176 #endif | 178 #endif |
| 177 } | 179 } |
| 178 | 180 |
| 179 void CopyFromCompositingSurfaceHasResult( | 181 void CopyFromCompositingSurfaceHasResult( |
| 180 const gfx::Size& dst_size_in_pixel, | 182 const gfx::Size& dst_size_in_pixel, |
| 181 const SkColorType color_type, | 183 const SkColorType color_type, |
| 182 const ReadbackRequestCallback& callback, | 184 const ReadbackRequestCallback& callback, |
| 183 std::unique_ptr<cc::CopyOutputResult> result) { | 185 std::unique_ptr<cc::CopyOutputResult> result) { |
| 184 if (result->IsEmpty() || result->size().IsEmpty()) { | 186 if (result->IsEmpty() || result->size().IsEmpty()) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 199 return; | 201 return; |
| 200 } | 202 } |
| 201 | 203 |
| 202 DCHECK(result->HasBitmap()); | 204 DCHECK(result->HasBitmap()); |
| 203 // Software path | 205 // Software path |
| 204 PrepareBitmapCopyOutputResult(output_size_in_pixel, color_type, callback, | 206 PrepareBitmapCopyOutputResult(output_size_in_pixel, color_type, callback, |
| 205 std::move(result)); | 207 std::move(result)); |
| 206 } | 208 } |
| 207 | 209 |
| 208 } // namespace content | 210 } // namespace content |
| OLD | NEW |