| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 const gfx::Rect& raster_dirty_rect, | 211 const gfx::Rect& raster_dirty_rect, |
| 212 const gfx::SizeF& scales, | 212 const gfx::SizeF& scales, |
| 213 sk_sp<SkColorSpace> dst_color_space, | 213 sk_sp<SkColorSpace> dst_color_space, |
| 214 const RasterSource::PlaybackSettings& playback_settings, | 214 const RasterSource::PlaybackSettings& playback_settings, |
| 215 uint64_t previous_content_id, | 215 uint64_t previous_content_id, |
| 216 uint64_t new_content_id) { | 216 uint64_t new_content_id) { |
| 217 // Allocate GpuMemoryBuffer if necessary. If using partial raster, we | 217 // Allocate GpuMemoryBuffer if necessary. If using partial raster, we |
| 218 // must allocate a buffer with BufferUsage CPU_READ_WRITE_PERSISTENT. | 218 // must allocate a buffer with BufferUsage CPU_READ_WRITE_PERSISTENT. |
| 219 if (!staging_buffer->gpu_memory_buffer) { | 219 if (!staging_buffer->gpu_memory_buffer) { |
| 220 staging_buffer->gpu_memory_buffer = | 220 staging_buffer->gpu_memory_buffer = |
| 221 resource_provider_->gpu_memory_buffer_manager() | 221 resource_provider_->gpu_memory_buffer_manager()->CreateGpuMemoryBuffer( |
| 222 ->AllocateGpuMemoryBuffer( | 222 staging_buffer->size, BufferFormat(resource->format()), |
| 223 staging_buffer->size, BufferFormat(resource->format()), | 223 StagingBufferUsage(), gpu::kNullSurfaceHandle); |
| 224 StagingBufferUsage(), gpu::kNullSurfaceHandle); | |
| 225 } | 224 } |
| 226 | 225 |
| 227 gfx::Rect playback_rect = raster_full_rect; | 226 gfx::Rect playback_rect = raster_full_rect; |
| 228 if (use_partial_raster_ && previous_content_id) { | 227 if (use_partial_raster_ && previous_content_id) { |
| 229 // Reduce playback rect to dirty region if the content id of the staging | 228 // Reduce playback rect to dirty region if the content id of the staging |
| 230 // buffer matches the prevous content id. | 229 // buffer matches the prevous content id. |
| 231 if (previous_content_id == staging_buffer->content_id) | 230 if (previous_content_id == staging_buffer->content_id) |
| 232 playback_rect.Intersect(raster_dirty_rect); | 231 playback_rect.Intersect(raster_dirty_rect); |
| 233 } | 232 } |
| 234 | 233 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 resource_lock->set_synchronized(!async_worker_context_enabled_); | 381 resource_lock->set_synchronized(!async_worker_context_enabled_); |
| 383 } | 382 } |
| 384 | 383 |
| 385 gfx::BufferUsage OneCopyRasterBufferProvider::StagingBufferUsage() const { | 384 gfx::BufferUsage OneCopyRasterBufferProvider::StagingBufferUsage() const { |
| 386 return use_partial_raster_ | 385 return use_partial_raster_ |
| 387 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT | 386 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT |
| 388 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE; | 387 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE; |
| 389 } | 388 } |
| 390 | 389 |
| 391 } // namespace cc | 390 } // namespace cc |
| OLD | NEW |