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

Unified Diff: cc/resources/resource_pool.cc

Issue 1379783002: Allow one-copy task tile worker pool to use compressed textures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use memory_efficient_format* settings and revert allocation modifications Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: cc/resources/resource_pool.cc
diff --git a/cc/resources/resource_pool.cc b/cc/resources/resource_pool.cc
index 778ddbe853ca87dc4f194643d7c44bf62c6788bb..ca07646707367b6d915a570ac2d31313f620bac6 100644
--- a/cc/resources/resource_pool.cc
+++ b/cc/resources/resource_pool.cc
@@ -90,8 +90,16 @@ ResourcePool::~ResourcePool() {
DCHECK_EQ(0u, total_resource_count_);
}
-Resource* ResourcePool::AcquireResource(const gfx::Size& size,
+Resource* ResourcePool::AcquireResource(const gfx::Size& desired_size,
ResourceFormat format) {
+ gfx::Size size = desired_size;
+ if (IsResourceFormatCompressed(format) &&
+ (size.width() % 4 != 0 || size.height() % 4 != 0)) {
+ // Round the size up to the nearest multiple of four.
+ size.SetSize(4 * std::ceil(static_cast<float>(size.width()) / 4),
+ 4 * std::ceil(static_cast<float>(size.height()) / 4));
+ }
+
// Finding resources in |unused_resources_| from MRU to LRU direction, touches
// LRU resources only if needed, which increases possibility of expiring more
// LRU resources within kResourceExpirationDelayMs.

Powered by Google App Engine
This is Rietveld 408576698