| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 skia::RefPtr<SkCanvas> canvas = skia::SharePtr(surface->getCanvas()); | 186 skia::RefPtr<SkCanvas> canvas = skia::SharePtr(surface->getCanvas()); |
| 187 raster_source->PlaybackToCanvas(canvas.get(), rect, scale); | 187 raster_source->PlaybackToCanvas(canvas.get(), rect, scale); |
| 188 return; | 188 return; |
| 189 } | 189 } |
| 190 | 190 |
| 191 skia::RefPtr<SkSurface> surface = | 191 skia::RefPtr<SkSurface> surface = |
| 192 skia::AdoptRef(SkSurface::NewRaster(info, &surface_props)); | 192 skia::AdoptRef(SkSurface::NewRaster(info, &surface_props)); |
| 193 skia::RefPtr<SkCanvas> canvas = skia::SharePtr(surface->getCanvas()); | 193 skia::RefPtr<SkCanvas> canvas = skia::SharePtr(surface->getCanvas()); |
| 194 raster_source->PlaybackToCanvas(canvas.get(), rect, scale); | 194 raster_source->PlaybackToCanvas(canvas.get(), rect, scale); |
| 195 | 195 |
| 196 SkImageInfo dst_info = info; | 196 SkImageInfo dst_info = |
| 197 dst_info.fColorType = buffer_color_type; | 197 SkImageInfo::Make(info.width(), info.height(), buffer_color_type, |
| 198 info.alphaType(), info.profileType()); |
| 198 // TODO(kaanb): The GL pipeline assumes a 4-byte alignment for the | 199 // TODO(kaanb): The GL pipeline assumes a 4-byte alignment for the |
| 199 // bitmap data. There will be no need to call SkAlign4 once crbug.com/293728 | 200 // bitmap data. There will be no need to call SkAlign4 once crbug.com/293728 |
| 200 // is fixed. | 201 // is fixed. |
| 201 const size_t dst_row_bytes = SkAlign4(dst_info.minRowBytes()); | 202 const size_t dst_row_bytes = SkAlign4(dst_info.minRowBytes()); |
| 202 DCHECK_EQ(0u, dst_row_bytes % 4); | 203 DCHECK_EQ(0u, dst_row_bytes % 4); |
| 203 bool success = canvas->readPixels(dst_info, memory, dst_row_bytes, 0, 0); | 204 bool success = canvas->readPixels(dst_info, memory, dst_row_bytes, 0, 0); |
| 204 DCHECK_EQ(true, success); | 205 DCHECK_EQ(true, success); |
| 205 } | 206 } |
| 206 | 207 |
| 207 } // namespace cc | 208 } // namespace cc |
| OLD | NEW |