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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 raster_source->PlaybackToCanvas(canvas.get(), canvas_bitmap_rect, | 227 raster_source->PlaybackToCanvas(canvas.get(), canvas_bitmap_rect, |
228 canvas_playback_rect, scale); | 228 canvas_bitmap_rect, scale); |
reveman
2015/08/10 23:19:01
Note: this change is needed to make the code below
danakj
2015/08/10 23:35:54
Can you file a bug and point to it in a TODO sayin
reveman
2015/08/10 23:49:41
Added TODO.
| |
229 | 229 |
230 SkImageInfo dst_info = | 230 { |
231 SkImageInfo::Make(info.width(), info.height(), buffer_color_type, | 231 TRACE_EVENT0("cc", "TileTaskWorkerPool::PlaybackToMemory::ConvertPixels"); |
232 info.alphaType(), info.profileType()); | 232 |
233 // TODO(kaanb): The GL pipeline assumes a 4-byte alignment for the | 233 SkImageInfo dst_info = |
234 // bitmap data. There will be no need to call SkAlign4 once crbug.com/293728 | 234 SkImageInfo::Make(info.width(), info.height(), buffer_color_type, |
235 // is fixed. | 235 info.alphaType(), info.profileType()); |
236 const size_t dst_row_bytes = SkAlign4(dst_info.minRowBytes()); | 236 // TODO(kaanb): The GL pipeline assumes a 4-byte alignment for the |
237 DCHECK_EQ(0u, dst_row_bytes % 4); | 237 // 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); | 238 // is fixed. |
239 DCHECK_EQ(true, success); | 239 const size_t dst_row_bytes = SkAlign4(dst_info.minRowBytes()); |
240 DCHECK_EQ(0u, dst_row_bytes % 4); | |
241 bool success = canvas->readPixels(dst_info, memory, dst_row_bytes, 0, 0); | |
242 DCHECK_EQ(true, success); | |
243 } | |
240 } | 244 } |
241 | 245 |
242 } // namespace cc | 246 } // namespace cc |
OLD | NEW |