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

Side by Side Diff: cc/paint/discardable_image_map.cc

Issue 2866173002: [WIP] cc: Use sRGB for rastering non-wide-color-gamut content
Patch Set: Created 3 years, 7 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/paint/discardable_image_map.h" 5 #include "cc/paint/discardable_image_map.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 12 matching lines...) Expand all
23 DCHECK(all_images_.empty()); 23 DCHECK(all_images_.empty());
24 return base::MakeUnique<DiscardableImageStore>( 24 return base::MakeUnique<DiscardableImageStore>(
25 bounds.width(), bounds.height(), &all_images_, &image_id_to_rect_); 25 bounds.width(), bounds.height(), &all_images_, &image_id_to_rect_);
26 } 26 }
27 27
28 void DiscardableImageMap::EndGeneratingMetadata() { 28 void DiscardableImageMap::EndGeneratingMetadata() {
29 images_rtree_.Build(all_images_, 29 images_rtree_.Build(all_images_,
30 [](const std::pair<DrawImage, gfx::Rect>& image) { 30 [](const std::pair<DrawImage, gfx::Rect>& image) {
31 return image.second; 31 return image.second;
32 }); 32 });
33 for (const auto& image_rect_pair : all_images_) {
vmpstr 2017/05/09 22:58:27 You can just pass &has_non_srgb_images_ to Discard
34 const DrawImage& draw_image = image_rect_pair.first;
35 SkColorSpace* color_space = draw_image.image()->colorSpace();
36 if (color_space && !color_space->isSRGB()) {
37 has_non_srgb_images_ = true;
38 break;
39 }
40 }
33 } 41 }
34 42
35 void DiscardableImageMap::GetDiscardableImagesInRect( 43 void DiscardableImageMap::GetDiscardableImagesInRect(
36 const gfx::Rect& rect, 44 const gfx::Rect& rect,
37 float contents_scale, 45 float contents_scale,
38 const gfx::ColorSpace& target_color_space, 46 const gfx::ColorSpace& target_color_space,
39 std::vector<DrawImage>* images) const { 47 std::vector<DrawImage>* images) const {
40 std::vector<size_t> indices; 48 std::vector<size_t> indices;
41 images_rtree_.Search(rect, &indices); 49 images_rtree_.Search(rect, &indices);
42 for (size_t index : indices) { 50 for (size_t index : indices) {
(...skipping 12 matching lines...) Expand all
55 DiscardableImageMap* image_map, 63 DiscardableImageMap* image_map,
56 const gfx::Size& bounds) 64 const gfx::Size& bounds)
57 : image_map_(image_map), 65 : image_map_(image_map),
58 image_store_(image_map->BeginGeneratingMetadata(bounds)) {} 66 image_store_(image_map->BeginGeneratingMetadata(bounds)) {}
59 67
60 DiscardableImageMap::ScopedMetadataGenerator::~ScopedMetadataGenerator() { 68 DiscardableImageMap::ScopedMetadataGenerator::~ScopedMetadataGenerator() {
61 image_map_->EndGeneratingMetadata(); 69 image_map_->EndGeneratingMetadata();
62 } 70 }
63 71
64 } // namespace cc 72 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698