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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 client_name), | 243 client_name), |
244 100.0f * fraction_saved); | 244 100.0f * fraction_saved); |
245 } | 245 } |
246 | 246 |
247 if (staging_buffer->gpu_memory_buffer) { | 247 if (staging_buffer->gpu_memory_buffer) { |
248 gfx::GpuMemoryBuffer* buffer = staging_buffer->gpu_memory_buffer.get(); | 248 gfx::GpuMemoryBuffer* buffer = staging_buffer->gpu_memory_buffer.get(); |
249 DCHECK_EQ(1u, gfx::NumberOfPlanesForBufferFormat(buffer->GetFormat())); | 249 DCHECK_EQ(1u, gfx::NumberOfPlanesForBufferFormat(buffer->GetFormat())); |
250 bool rv = buffer->Map(); | 250 bool rv = buffer->Map(); |
251 DCHECK(rv); | 251 DCHECK(rv); |
252 DCHECK(buffer->memory(0)); | 252 DCHECK(buffer->memory(0)); |
253 // RasterBufferProvider::PlaybackToMemory only supports unsigned strides. | |
254 DCHECK_GE(buffer->stride(0), 0); | |
255 | 253 |
256 DCHECK(!playback_rect.IsEmpty()) | 254 DCHECK(!playback_rect.IsEmpty()) |
257 << "Why are we rastering a tile that's not dirty?"; | 255 << "Why are we rastering a tile that's not dirty?"; |
258 RasterBufferProvider::PlaybackToMemory( | 256 RasterBufferProvider::PlaybackToMemory( |
259 buffer->memory(0), resource->format(), staging_buffer->size, | 257 buffer->memory(0), resource->format(), staging_buffer->size, |
260 buffer->stride(0), raster_source, raster_full_rect, playback_rect, | 258 buffer->stride(0), raster_source, raster_full_rect, playback_rect, |
261 scale, playback_settings); | 259 scale, playback_settings); |
262 buffer->Unmap(); | 260 buffer->Unmap(); |
263 staging_buffer->content_id = new_content_id; | 261 staging_buffer->content_id = new_content_id; |
264 } | 262 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 resource_lock->set_synchronized(!async_worker_context_enabled_); | 378 resource_lock->set_synchronized(!async_worker_context_enabled_); |
381 } | 379 } |
382 | 380 |
383 gfx::BufferUsage OneCopyRasterBufferProvider::StagingBufferUsage() const { | 381 gfx::BufferUsage OneCopyRasterBufferProvider::StagingBufferUsage() const { |
384 return use_partial_raster_ | 382 return use_partial_raster_ |
385 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT | 383 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT |
386 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE; | 384 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE; |
387 } | 385 } |
388 | 386 |
389 } // namespace cc | 387 } // namespace cc |
OLD | NEW |