| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 ContextProvider::ScopedContextLock scoped_context(worker_context_provider_); | 185 ContextProvider::ScopedContextLock scoped_context(worker_context_provider_); |
| 186 gpu::gles2::GLES2Interface* gl = scoped_context.ContextGL(); | 186 gpu::gles2::GLES2Interface* gl = scoped_context.ContextGL(); |
| 187 DCHECK(gl); | 187 DCHECK(gl); |
| 188 // Synchronize with compositor. | 188 // Synchronize with compositor. |
| 189 gl->WaitSyncTokenCHROMIUM(sync_token.GetConstData()); | 189 gl->WaitSyncTokenCHROMIUM(sync_token.GetConstData()); |
| 190 } | 190 } |
| 191 | 191 |
| 192 std::unique_ptr<StagingBuffer> staging_buffer = | 192 std::unique_ptr<StagingBuffer> staging_buffer = |
| 193 staging_pool_.AcquireStagingBuffer(resource, previous_content_id); | 193 staging_pool_.AcquireStagingBuffer(resource, previous_content_id); |
| 194 | 194 |
| 195 sk_sp<SkColorSpace> raster_color_space = |
| 196 raster_source->HasImpliedColorSpace() ? nullptr |
| 197 : resource_lock->sk_color_space(); |
| 198 |
| 195 PlaybackToStagingBuffer(staging_buffer.get(), resource, raster_source, | 199 PlaybackToStagingBuffer(staging_buffer.get(), resource, raster_source, |
| 196 raster_full_rect, raster_dirty_rect, scales, | 200 raster_full_rect, raster_dirty_rect, scales, |
| 197 resource_lock->sk_color_space(), playback_settings, | 201 raster_color_space, playback_settings, |
| 198 previous_content_id, new_content_id); | 202 previous_content_id, new_content_id); |
| 199 | 203 |
| 200 CopyOnWorkerThread(staging_buffer.get(), resource_lock, sync_token, | 204 CopyOnWorkerThread(staging_buffer.get(), resource_lock, sync_token, |
| 201 raster_source, previous_content_id, new_content_id); | 205 raster_source, previous_content_id, new_content_id); |
| 202 | 206 |
| 203 staging_pool_.ReleaseStagingBuffer(std::move(staging_buffer)); | 207 staging_pool_.ReleaseStagingBuffer(std::move(staging_buffer)); |
| 204 } | 208 } |
| 205 | 209 |
| 206 void OneCopyRasterBufferProvider::PlaybackToStagingBuffer( | 210 void OneCopyRasterBufferProvider::PlaybackToStagingBuffer( |
| 207 StagingBuffer* staging_buffer, | 211 StagingBuffer* staging_buffer, |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 resource_lock->set_synchronized(!async_worker_context_enabled_); | 385 resource_lock->set_synchronized(!async_worker_context_enabled_); |
| 382 } | 386 } |
| 383 | 387 |
| 384 gfx::BufferUsage OneCopyRasterBufferProvider::StagingBufferUsage() const { | 388 gfx::BufferUsage OneCopyRasterBufferProvider::StagingBufferUsage() const { |
| 385 return use_partial_raster_ | 389 return use_partial_raster_ |
| 386 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT | 390 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT |
| 387 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE; | 391 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE; |
| 388 } | 392 } |
| 389 | 393 |
| 390 } // namespace cc | 394 } // namespace cc |
| OLD | NEW |