| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 188 |
| 189 // TODO(ccameron): The target color space specified here should match the | 189 // TODO(ccameron): The target color space specified here should match the |
| 190 // target color space that will be used at rasterization time. Leave this | 190 // target color space that will be used at rasterization time. Leave this |
| 191 // unspecified now, since that will match the rasterization-time color | 191 // unspecified now, since that will match the rasterization-time color |
| 192 // space while color correct rendering is disabled. | 192 // space while color correct rendering is disabled. |
| 193 gfx::ColorSpace target_color_space; | 193 gfx::ColorSpace target_color_space; |
| 194 | 194 |
| 195 DCHECK(image); | 195 DCHECK(image); |
| 196 bool is_image_lazy = image->isLazyGenerated(); | 196 bool is_image_lazy = image->isLazyGenerated(); |
| 197 auto image_bounds = image->bounds(); | 197 auto image_bounds = image->bounds(); |
| 198 DrawImage draw_image(std::move(image), image_bounds, kNone_SkFilterQuality, | 198 // TODO(khushalsagar): Eliminate the use of an incorrect id here and have all |
| 199 SkMatrix::I(), target_color_space); | 199 // call-sites provide PaintImage to the ImageController. |
| 200 DrawImage draw_image( |
| 201 PaintImage(PaintImage::kWrongStableId, |
| 202 sk_ref_sp(const_cast<SkImage*>(image.release()))), |
| 203 image_bounds, kNone_SkFilterQuality, SkMatrix::I(), target_color_space); |
| 200 | 204 |
| 201 // Get the tasks for this decode. | 205 // Get the tasks for this decode. |
| 202 scoped_refptr<TileTask> task; | 206 scoped_refptr<TileTask> task; |
| 203 bool need_unref = false; | 207 bool need_unref = false; |
| 204 if (is_image_lazy) { | 208 if (is_image_lazy) { |
| 205 need_unref = | 209 need_unref = |
| 206 cache_->GetOutOfRasterDecodeTaskForImageAndRef(draw_image, &task); | 210 cache_->GetOutOfRasterDecodeTaskForImageAndRef(draw_image, &task); |
| 207 } | 211 } |
| 208 // If we don't need to unref this, we don't actually have a task. | 212 // If we don't need to unref this, we don't actually have a task. |
| 209 DCHECK(need_unref || !task); | 213 DCHECK(need_unref || !task); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 ImageController::ImageDecodeRequest::ImageDecodeRequest( | 378 ImageController::ImageDecodeRequest::ImageDecodeRequest( |
| 375 const ImageDecodeRequest& other) = default; | 379 const ImageDecodeRequest& other) = default; |
| 376 ImageController::ImageDecodeRequest::~ImageDecodeRequest() = default; | 380 ImageController::ImageDecodeRequest::~ImageDecodeRequest() = default; |
| 377 | 381 |
| 378 ImageController::ImageDecodeRequest& ImageController::ImageDecodeRequest:: | 382 ImageController::ImageDecodeRequest& ImageController::ImageDecodeRequest:: |
| 379 operator=(ImageDecodeRequest&& other) = default; | 383 operator=(ImageDecodeRequest&& other) = default; |
| 380 ImageController::ImageDecodeRequest& ImageController::ImageDecodeRequest:: | 384 ImageController::ImageDecodeRequest& ImageController::ImageDecodeRequest:: |
| 381 operator=(const ImageDecodeRequest& other) = default; | 385 operator=(const ImageDecodeRequest& other) = default; |
| 382 | 386 |
| 383 } // namespace cc | 387 } // namespace cc |
| OLD | NEW |