OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_rasterizer.h" | 5 #include "cc/raster/gpu_rasterizer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 const RasterSource* raster_source, | 43 const RasterSource* raster_source, |
44 const gfx::Rect& rect, | 44 const gfx::Rect& rect, |
45 float scale) { | 45 float scale) { |
46 // Play back raster_source into temp SkPicture. | 46 // Play back raster_source into temp SkPicture. |
47 SkPictureRecorder recorder; | 47 SkPictureRecorder recorder; |
48 gfx::Size size = write_lock->resource()->size; | 48 gfx::Size size = write_lock->resource()->size; |
49 const int flags = SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag; | 49 const int flags = SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag; |
50 skia::RefPtr<SkCanvas> canvas = skia::SharePtr( | 50 skia::RefPtr<SkCanvas> canvas = skia::SharePtr( |
51 recorder.beginRecording(size.width(), size.height(), NULL, flags)); | 51 recorder.beginRecording(size.width(), size.height(), NULL, flags)); |
52 canvas->save(); | 52 canvas->save(); |
53 raster_source->PlaybackToCanvas(canvas.get(), rect, scale); | 53 raster_source->PlaybackToCanvas(canvas.get(), rect, rect, scale); |
54 canvas->restore(); | 54 canvas->restore(); |
55 skia::RefPtr<SkPicture> picture = | 55 skia::RefPtr<SkPicture> picture = |
56 skia::AdoptRef(recorder.endRecordingAsPicture()); | 56 skia::AdoptRef(recorder.endRecordingAsPicture()); |
57 | 57 |
58 // Turn on distance fields for layers that have ever animated. | 58 // Turn on distance fields for layers that have ever animated. |
59 bool use_distance_field_text = | 59 bool use_distance_field_text = |
60 use_distance_field_text_ || | 60 use_distance_field_text_ || |
61 raster_source->ShouldAttemptToUseDistanceFieldText(); | 61 raster_source->ShouldAttemptToUseDistanceFieldText(); |
62 | 62 |
63 // Playback picture into resource. | 63 // Playback picture into resource. |
(...skipping 12 matching lines...) Expand all Loading... |
76 return; | 76 return; |
77 | 77 |
78 SkMultiPictureDraw multi_picture_draw; | 78 SkMultiPictureDraw multi_picture_draw; |
79 multi_picture_draw.add(sk_surface->getCanvas(), picture.get()); | 79 multi_picture_draw.add(sk_surface->getCanvas(), picture.get()); |
80 multi_picture_draw.draw(msaa_sample_count_ > 0); | 80 multi_picture_draw.draw(msaa_sample_count_ > 0); |
81 write_lock->ReleaseSkSurface(); | 81 write_lock->ReleaseSkSurface(); |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 } // namespace cc | 85 } // namespace cc |
OLD | NEW |