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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 ResourcePool* resource_pool, | 61 ResourcePool* resource_pool, |
62 const UpdateTileDrawInfoCallback& update_tile_draw_info) { | 62 const UpdateTileDrawInfoCallback& update_tile_draw_info) { |
63 ScopedGpuRaster gpu_raster(context_provider_); | 63 ScopedGpuRaster gpu_raster(context_provider_); |
64 | 64 |
65 ScopedResourceWriteLocks locks; | 65 ScopedResourceWriteLocks locks; |
66 | 66 |
67 for (Tile* tile : tiles) { | 67 for (Tile* tile : tiles) { |
68 // TODO(hendrikw): Don't create resources for solid color tiles. | 68 // TODO(hendrikw): Don't create resources for solid color tiles. |
69 // See crbug.com/445919 | 69 // See crbug.com/445919 |
70 scoped_ptr<ScopedResource> resource = | 70 scoped_ptr<ScopedResource> resource = |
71 resource_pool->AcquireResource(tile->desired_texture_size()); | 71 resource_pool->AcquireResource(tile->desired_texture_size(), |
| 72 resource_pool->default_format()); |
72 const ScopedResource* const_resource = resource.get(); | 73 const ScopedResource* const_resource = resource.get(); |
73 | 74 |
74 RasterSource::SolidColorAnalysis analysis; | 75 RasterSource::SolidColorAnalysis analysis; |
75 | 76 |
76 if (tile->use_picture_analysis()) | 77 if (tile->use_picture_analysis()) |
77 PerformSolidColorAnalysis(tile, &analysis); | 78 PerformSolidColorAnalysis(tile, &analysis); |
78 | 79 |
79 if (!analysis.is_solid_color) | 80 if (!analysis.is_solid_color) |
80 AddToMultiPictureDraw(tile, const_resource, &locks); | 81 AddToMultiPictureDraw(tile, const_resource, &locks); |
81 | 82 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 tile->raster_source()->PlaybackToCanvas(canvas.get(), tile->content_rect(), | 140 tile->raster_source()->PlaybackToCanvas(canvas.get(), tile->content_rect(), |
140 tile->contents_scale()); | 141 tile->contents_scale()); |
141 canvas->restore(); | 142 canvas->restore(); |
142 | 143 |
143 // Add the canvas and recorded picture to |multi_picture_draw_|. | 144 // Add the canvas and recorded picture to |multi_picture_draw_|. |
144 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); | 145 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); |
145 multi_picture_draw_.add(sk_surface->getCanvas(), picture.get()); | 146 multi_picture_draw_.add(sk_surface->getCanvas(), picture.get()); |
146 } | 147 } |
147 | 148 |
148 } // namespace cc | 149 } // namespace cc |
OLD | NEW |