| 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/resources/gpu_raster_worker_pool.h" | 5 #include "cc/resources/gpu_raster_worker_pool.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "cc/output/context_provider.h" | 10 #include "cc/output/context_provider.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 bool use_distance_field_text = | 41 bool use_distance_field_text = |
| 42 use_distance_field_text_ || | 42 use_distance_field_text_ || |
| 43 raster_source->ShouldAttemptToUseDistanceFieldText(); | 43 raster_source->ShouldAttemptToUseDistanceFieldText(); |
| 44 SkSurface* sk_surface = lock_.GetSkSurface(use_distance_field_text); | 44 SkSurface* sk_surface = lock_.GetSkSurface(use_distance_field_text); |
| 45 | 45 |
| 46 if (!sk_surface) | 46 if (!sk_surface) |
| 47 return; | 47 return; |
| 48 | 48 |
| 49 SkPictureRecorder recorder; | 49 SkPictureRecorder recorder; |
| 50 gfx::Size size = resource_->size(); | 50 gfx::Size size = resource_->size(); |
| 51 const int flags = SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag; |
| 51 skia::RefPtr<SkCanvas> canvas = | 52 skia::RefPtr<SkCanvas> canvas = |
| 52 skia::SharePtr(recorder.beginRecording(size.width(), size.height())); | 53 skia::SharePtr(recorder.beginRecording(size.width(), size.height(), |
| 54 NULL, flags)); |
| 55 |
| 53 | 56 |
| 54 canvas->save(); | 57 canvas->save(); |
| 55 raster_source->PlaybackToCanvas(canvas.get(), rect, scale); | 58 raster_source->PlaybackToCanvas(canvas.get(), rect, scale); |
| 56 canvas->restore(); | 59 canvas->restore(); |
| 57 | 60 |
| 58 // Add the canvas and recorded picture to |multi_picture_draw_|. | 61 // Add the canvas and recorded picture to |multi_picture_draw_|. |
| 59 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); | 62 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); |
| 60 multi_picture_draw_->add(sk_surface->getCanvas(), picture.get()); | 63 multi_picture_draw_->add(sk_surface->getCanvas(), picture.get()); |
| 61 } | 64 } |
| 62 | 65 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 246 |
| 244 ScopedGpuRaster gpu_raster(context_provider_); | 247 ScopedGpuRaster gpu_raster(context_provider_); |
| 245 task_graph_runner_->RunUntilIdle(); | 248 task_graph_runner_->RunUntilIdle(); |
| 246 | 249 |
| 247 // Draw each all of the pictures that were collected. This will also clear | 250 // Draw each all of the pictures that were collected. This will also clear |
| 248 // the pictures and canvases added to |multi_picture_draw_| | 251 // the pictures and canvases added to |multi_picture_draw_| |
| 249 multi_picture_draw_.draw(); | 252 multi_picture_draw_.draw(); |
| 250 } | 253 } |
| 251 | 254 |
| 252 } // namespace cc | 255 } // namespace cc |
| OLD | NEW |