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

Side by Side Diff: cc/test/fake_ui_resource_layer_tree_host_impl.cc

Issue 2276633003: Move scaling of ui resources for scrollbars to the time of upload (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scrollbarpixeltests
Patch Set: uploadscale: rebase-and-cctests Created 4 years, 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/test/fake_ui_resource_layer_tree_host_impl.h" 5 #include "cc/test/fake_ui_resource_layer_tree_host_impl.h"
6 6
7 #include "cc/resources/ui_resource_bitmap.h" 7 #include "cc/resources/ui_resource_bitmap.h"
8 #include "cc/test/fake_layer_tree_host_impl.h" 8 #include "cc/test/fake_layer_tree_host_impl.h"
9 9
10 namespace cc { 10 namespace cc {
(...skipping 10 matching lines...) Expand all
21 UIResourceId uid, 21 UIResourceId uid,
22 const UIResourceBitmap& bitmap) { 22 const UIResourceBitmap& bitmap) {
23 if (ResourceIdForUIResource(uid)) 23 if (ResourceIdForUIResource(uid))
24 DeleteUIResource(uid); 24 DeleteUIResource(uid);
25 25
26 UIResourceData data; 26 UIResourceData data;
27 data.resource_id = resource_provider()->CreateResource( 27 data.resource_id = resource_provider()->CreateResource(
28 bitmap.GetSize(), ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888, 28 bitmap.GetSize(), ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888,
29 gfx::ColorSpace()); 29 gfx::ColorSpace());
30 30
31 data.size = bitmap.GetSize();
32 data.opaque = bitmap.GetOpaque(); 31 data.opaque = bitmap.GetOpaque();
33 fake_ui_resource_map_[uid] = data; 32 fake_ui_resource_map_[uid] = data;
34 } 33 }
35 34
36 void FakeUIResourceLayerTreeHostImpl::DeleteUIResource(UIResourceId uid) { 35 void FakeUIResourceLayerTreeHostImpl::DeleteUIResource(UIResourceId uid) {
37 ResourceId id = ResourceIdForUIResource(uid); 36 ResourceId id = ResourceIdForUIResource(uid);
38 if (id) 37 if (id)
39 fake_ui_resource_map_.erase(uid); 38 fake_ui_resource_map_.erase(uid);
40 } 39 }
41 40
42 ResourceId FakeUIResourceLayerTreeHostImpl::ResourceIdForUIResource( 41 ResourceId FakeUIResourceLayerTreeHostImpl::ResourceIdForUIResource(
43 UIResourceId uid) const { 42 UIResourceId uid) const {
44 UIResourceMap::const_iterator iter = fake_ui_resource_map_.find(uid); 43 UIResourceMap::const_iterator iter = fake_ui_resource_map_.find(uid);
45 if (iter != fake_ui_resource_map_.end()) 44 if (iter != fake_ui_resource_map_.end())
46 return iter->second.resource_id; 45 return iter->second.resource_id;
47 return 0; 46 return 0;
48 } 47 }
49 48
50 bool FakeUIResourceLayerTreeHostImpl::IsUIResourceOpaque(UIResourceId uid) 49 bool FakeUIResourceLayerTreeHostImpl::IsUIResourceOpaque(UIResourceId uid)
51 const { 50 const {
52 UIResourceMap::const_iterator iter = fake_ui_resource_map_.find(uid); 51 UIResourceMap::const_iterator iter = fake_ui_resource_map_.find(uid);
53 DCHECK(iter != fake_ui_resource_map_.end()); 52 DCHECK(iter != fake_ui_resource_map_.end());
54 return iter->second.opaque; 53 return iter->second.opaque;
55 } 54 }
56 55
57 } // namespace cc 56 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698