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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 UNKNOWN, | 52 UNKNOWN, |
53 TGA, | 53 TGA, |
54 JPEG, | 54 JPEG, |
55 PNG, | 55 PNG, |
56 DDS, | 56 DDS, |
57 }; | 57 }; |
58 | 58 |
59 unsigned int GetNumComponentsForFormat(Texture::Format format); | 59 unsigned int GetNumComponentsForFormat(Texture::Format format); |
60 | 60 |
61 inline bool CheckImageDimensions(unsigned int width, unsigned int height) { | 61 inline bool CheckImageDimensions(unsigned int width, unsigned int height) { |
62 return width > 0 && height > 0 && | 62 return width <= kMaxImageDimension && height <= kMaxImageDimension; |
63 width <= kMaxImageDimension && height <= kMaxImageDimension; | |
64 } | 63 } |
65 | 64 |
66 // Gets the number of mip-maps required for a full chain starting at | 65 // Gets the number of mip-maps required for a full chain starting at |
67 // width x height. | 66 // width x height. |
68 inline unsigned int ComputeMipMapCount( | 67 inline unsigned int ComputeMipMapCount( |
69 unsigned int width, unsigned int height) { | 68 unsigned int width, unsigned int height) { |
70 return 1 + base::bits::Log2Floor(std::max(width, height)); | 69 return 1 + base::bits::Log2Floor(std::max(width, height)); |
71 } | 70 } |
72 | 71 |
73 // Gets the smallest power-of-two value that is at least as high as | 72 // Gets the smallest power-of-two value that is at least as high as |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 int src_bmp_width, int src_bmp_height, | 244 int src_bmp_width, int src_bmp_height, |
246 int* dest_x, int* dest_y, | 245 int* dest_x, int* dest_y, |
247 int* dest_width, int* dest_height, | 246 int* dest_width, int* dest_height, |
248 int dest_bmp_width, int dest_bmp_height); | 247 int dest_bmp_width, int dest_bmp_height); |
249 | 248 |
250 } // namespace image | 249 } // namespace image |
251 } // namespace o3d | 250 } // namespace o3d |
252 | 251 |
253 #endif // O3D_CORE_CROSS_IMAGE_UTILS_H_ | 252 #endif // O3D_CORE_CROSS_IMAGE_UTILS_H_ |
254 | 253 |
OLD | NEW |