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/display_list_raster_source.h" |
11 #include "skia/ext/refptr.h" | 11 #include "skia/ext/refptr.h" |
12 #include "third_party/skia/include/core/SkCanvas.h" | 12 #include "third_party/skia/include/core/SkCanvas.h" |
13 #include "third_party/skia/include/core/SkDrawFilter.h" | 13 #include "third_party/skia/include/core/SkDrawFilter.h" |
14 #include "third_party/skia/include/core/SkSurface.h" | 14 #include "third_party/skia/include/core/SkSurface.h" |
15 | 15 |
16 namespace cc { | 16 namespace cc { |
17 namespace { | 17 namespace { |
18 | 18 |
19 class TaskSetFinishedTaskImpl : public TileTask { | 19 class TaskSetFinishedTaskImpl : public TileTask { |
20 public: | 20 public: |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 bool filter(SkPaint* paint, Type type) override { | 158 bool filter(SkPaint* paint, Type type) override { |
159 if (type == kBitmap_Type) | 159 if (type == kBitmap_Type) |
160 return false; | 160 return false; |
161 | 161 |
162 SkShader* shader = paint->getShader(); | 162 SkShader* shader = paint->getShader(); |
163 return !shader || !shader->isABitmap(); | 163 return !shader || !shader->isABitmap(); |
164 } | 164 } |
165 }; | 165 }; |
166 | 166 |
167 // static | 167 // static |
168 void TileTaskWorkerPool::PlaybackToMemory(void* memory, | 168 void TileTaskWorkerPool::PlaybackToMemory( |
169 ResourceFormat format, | 169 void* memory, |
170 const gfx::Size& size, | 170 ResourceFormat format, |
171 size_t stride, | 171 const gfx::Size& size, |
172 const RasterSource* raster_source, | 172 size_t stride, |
173 const gfx::Rect& canvas_bitmap_rect, | 173 const DisplayListRasterSource* raster_source, |
174 const gfx::Rect& canvas_playback_rect, | 174 const gfx::Rect& canvas_bitmap_rect, |
175 float scale, | 175 const gfx::Rect& canvas_playback_rect, |
176 bool include_images) { | 176 float scale, |
| 177 bool include_images) { |
177 TRACE_EVENT0("cc", "TileTaskWorkerPool::PlaybackToMemory"); | 178 TRACE_EVENT0("cc", "TileTaskWorkerPool::PlaybackToMemory"); |
178 | 179 |
179 DCHECK(IsSupportedPlaybackToMemoryFormat(format)) << format; | 180 DCHECK(IsSupportedPlaybackToMemoryFormat(format)) << format; |
180 | 181 |
181 // Uses kPremul_SkAlphaType since the result is not known to be opaque. | 182 // Uses kPremul_SkAlphaType since the result is not known to be opaque. |
182 SkImageInfo info = | 183 SkImageInfo info = |
183 SkImageInfo::MakeN32(size.width(), size.height(), kPremul_SkAlphaType); | 184 SkImageInfo::MakeN32(size.width(), size.height(), kPremul_SkAlphaType); |
184 SkColorType buffer_color_type = ResourceFormatToSkColorType(format); | 185 SkColorType buffer_color_type = ResourceFormatToSkColorType(format); |
185 bool needs_copy = buffer_color_type != info.colorType(); | 186 bool needs_copy = buffer_color_type != info.colorType(); |
186 | 187 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // bitmap data. There will be no need to call SkAlign4 once crbug.com/293728 | 229 // bitmap data. There will be no need to call SkAlign4 once crbug.com/293728 |
229 // is fixed. | 230 // is fixed. |
230 const size_t dst_row_bytes = SkAlign4(dst_info.minRowBytes()); | 231 const size_t dst_row_bytes = SkAlign4(dst_info.minRowBytes()); |
231 DCHECK_EQ(0u, dst_row_bytes % 4); | 232 DCHECK_EQ(0u, dst_row_bytes % 4); |
232 bool success = canvas->readPixels(dst_info, memory, dst_row_bytes, 0, 0); | 233 bool success = canvas->readPixels(dst_info, memory, dst_row_bytes, 0, 0); |
233 DCHECK_EQ(true, success); | 234 DCHECK_EQ(true, success); |
234 } | 235 } |
235 } | 236 } |
236 | 237 |
237 } // namespace cc | 238 } // namespace cc |
OLD | NEW |