OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/tile_task_worker_pool.h" | 5 #include "cc/raster/tile_task_worker_pool.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "cc/playback/raster_source.h" | 10 #include "cc/playback/raster_source.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
217 canvas->setDrawFilter(image_filter.get()); | 217 canvas->setDrawFilter(image_filter.get()); |
218 raster_source->PlaybackToCanvas(canvas.get(), canvas_bitmap_rect, | 218 raster_source->PlaybackToCanvas(canvas.get(), canvas_bitmap_rect, |
219 canvas_playback_rect, scale); | 219 canvas_playback_rect, scale); |
220 return; | 220 return; |
221 } | 221 } |
222 | 222 |
223 skia::RefPtr<SkSurface> surface = | 223 skia::RefPtr<SkSurface> surface = |
224 skia::AdoptRef(SkSurface::NewRaster(info, &surface_props)); | 224 skia::AdoptRef(SkSurface::NewRaster(info, &surface_props)); |
225 skia::RefPtr<SkCanvas> canvas = skia::SharePtr(surface->getCanvas()); | 225 skia::RefPtr<SkCanvas> canvas = skia::SharePtr(surface->getCanvas()); |
226 canvas->setDrawFilter(image_filter.get()); | 226 canvas->setDrawFilter(image_filter.get()); |
227 // TODO(reveman): Improve partial raster support by reducing the size of | |
228 // playback rect passed to PlaybackToCanvas. crbug.com/519070 | |
227 raster_source->PlaybackToCanvas(canvas.get(), canvas_bitmap_rect, | 229 raster_source->PlaybackToCanvas(canvas.get(), canvas_bitmap_rect, |
228 canvas_playback_rect, scale); | 230 canvas_bitmap_rect, scale); |
229 | 231 |
230 SkImageInfo dst_info = | 232 { |
231 SkImageInfo::Make(info.width(), info.height(), buffer_color_type, | 233 TRACE_EVENT0("cc", "TileTaskWorkerPool::PlaybackToMemory::ConvertPixels"); |
vmpstr
2015/08/11 17:46:17
nit: can you add a trace at the top of the functio
reveman
2015/08/11 18:11:29
Done.
| |
232 info.alphaType(), info.profileType()); | 234 |
233 // TODO(kaanb): The GL pipeline assumes a 4-byte alignment for the | 235 SkImageInfo dst_info = |
234 // bitmap data. There will be no need to call SkAlign4 once crbug.com/293728 | 236 SkImageInfo::Make(info.width(), info.height(), buffer_color_type, |
235 // is fixed. | 237 info.alphaType(), info.profileType()); |
236 const size_t dst_row_bytes = SkAlign4(dst_info.minRowBytes()); | 238 // TODO(kaanb): The GL pipeline assumes a 4-byte alignment for the |
237 DCHECK_EQ(0u, dst_row_bytes % 4); | 239 // bitmap data. There will be no need to call SkAlign4 once crbug.com/293728 |
238 bool success = canvas->readPixels(dst_info, memory, dst_row_bytes, 0, 0); | 240 // is fixed. |
239 DCHECK_EQ(true, success); | 241 const size_t dst_row_bytes = SkAlign4(dst_info.minRowBytes()); |
242 DCHECK_EQ(0u, dst_row_bytes % 4); | |
243 bool success = canvas->readPixels(dst_info, memory, dst_row_bytes, 0, 0); | |
244 DCHECK_EQ(true, success); | |
245 } | |
240 } | 246 } |
241 | 247 |
242 } // namespace cc | 248 } // namespace cc |
OLD | NEW |