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/resources/image_raster_worker_pool.h" | 5 #include "cc/resources/image_raster_worker_pool.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "cc/debug/traced_value.h" | 9 #include "cc/debug/traced_value.h" |
10 #include "cc/resources/resource.h" | 10 #include "cc/resources/resource.h" |
(...skipping 16 matching lines...) Expand all Loading... | |
27 stride_(stride), | 27 stride_(stride), |
28 reply_(reply) { | 28 reply_(reply) { |
29 } | 29 } |
30 | 30 |
31 // Overridden from internal::WorkerPoolTask: | 31 // Overridden from internal::WorkerPoolTask: |
32 virtual void RunOnWorkerThread(unsigned thread_index) OVERRIDE { | 32 virtual void RunOnWorkerThread(unsigned thread_index) OVERRIDE { |
33 TRACE_EVENT0("cc", "ImageWorkerPoolTaskImpl::RunOnWorkerThread"); | 33 TRACE_EVENT0("cc", "ImageWorkerPoolTaskImpl::RunOnWorkerThread"); |
34 if (!buffer_) | 34 if (!buffer_) |
35 return; | 35 return; |
36 | 36 |
37 SkBitmap bitmap; | 37 task_->RunOnWorkerThread(thread_index, buffer_, task_->resource()->size()); |
Sami
2013/09/05 14:13:26
Any reason not to pass the bitmap into RunOnWorker
reveman
2013/09/05 16:24:17
you're no longer respecting the value of |stride_|
kaanb
2013/09/06 02:05:54
Done.
kaanb
2013/09/06 02:05:54
Basically it is to ensure the result of copyTo end
| |
38 bitmap.setConfig(SkBitmap::kARGB_8888_Config, | |
39 task_->resource()->size().width(), | |
40 task_->resource()->size().height(), | |
41 stride_); | |
42 bitmap.setPixels(buffer_); | |
43 SkBitmapDevice device(bitmap); | |
44 task_->RunOnWorkerThread(&device, thread_index); | |
45 } | 38 } |
46 virtual void CompleteOnOriginThread() OVERRIDE { | 39 virtual void CompleteOnOriginThread() OVERRIDE { |
47 reply_.Run(!HasFinishedRunning()); | 40 reply_.Run(!HasFinishedRunning()); |
48 } | 41 } |
49 | 42 |
50 private: | 43 private: |
51 virtual ~ImageWorkerPoolTaskImpl() {} | 44 virtual ~ImageWorkerPoolTaskImpl() {} |
52 | 45 |
53 scoped_refptr<internal::RasterWorkerPoolTask> task_; | 46 scoped_refptr<internal::RasterWorkerPoolTask> task_; |
54 uint8_t* buffer_; | 47 uint8_t* buffer_; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 if (is_required_for_activation) { | 214 if (is_required_for_activation) { |
222 raster_required_for_activation_finished_node->add_dependency(); | 215 raster_required_for_activation_finished_node->add_dependency(); |
223 image_node->add_dependent(raster_required_for_activation_finished_node); | 216 image_node->add_dependent(raster_required_for_activation_finished_node); |
224 } | 217 } |
225 | 218 |
226 raster_finished_node->add_dependency(); | 219 raster_finished_node->add_dependency(); |
227 image_node->add_dependent(raster_finished_node); | 220 image_node->add_dependent(raster_finished_node); |
228 } | 221 } |
229 | 222 |
230 } // namespace cc | 223 } // namespace cc |
OLD | NEW |