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/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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 int msaa_sample_count) { | 42 int msaa_sample_count) { |
43 ScopedGpuRaster gpu_raster(context_provider); | 43 ScopedGpuRaster gpu_raster(context_provider); |
44 | 44 |
45 ResourceProvider::ScopedSkSurfaceProvider scoped_surface( | 45 ResourceProvider::ScopedSkSurfaceProvider scoped_surface( |
46 context_provider, resource_lock, async_worker_context_enabled, | 46 context_provider, resource_lock, async_worker_context_enabled, |
47 use_distance_field_text, raster_source->CanUseLCDText(), | 47 use_distance_field_text, raster_source->CanUseLCDText(), |
48 raster_source->HasImpliedColorSpace(), msaa_sample_count); | 48 raster_source->HasImpliedColorSpace(), msaa_sample_count); |
49 SkSurface* sk_surface = scoped_surface.sk_surface(); | 49 SkSurface* sk_surface = scoped_surface.sk_surface(); |
50 // Allocating an SkSurface will fail after a lost context. Pretend we | 50 // Allocating an SkSurface will fail after a lost context. Pretend we |
51 // rasterized, as the contents of the resource don't matter anymore. | 51 // rasterized, as the contents of the resource don't matter anymore. |
52 if (!sk_surface) { | 52 if (!sk_surface) |
53 DLOG(ERROR) << "Failed to allocate raster surface"; | |
54 return; | 53 return; |
55 } | |
56 | 54 |
57 // Playback | 55 // Playback |
58 gfx::Rect playback_rect = raster_full_rect; | 56 gfx::Rect playback_rect = raster_full_rect; |
59 if (resource_has_previous_content) { | 57 if (resource_has_previous_content) { |
60 playback_rect.Intersect(raster_dirty_rect); | 58 playback_rect.Intersect(raster_dirty_rect); |
61 } | 59 } |
62 DCHECK(!playback_rect.IsEmpty()) | 60 DCHECK(!playback_rect.IsEmpty()) |
63 << "Why are we rastering a tile that's not dirty?"; | 61 << "Why are we rastering a tile that's not dirty?"; |
64 | 62 |
65 // Log a histogram of the percentage of pixels that were saved due to | 63 // Log a histogram of the percentage of pixels that were saved due to |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 gl->OrderingBarrierCHROMIUM(); | 265 gl->OrderingBarrierCHROMIUM(); |
268 | 266 |
269 // Generate sync token after the barrier for cross context synchronization. | 267 // Generate sync token after the barrier for cross context synchronization. |
270 gpu::SyncToken resource_sync_token; | 268 gpu::SyncToken resource_sync_token; |
271 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, resource_sync_token.GetData()); | 269 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, resource_sync_token.GetData()); |
272 resource_lock->set_sync_token(resource_sync_token); | 270 resource_lock->set_sync_token(resource_sync_token); |
273 resource_lock->set_synchronized(!async_worker_context_enabled_); | 271 resource_lock->set_synchronized(!async_worker_context_enabled_); |
274 } | 272 } |
275 | 273 |
276 } // namespace cc | 274 } // namespace cc |
OLD | NEW |