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

Side by Side Diff: cc/trees/layer_tree_host_impl.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 | « cc/resources/resource_provider.cc ('k') | ui/gfx/color_space.h » ('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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.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 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 bool is_likely_to_require_a_draw) { 1323 bool is_likely_to_require_a_draw) {
1324 // Proactively tell the scheduler that we expect to draw within each vsync 1324 // Proactively tell the scheduler that we expect to draw within each vsync
1325 // until we get all the tiles ready to draw. If we happen to miss a required 1325 // until we get all the tiles ready to draw. If we happen to miss a required
1326 // for draw tile here, then we will miss telling the scheduler each frame that 1326 // for draw tile here, then we will miss telling the scheduler each frame that
1327 // we intend to draw so it may make worse scheduling decisions. 1327 // we intend to draw so it may make worse scheduling decisions.
1328 is_likely_to_require_a_draw_ = is_likely_to_require_a_draw; 1328 is_likely_to_require_a_draw_ = is_likely_to_require_a_draw;
1329 } 1329 }
1330 1330
1331 gfx::ColorSpace LayerTreeHostImpl::GetTileColorSpace() const { 1331 gfx::ColorSpace LayerTreeHostImpl::GetTileColorSpace() const {
1332 if (!sync_tree()) 1332 if (!sync_tree())
1333 return gfx::ColorSpace(); 1333 return gfx::ColorSpace::CreateSRGB();
1334 return sync_tree()->device_color_space(); 1334 return sync_tree()->device_color_space();
1335 } 1335 }
1336 1336
1337 void LayerTreeHostImpl::RequestImplSideInvalidation() { 1337 void LayerTreeHostImpl::RequestImplSideInvalidation() {
1338 client_->NeedsImplSideInvalidation(); 1338 client_->NeedsImplSideInvalidation();
1339 } 1339 }
1340 1340
1341 void LayerTreeHostImpl::NotifyReadyToActivate() { 1341 void LayerTreeHostImpl::NotifyReadyToActivate() {
1342 client_->NotifyReadyToActivate(); 1342 client_->NotifyReadyToActivate();
1343 } 1343 }
(...skipping 2433 matching lines...) Expand 10 before | Expand all | Expand 10 after
3777 // Must resize the bitmap to fit within the max texture size. 3777 // Must resize the bitmap to fit within the max texture size.
3778 scaled = true; 3778 scaled = true;
3779 int edge = std::max(source_size.width(), source_size.height()); 3779 int edge = std::max(source_size.width(), source_size.height());
3780 float scale = static_cast<float>(max_texture_size - 1) / edge; 3780 float scale = static_cast<float>(max_texture_size - 1) / edge;
3781 DCHECK_LT(scale, 1.f); 3781 DCHECK_LT(scale, 1.f);
3782 upload_size = gfx::ScaleToCeiledSize(source_size, scale, scale); 3782 upload_size = gfx::ScaleToCeiledSize(source_size, scale, scale);
3783 } 3783 }
3784 3784
3785 id = resource_provider_->CreateResource( 3785 id = resource_provider_->CreateResource(
3786 upload_size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, 3786 upload_size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format,
3787 gfx::ColorSpace()); 3787 gfx::ColorSpace::CreateSRGB());
3788 3788
3789 if (!scaled) { 3789 if (!scaled) {
3790 AutoLockUIResourceBitmap bitmap_lock(bitmap); 3790 AutoLockUIResourceBitmap bitmap_lock(bitmap);
3791 auto* pixels = bitmap_lock.GetPixels(); 3791 auto* pixels = bitmap_lock.GetPixels();
3792 resource_provider_->CopyToResource(id, pixels, source_size); 3792 resource_provider_->CopyToResource(id, pixels, source_size);
3793 } else { 3793 } else {
3794 // Only support auto-resizing for N32 textures (since this is primarily for 3794 // Only support auto-resizing for N32 textures (since this is primarily for
3795 // scrollbars). Users of other types need to ensure they are not too big. 3795 // scrollbars). Users of other types need to ensure they are not too big.
3796 DCHECK_EQ(bitmap.GetFormat(), UIResourceBitmap::RGBA8); 3796 DCHECK_EQ(bitmap.GetFormat(), UIResourceBitmap::RGBA8);
3797 3797
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
4159 worker_context_visibility_ = 4159 worker_context_visibility_ =
4160 worker_context->CacheController()->ClientBecameVisible(); 4160 worker_context->CacheController()->ClientBecameVisible();
4161 } else { 4161 } else {
4162 worker_context->CacheController()->ClientBecameNotVisible( 4162 worker_context->CacheController()->ClientBecameNotVisible(
4163 std::move(worker_context_visibility_)); 4163 std::move(worker_context_visibility_));
4164 } 4164 }
4165 } 4165 }
4166 } 4166 }
4167 4167
4168 } // namespace cc 4168 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | ui/gfx/color_space.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698