OLD | NEW |
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 #ifndef CC_RESOURCES_PRIORITIZED_RESOURCE_H_ | 5 #ifndef CC_RESOURCES_PRIORITIZED_RESOURCE_H_ |
6 #define CC_RESOURCES_PRIORITIZED_RESOURCE_H_ | 6 #define CC_RESOURCES_PRIORITIZED_RESOURCE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // by not painting occluded textures. In this case the manager refuses all | 72 // by not painting occluded textures. In this case the manager refuses all |
73 // visible textures and RequestLate() will enable CanAcquireBackingTexture() | 73 // visible textures and RequestLate() will enable CanAcquireBackingTexture() |
74 // on a call-order basis. We might want to just remove this in the future | 74 // on a call-order basis. We might want to just remove this in the future |
75 // (carefully) and just make sure we don't regress OOMs situations. | 75 // (carefully) and just make sure we don't regress OOMs situations. |
76 bool RequestLate(); | 76 bool RequestLate(); |
77 | 77 |
78 // Update pixels of backing resource from image. This functions will aquire | 78 // Update pixels of backing resource from image. This functions will aquire |
79 // the backing if needed. | 79 // the backing if needed. |
80 void SetPixels(ResourceProvider* resource_provider, | 80 void SetPixels(ResourceProvider* resource_provider, |
81 const uint8_t* image, | 81 const uint8_t* image, |
82 gfx::Rect image_rect, | 82 const gfx::Rect& image_rect, |
83 gfx::Rect source_rect, | 83 const gfx::Rect& source_rect, |
84 gfx::Vector2d dest_offset); | 84 gfx::Vector2d dest_offset); |
85 | 85 |
86 ResourceProvider::ResourceId resource_id() const { | 86 ResourceProvider::ResourceId resource_id() const { |
87 return backing_ ? backing_->id() : 0; | 87 return backing_ ? backing_->id() : 0; |
88 } | 88 } |
89 | 89 |
90 // Self-managed textures are accounted for when prioritizing other textures, | 90 // Self-managed textures are accounted for when prioritizing other textures, |
91 // but they are not allocated/recycled/deleted, so this needs to be done | 91 // but they are not allocated/recycled/deleted, so this needs to be done |
92 // externally. CanAcquireBackingTexture() indicates if the texture would have | 92 // externally. CanAcquireBackingTexture() indicates if the texture would have |
93 // been allowed given its priority. | 93 // been allowed given its priority. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 176 |
177 Backing* backing_; | 177 Backing* backing_; |
178 PrioritizedResourceManager* manager_; | 178 PrioritizedResourceManager* manager_; |
179 | 179 |
180 DISALLOW_COPY_AND_ASSIGN(PrioritizedResource); | 180 DISALLOW_COPY_AND_ASSIGN(PrioritizedResource); |
181 }; | 181 }; |
182 | 182 |
183 } // namespace cc | 183 } // namespace cc |
184 | 184 |
185 #endif // CC_RESOURCES_PRIORITIZED_RESOURCE_H_ | 185 #endif // CC_RESOURCES_PRIORITIZED_RESOURCE_H_ |
OLD | NEW |