| 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 21 matching lines...) Expand all Loading... |
| 32 multi_picture_draw_(multi_picture_draw) {} | 32 multi_picture_draw_(multi_picture_draw) {} |
| 33 | 33 |
| 34 // Overridden from RasterBuffer: | 34 // Overridden from RasterBuffer: |
| 35 virtual void Playback(const PicturePileImpl* picture_pile, | 35 virtual void Playback(const PicturePileImpl* picture_pile, |
| 36 const gfx::Rect& rect, | 36 const gfx::Rect& rect, |
| 37 float scale, | 37 float scale, |
| 38 RenderingStatsInstrumentation* stats) override { | 38 RenderingStatsInstrumentation* stats) override { |
| 39 if (!lock_.sk_surface()) | 39 if (!lock_.sk_surface()) |
| 40 return; | 40 return; |
| 41 | 41 |
| 42 // Turn on distance fields for layers that have ever animated. |
| 43 bool use_distance_field_text = picture_pile->has_transform_animated(); |
| 44 lock_.SetUseDistanceFieldText(use_distance_field_text); |
| 45 |
| 42 SkPictureRecorder recorder; | 46 SkPictureRecorder recorder; |
| 43 gfx::Size size = resource_->size(); | 47 gfx::Size size = resource_->size(); |
| 44 skia::RefPtr<SkCanvas> canvas = | 48 skia::RefPtr<SkCanvas> canvas = |
| 45 skia::SharePtr(recorder.beginRecording(size.width(), size.height())); | 49 skia::SharePtr(recorder.beginRecording(size.width(), size.height())); |
| 46 | 50 |
| 47 canvas->save(); | 51 canvas->save(); |
| 48 picture_pile->RasterToBitmap(canvas.get(), rect, scale, stats); | 52 picture_pile->RasterToBitmap(canvas.get(), rect, scale, stats); |
| 49 canvas->restore(); | 53 canvas->restore(); |
| 50 | 54 |
| 51 // Add the canvas and recorded picture to |multi_picture_draw_|. | 55 // Add the canvas and recorded picture to |multi_picture_draw_|. |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 230 |
| 227 ScopedGpuRaster gpu_raster(context_provider_); | 231 ScopedGpuRaster gpu_raster(context_provider_); |
| 228 task_graph_runner_->RunUntilIdle(); | 232 task_graph_runner_->RunUntilIdle(); |
| 229 | 233 |
| 230 // Draw each all of the pictures that were collected. This will also clear | 234 // Draw each all of the pictures that were collected. This will also clear |
| 231 // the pictures and canvases added to |multi_picture_draw_| | 235 // the pictures and canvases added to |multi_picture_draw_| |
| 232 multi_picture_draw_.draw(); | 236 multi_picture_draw_.draw(); |
| 233 } | 237 } |
| 234 | 238 |
| 235 } // namespace cc | 239 } // namespace cc |
| OLD | NEW |