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

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

Issue 2525453002: Raster: Allow a RasterSource to specify its color space (Closed)
Patch Set: Only set implied space when color correct rendering is disabled Created 4 years 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/gpu_raster_buffer_provider.h" 5 #include "cc/raster/gpu_raster_buffer_provider.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 canvas->restore(); 78 canvas->restore();
79 return recorder.finishRecordingAsPicture(); 79 return recorder.finishRecordingAsPicture();
80 } 80 }
81 81
82 static void RasterizePicture(SkPicture* picture, 82 static void RasterizePicture(SkPicture* picture,
83 ContextProvider* context_provider, 83 ContextProvider* context_provider,
84 ResourceProvider::ScopedWriteLockGL* resource_lock, 84 ResourceProvider::ScopedWriteLockGL* resource_lock,
85 bool async_worker_context_enabled, 85 bool async_worker_context_enabled,
86 bool use_distance_field_text, 86 bool use_distance_field_text,
87 bool can_use_lcd_text, 87 bool can_use_lcd_text,
88 bool ignore_resource_color_space,
88 int msaa_sample_count, 89 int msaa_sample_count,
89 ImageDecodeController* image_decode_controller, 90 ImageDecodeController* image_decode_controller,
90 bool use_image_hijack_canvas) { 91 bool use_image_hijack_canvas) {
91 ScopedGpuRaster gpu_raster(context_provider); 92 ScopedGpuRaster gpu_raster(context_provider);
92 93
93 ResourceProvider::ScopedSkSurfaceProvider scoped_surface( 94 ResourceProvider::ScopedSkSurfaceProvider scoped_surface(
94 context_provider, resource_lock, async_worker_context_enabled, 95 context_provider, resource_lock, async_worker_context_enabled,
95 use_distance_field_text, can_use_lcd_text, msaa_sample_count); 96 use_distance_field_text, can_use_lcd_text, ignore_resource_color_space,
97 msaa_sample_count);
96 SkSurface* sk_surface = scoped_surface.sk_surface(); 98 SkSurface* sk_surface = scoped_surface.sk_surface();
97 // Allocating an SkSurface will fail after a lost context. Pretend we 99 // Allocating an SkSurface will fail after a lost context. Pretend we
98 // rasterized, as the contents of the resource don't matter anymore. 100 // rasterized, as the contents of the resource don't matter anymore.
99 if (!sk_surface) 101 if (!sk_surface)
100 return; 102 return;
101 103
102 // As we did not use the image hijack canvas during the initial playback to 104 // As we did not use the image hijack canvas during the initial playback to
103 // |picture| (see PlaybackToPicture), we must enable it here if requested. 105 // |picture| (see PlaybackToPicture), we must enable it here if requested.
104 SkCanvas* canvas = sk_surface->getCanvas(); 106 SkCanvas* canvas = sk_surface->getCanvas();
105 std::unique_ptr<ImageHijackCanvas> hijack_canvas; 107 std::unique_ptr<ImageHijackCanvas> hijack_canvas;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 raster_source, resource_has_previous_content, resource_lock->size(), 265 raster_source, resource_has_previous_content, resource_lock->size(),
264 raster_full_rect, raster_dirty_rect, scales, playback_settings); 266 raster_full_rect, raster_dirty_rect, scales, playback_settings);
265 267
266 // Turn on distance fields for layers that have ever animated. 268 // Turn on distance fields for layers that have ever animated.
267 bool use_distance_field_text = 269 bool use_distance_field_text =
268 use_distance_field_text_ || 270 use_distance_field_text_ ||
269 raster_source->ShouldAttemptToUseDistanceFieldText(); 271 raster_source->ShouldAttemptToUseDistanceFieldText();
270 272
271 RasterizePicture(picture.get(), worker_context_provider_, resource_lock, 273 RasterizePicture(picture.get(), worker_context_provider_, resource_lock,
272 async_worker_context_enabled_, use_distance_field_text, 274 async_worker_context_enabled_, use_distance_field_text,
273 raster_source->CanUseLCDText(), msaa_sample_count_, 275 raster_source->CanUseLCDText(),
276 raster_source->HasImpliedColorSpace(), msaa_sample_count_,
274 raster_source->image_decode_controller(), 277 raster_source->image_decode_controller(),
275 playback_settings.use_image_hijack_canvas); 278 playback_settings.use_image_hijack_canvas);
276 279
277 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM(); 280 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM();
278 281
279 // Barrier to sync worker context output to cc context. 282 // Barrier to sync worker context output to cc context.
280 gl->OrderingBarrierCHROMIUM(); 283 gl->OrderingBarrierCHROMIUM();
281 284
282 // Generate sync token after the barrier for cross context synchronization. 285 // Generate sync token after the barrier for cross context synchronization.
283 gpu::SyncToken resource_sync_token; 286 gpu::SyncToken resource_sync_token;
284 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, resource_sync_token.GetData()); 287 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, resource_sync_token.GetData());
285 resource_lock->set_sync_token(resource_sync_token); 288 resource_lock->set_sync_token(resource_sync_token);
286 resource_lock->set_synchronized(!async_worker_context_enabled_); 289 resource_lock->set_synchronized(!async_worker_context_enabled_);
287 } 290 }
288 291
289 } // namespace cc 292 } // namespace cc
OLDNEW
« no previous file with comments | « cc/raster/bitmap_raster_buffer_provider.cc ('k') | cc/raster/one_copy_raster_buffer_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698