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/resources/gpu_rasterizer.h" | 5 #include "cc/resources/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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 new ResourceProvider::ScopedWriteLockGr(resource_provider_, | 121 new ResourceProvider::ScopedWriteLockGr(resource_provider_, |
122 resource->id())); | 122 resource->id())); |
123 SkSurface* sk_surface = lock->GetSkSurface( | 123 SkSurface* sk_surface = lock->GetSkSurface( |
124 use_distance_field_text, tile->raster_source()->CanUseLCDText()); | 124 use_distance_field_text, tile->raster_source()->CanUseLCDText()); |
125 | 125 |
126 locks->push_back(lock.Pass()); | 126 locks->push_back(lock.Pass()); |
127 | 127 |
128 if (!sk_surface) | 128 if (!sk_surface) |
129 return; | 129 return; |
130 | 130 |
| 131 SkRTreeFactory factory; |
131 SkPictureRecorder recorder; | 132 SkPictureRecorder recorder; |
132 gfx::Size size = resource->size(); | 133 gfx::Size size = resource->size(); |
133 const int flags = SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag; | 134 const int flags = SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag; |
134 skia::RefPtr<SkCanvas> canvas = skia::SharePtr( | 135 skia::RefPtr<SkCanvas> canvas = skia::SharePtr( |
135 recorder.beginRecording(size.width(), size.height(), NULL, flags)); | 136 recorder.beginRecording(size.width(), size.height(), &factory, flags)); |
136 | 137 |
137 canvas->save(); | 138 canvas->save(); |
138 tile->raster_source()->PlaybackToCanvas(canvas.get(), tile->content_rect(), | 139 tile->raster_source()->PlaybackToCanvas(canvas.get(), tile->content_rect(), |
139 tile->contents_scale()); | 140 tile->contents_scale()); |
140 canvas->restore(); | 141 canvas->restore(); |
141 | 142 |
142 // Add the canvas and recorded picture to |multi_picture_draw_|. | 143 // Add the canvas and recorded picture to |multi_picture_draw_|. |
143 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); | 144 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); |
144 multi_picture_draw_.add(sk_surface->getCanvas(), picture.get()); | 145 multi_picture_draw_.add(sk_surface->getCanvas(), picture.get()); |
145 } | 146 } |
146 | 147 |
147 } // namespace cc | 148 } // namespace cc |
OLD | NEW |