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

Unified Diff: core/cross/texture.cc

Issue 155276: Add ClientInfo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 11 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: core/cross/texture.cc
===================================================================
--- core/cross/texture.cc (revision 20119)
+++ core/cross/texture.cc (working copy)
@@ -34,7 +34,9 @@
#include "core/cross/precompile.h"
#include "core/cross/texture.h"
+#include "core/cross/bitmap.h"
#include "core/cross/renderer.h"
+#include "core/cross/client_info.h"
#include "core/cross/error.h"
namespace o3d {
@@ -64,6 +66,10 @@
RegisterReadOnlyParamRef(kHeightParamName, &height_param_);
width_param_->set_read_only_value(width);
height_param_->set_read_only_value(height);
+
+ ServiceDependency<ClientInfoManager> client_info_manager(service_locator);
apatrick 2009/07/09 18:22:00 Just use GetService here and below.
+ client_info_manager->AdjustTextureMemoryUsed(
+ static_cast<int>(Bitmap::GetMipChainSize(width, height, format, levels)));
}
Texture2D::~Texture2D() {
@@ -72,6 +78,13 @@
<< "Texture2D \"" << name()
<< "\" was never unlocked before being destroyed.";
}
+
+ ServiceDependency<ClientInfoManager> client_info_manager(service_locator());
+ client_info_manager->AdjustTextureMemoryUsed(
+ -static_cast<int>(Bitmap::GetMipChainSize(width(),
+ height(),
+ format(),
+ levels())));
}
ObjectBase::Ref Texture2D::Create(ServiceLocator* service_locator) {
@@ -116,6 +129,13 @@
}
RegisterReadOnlyParamRef(kEdgeLengthParamName, &edge_length_param_);
edge_length_param_->set_read_only_value(edge_length);
+
+ ServiceDependency<ClientInfoManager> client_info_manager(service_locator);
+ client_info_manager->AdjustTextureMemoryUsed(
+ static_cast<int>(Bitmap::GetMipChainSize(edge_length,
+ edge_length,
+ format,
+ levels)) * 6);
}
TextureCUBE::~TextureCUBE() {
@@ -127,6 +147,13 @@
break; // No need to report it more than once.
}
}
+
+ ServiceDependency<ClientInfoManager> client_info_manager(service_locator());
+ client_info_manager->AdjustTextureMemoryUsed(
+ -static_cast<int>(Bitmap::GetMipChainSize(edge_length(),
+ edge_length(),
+ format(),
+ levels()) * 6));
}
ObjectBase::Ref TextureCUBE::Create(ServiceLocator* service_locator) {

Powered by Google App Engine
This is Rietveld 408576698