OLD | NEW |
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 Loading... |
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(); |
31 data.opaque = bitmap.GetOpaque(); | 32 data.opaque = bitmap.GetOpaque(); |
32 fake_ui_resource_map_[uid] = data; | 33 fake_ui_resource_map_[uid] = data; |
33 } | 34 } |
34 | 35 |
35 void FakeUIResourceLayerTreeHostImpl::DeleteUIResource(UIResourceId uid) { | 36 void FakeUIResourceLayerTreeHostImpl::DeleteUIResource(UIResourceId uid) { |
36 ResourceId id = ResourceIdForUIResource(uid); | 37 ResourceId id = ResourceIdForUIResource(uid); |
37 if (id) | 38 if (id) |
38 fake_ui_resource_map_.erase(uid); | 39 fake_ui_resource_map_.erase(uid); |
39 } | 40 } |
40 | 41 |
41 ResourceId FakeUIResourceLayerTreeHostImpl::ResourceIdForUIResource( | 42 ResourceId FakeUIResourceLayerTreeHostImpl::ResourceIdForUIResource( |
42 UIResourceId uid) const { | 43 UIResourceId uid) const { |
43 UIResourceMap::const_iterator iter = fake_ui_resource_map_.find(uid); | 44 UIResourceMap::const_iterator iter = fake_ui_resource_map_.find(uid); |
44 if (iter != fake_ui_resource_map_.end()) | 45 if (iter != fake_ui_resource_map_.end()) |
45 return iter->second.resource_id; | 46 return iter->second.resource_id; |
46 return 0; | 47 return 0; |
47 } | 48 } |
48 | 49 |
49 bool FakeUIResourceLayerTreeHostImpl::IsUIResourceOpaque(UIResourceId uid) | 50 bool FakeUIResourceLayerTreeHostImpl::IsUIResourceOpaque(UIResourceId uid) |
50 const { | 51 const { |
51 UIResourceMap::const_iterator iter = fake_ui_resource_map_.find(uid); | 52 UIResourceMap::const_iterator iter = fake_ui_resource_map_.find(uid); |
52 DCHECK(iter != fake_ui_resource_map_.end()); | 53 DCHECK(iter != fake_ui_resource_map_.end()); |
53 return iter->second.opaque; | 54 return iter->second.opaque; |
54 } | 55 } |
55 | 56 |
56 } // namespace cc | 57 } // namespace cc |
OLD | NEW |