Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(701)

Side by Side Diff: cc/raster/one_copy_raster_buffer_provider.cc

Issue 2752523006: cc: Use SkCreateColorSpaceXformCanvas for color transforms (Closed)
Patch Set: Allow to link Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 PlaybackToStagingBuffer(staging_buffer.get(), resource, raster_source, 237 PlaybackToStagingBuffer(staging_buffer.get(), resource, raster_source,
238 raster_full_rect, raster_dirty_rect, scale, 238 raster_full_rect, raster_dirty_rect, scale,
239 resource_lock->sk_color_space(), playback_settings, 239 playback_settings, previous_content_id,
240 previous_content_id, new_content_id); 240 new_content_id);
241 241
242 CopyOnWorkerThread(staging_buffer.get(), resource_lock, sync_token, 242 CopyOnWorkerThread(staging_buffer.get(), resource_lock, sync_token,
243 raster_source, previous_content_id, new_content_id); 243 raster_source, previous_content_id, new_content_id);
244 244
245 staging_pool_.ReleaseStagingBuffer(std::move(staging_buffer)); 245 staging_pool_.ReleaseStagingBuffer(std::move(staging_buffer));
246 } 246 }
247 247
248 void OneCopyRasterBufferProvider::PlaybackToStagingBuffer( 248 void OneCopyRasterBufferProvider::PlaybackToStagingBuffer(
249 StagingBuffer* staging_buffer, 249 StagingBuffer* staging_buffer,
250 const Resource* resource, 250 const Resource* resource,
251 const RasterSource* raster_source, 251 const RasterSource* raster_source,
252 const gfx::Rect& raster_full_rect, 252 const gfx::Rect& raster_full_rect,
253 const gfx::Rect& raster_dirty_rect, 253 const gfx::Rect& raster_dirty_rect,
254 float scale, 254 float scale,
255 sk_sp<SkColorSpace> dst_color_space,
256 const RasterSource::PlaybackSettings& playback_settings, 255 const RasterSource::PlaybackSettings& playback_settings,
257 uint64_t previous_content_id, 256 uint64_t previous_content_id,
258 uint64_t new_content_id) { 257 uint64_t new_content_id) {
259 // Allocate GpuMemoryBuffer if necessary. If using partial raster, we 258 // Allocate GpuMemoryBuffer if necessary. If using partial raster, we
260 // must allocate a buffer with BufferUsage CPU_READ_WRITE_PERSISTENT. 259 // must allocate a buffer with BufferUsage CPU_READ_WRITE_PERSISTENT.
261 if (!staging_buffer->gpu_memory_buffer) { 260 if (!staging_buffer->gpu_memory_buffer) {
262 staging_buffer->gpu_memory_buffer = 261 staging_buffer->gpu_memory_buffer =
263 resource_provider_->gpu_memory_buffer_manager()->CreateGpuMemoryBuffer( 262 resource_provider_->gpu_memory_buffer_manager()->CreateGpuMemoryBuffer(
264 staging_buffer->size, BufferFormat(resource->format()), 263 staging_buffer->size, BufferFormat(resource->format()),
265 StagingBufferUsage(), gpu::kNullSurfaceHandle); 264 StagingBufferUsage(), gpu::kNullSurfaceHandle);
(...skipping 28 matching lines...) Expand all
294 DCHECK(rv); 293 DCHECK(rv);
295 DCHECK(buffer->memory(0)); 294 DCHECK(buffer->memory(0));
296 // RasterBufferProvider::PlaybackToMemory only supports unsigned strides. 295 // RasterBufferProvider::PlaybackToMemory only supports unsigned strides.
297 DCHECK_GE(buffer->stride(0), 0); 296 DCHECK_GE(buffer->stride(0), 0);
298 297
299 DCHECK(!playback_rect.IsEmpty()) 298 DCHECK(!playback_rect.IsEmpty())
300 << "Why are we rastering a tile that's not dirty?"; 299 << "Why are we rastering a tile that's not dirty?";
301 RasterBufferProvider::PlaybackToMemory( 300 RasterBufferProvider::PlaybackToMemory(
302 buffer->memory(0), resource->format(), staging_buffer->size, 301 buffer->memory(0), resource->format(), staging_buffer->size,
303 buffer->stride(0), raster_source, raster_full_rect, playback_rect, 302 buffer->stride(0), raster_source, raster_full_rect, playback_rect,
304 scale, dst_color_space, playback_settings); 303 scale, playback_settings);
305 buffer->Unmap(); 304 buffer->Unmap();
306 staging_buffer->content_id = new_content_id; 305 staging_buffer->content_id = new_content_id;
307 } 306 }
308 } 307 }
309 308
310 void OneCopyRasterBufferProvider::CopyOnWorkerThread( 309 void OneCopyRasterBufferProvider::CopyOnWorkerThread(
311 StagingBuffer* staging_buffer, 310 StagingBuffer* staging_buffer,
312 ResourceProvider::ScopedWriteLockGL* resource_lock, 311 ResourceProvider::ScopedWriteLockGL* resource_lock,
313 const gpu::SyncToken& sync_token, 312 const gpu::SyncToken& sync_token,
314 const RasterSource* raster_source, 313 const RasterSource* raster_source,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 resource_lock->set_synchronized(!async_worker_context_enabled_); 423 resource_lock->set_synchronized(!async_worker_context_enabled_);
425 } 424 }
426 425
427 gfx::BufferUsage OneCopyRasterBufferProvider::StagingBufferUsage() const { 426 gfx::BufferUsage OneCopyRasterBufferProvider::StagingBufferUsage() const {
428 return use_partial_raster_ 427 return use_partial_raster_
429 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT 428 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT
430 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE; 429 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE;
431 } 430 }
432 431
433 } // namespace cc 432 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698