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

Side by Side Diff: cc/resources/resource_provider.cc

Issue 2727063002: cc: Specify rasterization color space (Closed)
Patch Set: Add comment Created 3 years, 9 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 | « no previous file | cc/trees/layer_tree_host_impl.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/resource_provider.h" 5 #include "cc/resources/resource_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 } 877 }
878 878
879 ResourceProvider::TextureHint ResourceProvider::GetTextureHint(ResourceId id) { 879 ResourceProvider::TextureHint ResourceProvider::GetTextureHint(ResourceId id) {
880 return GetResource(id)->hint; 880 return GetResource(id)->hint;
881 } 881 }
882 882
883 sk_sp<SkColorSpace> ResourceProvider::GetResourceSkColorSpace( 883 sk_sp<SkColorSpace> ResourceProvider::GetResourceSkColorSpace(
884 const Resource* resource) const { 884 const Resource* resource) const {
885 if (!settings_.enable_color_correct_rendering) 885 if (!settings_.enable_color_correct_rendering)
886 return nullptr; 886 return nullptr;
887 return resource->color_space.ToSkColorSpace(); 887 // Returning the nonlinear blended color space matches the expectation of the
888 // web that colors are blended in the output color space, not in a
889 // physically-based linear space.
890 return resource->color_space.ToNonlinearBlendedSkColorSpace();
888 } 891 }
889 892
890 void ResourceProvider::CopyToResource(ResourceId id, 893 void ResourceProvider::CopyToResource(ResourceId id,
891 const uint8_t* image, 894 const uint8_t* image,
892 const gfx::Size& image_size) { 895 const gfx::Size& image_size) {
893 Resource* resource = GetResource(id); 896 Resource* resource = GetResource(id);
894 DCHECK(!resource->locked_for_write); 897 DCHECK(!resource->locked_for_write);
895 DCHECK(!resource->lock_for_read_count); 898 DCHECK(!resource->lock_for_read_count);
896 DCHECK(resource->origin == Resource::INTERNAL); 899 DCHECK(resource->origin == Resource::INTERNAL);
897 DCHECK_EQ(resource->exported_count, 0); 900 DCHECK_EQ(resource->exported_count, 0);
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after
2172 2175
2173 const int kImportance = 2; 2176 const int kImportance = 2;
2174 pmd->CreateSharedGlobalAllocatorDump(guid); 2177 pmd->CreateSharedGlobalAllocatorDump(guid);
2175 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 2178 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
2176 } 2179 }
2177 2180
2178 return true; 2181 return true;
2179 } 2182 }
2180 2183
2181 } // namespace cc 2184 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698