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

Side by Side Diff: core/cross/pack.cc

Issue 159168: This fixes a number of things that are warnings in the Mac compiler.... (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_) { 166 if (!renderer_) {
167 O3D_ERROR(service_locator()) << "No Render Device Available"; 167 O3D_ERROR(service_locator()) << "No Render Device Available";
168 return NULL; 168 return NULL;
169 } 169 }
170 170
171 if (bitmap->width() > Texture::MAX_DIMENSION || 171 if (bitmap->width() > static_cast<unsigned int>(Texture::MAX_DIMENSION) ||
172 bitmap->height() > Texture::MAX_DIMENSION) { 172 bitmap->height() > static_cast<unsigned int>(Texture::MAX_DIMENSION)) {
173 O3D_ERROR(service_locator()) 173 O3D_ERROR(service_locator())
174 << "Texture (uri='" << uri 174 << "Texture (uri='" << uri
175 << "', size=" << bitmap->width() << "x" << bitmap->height() 175 << "', size=" << bitmap->width() << "x" << bitmap->height()
176 << ", mips=" << bitmap->num_mipmaps()<< ") is larger than the " 176 << ", mips=" << bitmap->num_mipmaps()<< ") is larger than the "
177 << "maximum texture size which is (" << Texture::MAX_DIMENSION 177 << "maximum texture size which is (" << Texture::MAX_DIMENSION
178 << "x" << Texture::MAX_DIMENSION << ")"; 178 << "x" << Texture::MAX_DIMENSION << ")";
179 return NULL; 179 return NULL;
180 } 180 }
181 181
182 Texture::Ref texture = renderer_->CreateTextureFromBitmap(bitmap); 182 Texture::Ref texture = renderer_->CreateTextureFromBitmap(bitmap);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 if (width > Texture::MAX_DIMENSION || 275 if (width > Texture::MAX_DIMENSION ||
276 height > Texture::MAX_DIMENSION) { 276 height > Texture::MAX_DIMENSION) {
277 O3D_ERROR(service_locator()) 277 O3D_ERROR(service_locator())
278 << "Maximum texture size is (" << Texture::MAX_DIMENSION << "x" 278 << "Maximum texture size is (" << Texture::MAX_DIMENSION << "x"
279 << Texture::MAX_DIMENSION << ")"; 279 << Texture::MAX_DIMENSION << ")";
280 return NULL; 280 return NULL;
281 } 281 }
282 282
283 if (enable_render_surfaces) { 283 if (enable_render_surfaces) {
284 if (Bitmap::GetPOTSize(width) != width || 284 if (Bitmap::GetPOTSize(width) != static_cast<unsigned int>(width) ||
285 Bitmap::GetPOTSize(height) != height) { 285 Bitmap::GetPOTSize(height) != static_cast<unsigned int>(height)) {
286 O3D_ERROR(service_locator()) << 286 O3D_ERROR(service_locator()) <<
287 "Textures with RenderSurfaces enabled must have power-of-two " 287 "Textures with RenderSurfaces enabled must have power-of-two "
288 "dimensions."; 288 "dimensions.";
289 return NULL; 289 return NULL;
290 } 290 }
291 } 291 }
292 292
293 Texture2D::Ref texture = renderer_->CreateTexture2D( 293 Texture2D::Ref texture = renderer_->CreateTexture2D(
294 width, 294 width,
295 height, 295 height,
(...skipping 19 matching lines...) Expand all
315 } 315 }
316 316
317 if (edge_length > Texture::MAX_DIMENSION) { 317 if (edge_length > Texture::MAX_DIMENSION) {
318 O3D_ERROR(service_locator()) 318 O3D_ERROR(service_locator())
319 << "Maximum edge_length is " << Texture::MAX_DIMENSION; 319 << "Maximum edge_length is " << Texture::MAX_DIMENSION;
320 return NULL; 320 return NULL;
321 } 321 }
322 322
323 323
324 if (enable_render_surfaces) { 324 if (enable_render_surfaces) {
325 if (Bitmap::GetPOTSize(edge_length) != edge_length) { 325 if (Bitmap::GetPOTSize(edge_length) !=
326 static_cast<unsigned int>(edge_length)) {
326 O3D_ERROR(service_locator()) << 327 O3D_ERROR(service_locator()) <<
327 "Textures with RenderSurfaces enabled must have power-of-two " 328 "Textures with RenderSurfaces enabled must have power-of-two "
328 "dimensions."; 329 "dimensions.";
329 return NULL; 330 return NULL;
330 } 331 }
331 } 332 }
332 333
333 TextureCUBE::Ref texture = renderer_->CreateTextureCUBE( 334 TextureCUBE::Ref texture = renderer_->CreateTextureCUBE(
334 edge_length, 335 edge_length,
335 format, 336 format,
(...skipping 15 matching lines...) Expand all
351 } 352 }
352 353
353 if (width > Texture::MAX_DIMENSION || 354 if (width > Texture::MAX_DIMENSION ||
354 height > Texture::MAX_DIMENSION) { 355 height > Texture::MAX_DIMENSION) {
355 O3D_ERROR(service_locator()) 356 O3D_ERROR(service_locator())
356 << "Maximum texture size is (" << Texture::MAX_DIMENSION << "x" 357 << "Maximum texture size is (" << Texture::MAX_DIMENSION << "x"
357 << Texture::MAX_DIMENSION << ")"; 358 << Texture::MAX_DIMENSION << ")";
358 return NULL; 359 return NULL;
359 } 360 }
360 361
361 if (Bitmap::GetPOTSize(width) != width || 362 if (Bitmap::GetPOTSize(width) != static_cast<unsigned int>(width) ||
362 Bitmap::GetPOTSize(height) != height) { 363 Bitmap::GetPOTSize(height) != static_cast<unsigned int>(height)) {
363 O3D_ERROR(service_locator()) << 364 O3D_ERROR(service_locator()) <<
364 "Depth-stencil RenderSurfaces must have power-of-two dimensions."; 365 "Depth-stencil RenderSurfaces must have power-of-two dimensions.";
365 return NULL; 366 return NULL;
366 } 367 }
367 368
368 RenderDepthStencilSurface::Ref surface = 369 RenderDepthStencilSurface::Ref surface =
369 renderer_->CreateDepthStencilSurface(width, height); 370 renderer_->CreateDepthStencilSurface(width, height);
370 371
371 if (!surface.IsNull()) { 372 if (!surface.IsNull()) {
372 RegisterObject(surface); 373 RegisterObject(surface);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 427
427 bool Pack::UnregisterObject(ObjectBase *object) { 428 bool Pack::UnregisterObject(ObjectBase *object) {
428 ObjectSet::iterator find(owned_objects_.find(ObjectBase::Ref(object))); 429 ObjectSet::iterator find(owned_objects_.find(ObjectBase::Ref(object)));
429 if (find == owned_objects_.end()) 430 if (find == owned_objects_.end())
430 return false; 431 return false;
431 432
432 owned_objects_.erase(find); 433 owned_objects_.erase(find);
433 return true; 434 return true;
434 } 435 }
435 } // namespace o3d 436 } // namespace o3d
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698