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

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

Issue 2752523006: cc: Use SkCreateColorSpaceXformCanvas for color transforms (Closed)
Patch Set: Rebase 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
« no previous file with comments | « cc/raster/one_copy_raster_buffer_provider.h ('k') | cc/raster/raster_buffer_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 PlaybackToStagingBuffer(staging_buffer.get(), resource, raster_source, 237 PlaybackToStagingBuffer(
238 raster_full_rect, raster_dirty_rect, scale, 238 staging_buffer.get(), resource, raster_source, raster_full_rect,
239 resource_lock->sk_color_space(), playback_settings, 239 raster_dirty_rect, scale, resource_lock->color_space_for_raster(),
240 previous_content_id, new_content_id); 240 playback_settings, previous_content_id, 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, 255 const gfx::ColorSpace& dst_color_space,
256 const RasterSource::PlaybackSettings& playback_settings, 256 const RasterSource::PlaybackSettings& playback_settings,
257 uint64_t previous_content_id, 257 uint64_t previous_content_id,
258 uint64_t new_content_id) { 258 uint64_t new_content_id) {
259 // Allocate GpuMemoryBuffer if necessary. If using partial raster, we 259 // Allocate GpuMemoryBuffer if necessary. If using partial raster, we
260 // must allocate a buffer with BufferUsage CPU_READ_WRITE_PERSISTENT. 260 // must allocate a buffer with BufferUsage CPU_READ_WRITE_PERSISTENT.
261 if (!staging_buffer->gpu_memory_buffer) { 261 if (!staging_buffer->gpu_memory_buffer) {
262 staging_buffer->gpu_memory_buffer = 262 staging_buffer->gpu_memory_buffer =
263 resource_provider_->gpu_memory_buffer_manager()->CreateGpuMemoryBuffer( 263 resource_provider_->gpu_memory_buffer_manager()->CreateGpuMemoryBuffer(
264 staging_buffer->size, BufferFormat(resource->format()), 264 staging_buffer->size, BufferFormat(resource->format()),
265 StagingBufferUsage(), gpu::kNullSurfaceHandle); 265 StagingBufferUsage(), gpu::kNullSurfaceHandle);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 resource_lock->set_synchronized(!async_worker_context_enabled_); 424 resource_lock->set_synchronized(!async_worker_context_enabled_);
425 } 425 }
426 426
427 gfx::BufferUsage OneCopyRasterBufferProvider::StagingBufferUsage() const { 427 gfx::BufferUsage OneCopyRasterBufferProvider::StagingBufferUsage() const {
428 return use_partial_raster_ 428 return use_partial_raster_
429 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT 429 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT
430 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE; 430 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE;
431 } 431 }
432 432
433 } // namespace cc 433 } // namespace cc
OLDNEW
« no previous file with comments | « cc/raster/one_copy_raster_buffer_provider.h ('k') | cc/raster/raster_buffer_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698