OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/tiles/image_controller.h" | 5 #include "cc/tiles/image_controller.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/task_scheduler/post_task.h" | 8 #include "base/task_scheduler/post_task.h" |
9 #include "base/task_scheduler/task_traits.h" | 9 #include "base/task_scheduler/task_traits.h" |
10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 176 |
177 ImageController::ImageDecodeRequestId ImageController::QueueImageDecode( | 177 ImageController::ImageDecodeRequestId ImageController::QueueImageDecode( |
178 sk_sp<const SkImage> image, | 178 sk_sp<const SkImage> image, |
179 const ImageDecodedCallback& callback) { | 179 const ImageDecodedCallback& callback) { |
180 // We must not receive any image requests if we have no worker. | 180 // We must not receive any image requests if we have no worker. |
181 CHECK(worker_task_runner_); | 181 CHECK(worker_task_runner_); |
182 | 182 |
183 // Generate the next id. | 183 // Generate the next id. |
184 ImageDecodeRequestId id = s_next_image_decode_queue_id_++; | 184 ImageDecodeRequestId id = s_next_image_decode_queue_id_++; |
185 | 185 |
| 186 // TODO(ccameron): The target color space specified here should match the |
| 187 // target color space that will be used at rasterization time. Leave this |
| 188 // unspecified now, since that will match the rasterization-time color |
| 189 // space while color correct rendering is disabled. |
| 190 gfx::ColorSpace target_color_space; |
| 191 |
186 DCHECK(image); | 192 DCHECK(image); |
187 bool is_image_lazy = image->isLazyGenerated(); | 193 bool is_image_lazy = image->isLazyGenerated(); |
188 auto image_bounds = image->bounds(); | 194 auto image_bounds = image->bounds(); |
189 DrawImage draw_image(std::move(image), image_bounds, kNone_SkFilterQuality, | 195 DrawImage draw_image(std::move(image), image_bounds, kNone_SkFilterQuality, |
190 SkMatrix::I()); | 196 SkMatrix::I(), target_color_space); |
191 | 197 |
192 // Get the tasks for this decode. | 198 // Get the tasks for this decode. |
193 scoped_refptr<TileTask> task; | 199 scoped_refptr<TileTask> task; |
194 bool need_unref = false; | 200 bool need_unref = false; |
195 if (is_image_lazy) { | 201 if (is_image_lazy) { |
196 need_unref = | 202 need_unref = |
197 cache_->GetOutOfRasterDecodeTaskForImageAndRef(draw_image, &task); | 203 cache_->GetOutOfRasterDecodeTaskForImageAndRef(draw_image, &task); |
198 } | 204 } |
199 // If we don't need to unref this, we don't actually have a task. | 205 // If we don't need to unref this, we don't actually have a task. |
200 DCHECK(need_unref || !task); | 206 DCHECK(need_unref || !task); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 ImageController::ImageDecodeRequest::ImageDecodeRequest( | 371 ImageController::ImageDecodeRequest::ImageDecodeRequest( |
366 const ImageDecodeRequest& other) = default; | 372 const ImageDecodeRequest& other) = default; |
367 ImageController::ImageDecodeRequest::~ImageDecodeRequest() = default; | 373 ImageController::ImageDecodeRequest::~ImageDecodeRequest() = default; |
368 | 374 |
369 ImageController::ImageDecodeRequest& ImageController::ImageDecodeRequest:: | 375 ImageController::ImageDecodeRequest& ImageController::ImageDecodeRequest:: |
370 operator=(ImageDecodeRequest&& other) = default; | 376 operator=(ImageDecodeRequest&& other) = default; |
371 ImageController::ImageDecodeRequest& ImageController::ImageDecodeRequest:: | 377 ImageController::ImageDecodeRequest& ImageController::ImageDecodeRequest:: |
372 operator=(const ImageDecodeRequest& other) = default; | 378 operator=(const ImageDecodeRequest& other) = default; |
373 | 379 |
374 } // namespace cc | 380 } // namespace cc |
OLD | NEW |