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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 static_cast<float>(playback_rect.size().GetArea()) / full_rect_size; | 52 static_cast<float>(playback_rect.size().GetArea()) / full_rect_size; |
53 float fraction_saved = 1.0f - fraction_partial_rastered; | 53 float fraction_saved = 1.0f - fraction_partial_rastered; |
54 UMA_HISTOGRAM_PERCENTAGE( | 54 UMA_HISTOGRAM_PERCENTAGE( |
55 base::StringPrintf("Renderer4.%s.PartialRasterPercentageSaved.Gpu", | 55 base::StringPrintf("Renderer4.%s.PartialRasterPercentageSaved.Gpu", |
56 client_name), | 56 client_name), |
57 100.0f * fraction_saved); | 57 100.0f * fraction_saved); |
58 } | 58 } |
59 | 59 |
60 // Play back raster_source into temp SkPicture. | 60 // Play back raster_source into temp SkPicture. |
61 SkPictureRecorder recorder; | 61 SkPictureRecorder recorder; |
62 const int flags = SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag; | 62 sk_sp<SkCanvas> canvas = sk_ref_sp( |
63 sk_sp<SkCanvas> canvas = sk_ref_sp(recorder.beginRecording( | 63 recorder.beginRecording(resource_size.width(), resource_size.height())); |
64 resource_size.width(), resource_size.height(), NULL, flags)); | |
65 canvas->save(); | 64 canvas->save(); |
66 raster_source->PlaybackToCanvas(canvas.get(), raster_full_rect, playback_rect, | 65 raster_source->PlaybackToCanvas(canvas.get(), raster_full_rect, playback_rect, |
67 scale, playback_settings); | 66 scale, playback_settings); |
68 canvas->restore(); | 67 canvas->restore(); |
69 return recorder.finishRecordingAsPicture(); | 68 return recorder.finishRecordingAsPicture(); |
70 } | 69 } |
71 | 70 |
72 static void RasterizePicture(SkPicture* picture, | 71 static void RasterizePicture(SkPicture* picture, |
73 ContextProvider* context_provider, | 72 ContextProvider* context_provider, |
74 ResourceProvider::ScopedWriteLockGL* resource_lock, | 73 ResourceProvider::ScopedWriteLockGL* resource_lock, |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 gl->OrderingBarrierCHROMIUM(); | 243 gl->OrderingBarrierCHROMIUM(); |
245 | 244 |
246 // Generate sync token after the barrier for cross context synchronization. | 245 // Generate sync token after the barrier for cross context synchronization. |
247 gpu::SyncToken resource_sync_token; | 246 gpu::SyncToken resource_sync_token; |
248 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, resource_sync_token.GetData()); | 247 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, resource_sync_token.GetData()); |
249 resource_lock->set_sync_token(resource_sync_token); | 248 resource_lock->set_sync_token(resource_sync_token); |
250 resource_lock->set_synchronized(!async_worker_context_enabled_); | 249 resource_lock->set_synchronized(!async_worker_context_enabled_); |
251 } | 250 } |
252 | 251 |
253 } // namespace cc | 252 } // namespace cc |
OLD | NEW |