| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 return CreateTextureFromFile(uri, | 156 return CreateTextureFromFile(uri, |
| 157 filepath, | 157 filepath, |
| 158 file_type, | 158 file_type, |
| 159 generate_mipmaps); | 159 generate_mipmaps); |
| 160 } | 160 } |
| 161 | 161 |
| 162 // Creates a Texture object from a bitmap in the current render context format. | 162 // Creates a Texture object from a bitmap in the current render context format. |
| 163 Texture* Pack::CreateTextureFromBitmap(Bitmap *bitmap, const String& uri) { | 163 Texture* Pack::CreateTextureFromBitmap(Bitmap *bitmap, const String& uri) { |
| 164 DCHECK(bitmap); | 164 DCHECK(bitmap); |
| 165 | 165 |
| 166 if (!renderer_) { |
| 167 O3D_ERROR(service_locator()) << "No Render Device Available"; |
| 168 return NULL; |
| 169 } |
| 170 |
| 166 if (bitmap->width() > Texture::MAX_DIMENSION || | 171 if (bitmap->width() > Texture::MAX_DIMENSION || |
| 167 bitmap->height() > Texture::MAX_DIMENSION) { | 172 bitmap->height() > Texture::MAX_DIMENSION) { |
| 168 O3D_ERROR(service_locator()) | 173 O3D_ERROR(service_locator()) |
| 169 << "Texture (uri='" << uri | 174 << "Texture (uri='" << uri |
| 170 << "', size=" << bitmap->width() << "x" << bitmap->height() | 175 << "', size=" << bitmap->width() << "x" << bitmap->height() |
| 171 << ", mips=" << bitmap->num_mipmaps()<< ") is larger than the " | 176 << ", mips=" << bitmap->num_mipmaps()<< ") is larger than the " |
| 172 << "maximum texture size which is (" << Texture::MAX_DIMENSION | 177 << "maximum texture size which is (" << Texture::MAX_DIMENSION |
| 173 << "x" << Texture::MAX_DIMENSION << ")"; | 178 << "x" << Texture::MAX_DIMENSION << ")"; |
| 174 return NULL; | 179 return NULL; |
| 175 } | 180 } |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 388 |
| 384 bool Pack::UnregisterObject(ObjectBase *object) { | 389 bool Pack::UnregisterObject(ObjectBase *object) { |
| 385 ObjectSet::iterator find(owned_objects_.find(ObjectBase::Ref(object))); | 390 ObjectSet::iterator find(owned_objects_.find(ObjectBase::Ref(object))); |
| 386 if (find == owned_objects_.end()) | 391 if (find == owned_objects_.end()) |
| 387 return false; | 392 return false; |
| 388 | 393 |
| 389 owned_objects_.erase(find); | 394 owned_objects_.erase(find); |
| 390 return true; | 395 return true; |
| 391 } | 396 } |
| 392 } // namespace o3d | 397 } // namespace o3d |
| OLD | NEW |