Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: cc/tiles/image_controller.cc

Issue 2928433003: cc: Add scaling for checkered images. (Closed)
Patch Set: .. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/tiles/image_controller.h ('k') | cc/tiles/image_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 std::vector<DrawImage> images, 171 std::vector<DrawImage> images,
172 const ImageDecodeCache::TracingInfo& tracing_info) { 172 const ImageDecodeCache::TracingInfo& tracing_info) {
173 std::vector<scoped_refptr<TileTask>> new_tasks; 173 std::vector<scoped_refptr<TileTask>> new_tasks;
174 GetTasksForImagesAndRef(&images, &new_tasks, tracing_info); 174 GetTasksForImagesAndRef(&images, &new_tasks, tracing_info);
175 UnrefImages(predecode_locked_images_); 175 UnrefImages(predecode_locked_images_);
176 predecode_locked_images_ = std::move(images); 176 predecode_locked_images_ = std::move(images);
177 return new_tasks; 177 return new_tasks;
178 } 178 }
179 179
180 ImageController::ImageDecodeRequestId ImageController::QueueImageDecode( 180 ImageController::ImageDecodeRequestId ImageController::QueueImageDecode(
181 sk_sp<const SkImage> image, 181 const DrawImage& draw_image,
182 const ImageDecodedCallback& callback) { 182 const ImageDecodedCallback& callback) {
183 // We must not receive any image requests if we have no worker. 183 // We must not receive any image requests if we have no worker.
184 CHECK(worker_task_runner_); 184 CHECK(worker_task_runner_);
185 185
186 // Generate the next id. 186 // Generate the next id.
187 ImageDecodeRequestId id = s_next_image_decode_queue_id_++; 187 ImageDecodeRequestId id = s_next_image_decode_queue_id_++;
188 188
189 // TODO(ccameron): The target color space specified here should match the 189 DCHECK(draw_image.image());
190 // target color space that will be used at rasterization time. Leave this 190 bool is_image_lazy = draw_image.image()->isLazyGenerated();
191 // unspecified now, since that will match the rasterization-time color
192 // space while color correct rendering is disabled.
193 gfx::ColorSpace target_color_space;
194
195 DCHECK(image);
196 bool is_image_lazy = image->isLazyGenerated();
197 auto image_bounds = image->bounds();
198 // TODO(khushalsagar): Eliminate the use of an incorrect id here and have all
199 // call-sites provide PaintImage to the ImageController.
200 DrawImage draw_image(
201 PaintImage(PaintImage::kUnknownStableId,
202 sk_sp<SkImage>(const_cast<SkImage*>(image.release()))),
203 image_bounds, kNone_SkFilterQuality, SkMatrix::I(), target_color_space);
204 191
205 // Get the tasks for this decode. 192 // Get the tasks for this decode.
206 scoped_refptr<TileTask> task; 193 scoped_refptr<TileTask> task;
207 bool need_unref = false; 194 bool need_unref = false;
208 if (is_image_lazy) { 195 if (is_image_lazy) {
209 need_unref = 196 need_unref =
210 cache_->GetOutOfRasterDecodeTaskForImageAndRef(draw_image, &task); 197 cache_->GetOutOfRasterDecodeTaskForImageAndRef(draw_image, &task);
211 } 198 }
212 // If we don't need to unref this, we don't actually have a task. 199 // If we don't need to unref this, we don't actually have a task.
213 DCHECK(need_unref || !task); 200 DCHECK(need_unref || !task);
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 ImageController::ImageDecodeRequest::ImageDecodeRequest( 365 ImageController::ImageDecodeRequest::ImageDecodeRequest(
379 const ImageDecodeRequest& other) = default; 366 const ImageDecodeRequest& other) = default;
380 ImageController::ImageDecodeRequest::~ImageDecodeRequest() = default; 367 ImageController::ImageDecodeRequest::~ImageDecodeRequest() = default;
381 368
382 ImageController::ImageDecodeRequest& ImageController::ImageDecodeRequest:: 369 ImageController::ImageDecodeRequest& ImageController::ImageDecodeRequest::
383 operator=(ImageDecodeRequest&& other) = default; 370 operator=(ImageDecodeRequest&& other) = default;
384 ImageController::ImageDecodeRequest& ImageController::ImageDecodeRequest:: 371 ImageController::ImageDecodeRequest& ImageController::ImageDecodeRequest::
385 operator=(const ImageDecodeRequest& other) = default; 372 operator=(const ImageDecodeRequest& other) = default;
386 373
387 } // namespace cc 374 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/image_controller.h ('k') | cc/tiles/image_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698