| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "cc/raster/one_copy_raster_buffer_provider.h" | 5 #include "cc/raster/one_copy_raster_buffer_provider.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 ContextProvider::ScopedContextLock scoped_context(worker_context_provider_); | 227 ContextProvider::ScopedContextLock scoped_context(worker_context_provider_); |
| 228 gpu::gles2::GLES2Interface* gl = scoped_context.ContextGL(); | 228 gpu::gles2::GLES2Interface* gl = scoped_context.ContextGL(); |
| 229 DCHECK(gl); | 229 DCHECK(gl); |
| 230 // Synchronize with compositor. | 230 // Synchronize with compositor. |
| 231 gl->WaitSyncTokenCHROMIUM(sync_token.GetConstData()); | 231 gl->WaitSyncTokenCHROMIUM(sync_token.GetConstData()); |
| 232 } | 232 } |
| 233 | 233 |
| 234 std::unique_ptr<StagingBuffer> staging_buffer = | 234 std::unique_ptr<StagingBuffer> staging_buffer = |
| 235 staging_pool_.AcquireStagingBuffer(resource, previous_content_id); | 235 staging_pool_.AcquireStagingBuffer(resource, previous_content_id); |
| 236 | 236 |
| 237 sk_sp<SkColorSpace> raster_color_space = | |
| 238 raster_source->HasImpliedColorSpace() ? nullptr | |
| 239 : resource_lock->sk_color_space(); | |
| 240 | |
| 241 PlaybackToStagingBuffer(staging_buffer.get(), resource, raster_source, | 237 PlaybackToStagingBuffer(staging_buffer.get(), resource, raster_source, |
| 242 raster_full_rect, raster_dirty_rect, scale, | 238 raster_full_rect, raster_dirty_rect, scale, |
| 243 raster_color_space, playback_settings, | 239 resource_lock->sk_color_space(), playback_settings, |
| 244 previous_content_id, new_content_id); | 240 previous_content_id, new_content_id); |
| 245 | 241 |
| 246 CopyOnWorkerThread(staging_buffer.get(), resource_lock, sync_token, | 242 CopyOnWorkerThread(staging_buffer.get(), resource_lock, sync_token, |
| 247 raster_source, previous_content_id, new_content_id); | 243 raster_source, previous_content_id, new_content_id); |
| 248 | 244 |
| 249 staging_pool_.ReleaseStagingBuffer(std::move(staging_buffer)); | 245 staging_pool_.ReleaseStagingBuffer(std::move(staging_buffer)); |
| 250 } | 246 } |
| 251 | 247 |
| 252 void OneCopyRasterBufferProvider::PlaybackToStagingBuffer( | 248 void OneCopyRasterBufferProvider::PlaybackToStagingBuffer( |
| 253 StagingBuffer* staging_buffer, | 249 StagingBuffer* staging_buffer, |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 resource_lock->set_synchronized(!async_worker_context_enabled_); | 424 resource_lock->set_synchronized(!async_worker_context_enabled_); |
| 429 } | 425 } |
| 430 | 426 |
| 431 gfx::BufferUsage OneCopyRasterBufferProvider::StagingBufferUsage() const { | 427 gfx::BufferUsage OneCopyRasterBufferProvider::StagingBufferUsage() const { |
| 432 return use_partial_raster_ | 428 return use_partial_raster_ |
| 433 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT | 429 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT |
| 434 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE; | 430 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE; |
| 435 } | 431 } |
| 436 | 432 |
| 437 } // namespace cc | 433 } // namespace cc |
| OLD | NEW |