Chromium Code Reviews| 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) { |