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

Side by Side Diff: core/cross/image_utils.h

Issue 2377002: In some circumstances the O3D plugin is briefly resized to zero height,... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/o3d/
Patch Set: Created 10 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // Gets the number of mip-maps required for a full chain starting at 72 // Gets the number of mip-maps required for a full chain starting at
73 // width x height. 73 // width x height.
74 inline unsigned int ComputeMipMapCount( 74 inline unsigned int ComputeMipMapCount(
75 unsigned int width, unsigned int height) { 75 unsigned int width, unsigned int height) {
76 return 1 + base::bits::Log2Floor(std::max(width, height)); 76 return 1 + base::bits::Log2Floor(std::max(width, height));
77 } 77 }
78 78
79 // Gets the smallest power-of-two value that is at least as high as 79 // Gets the smallest power-of-two value that is at least as high as
80 // dimension. This is the POT dimension used in ScaleUpToPOT. 80 // dimension. This is the POT dimension used in ScaleUpToPOT.
81 inline unsigned int ComputePOTSize(unsigned int dimension) { 81 inline unsigned int ComputePOTSize(unsigned int dimension) {
82 return 1 << base::bits::Log2Ceiling(dimension); 82 return (dimension == 0) ? 0 : 1 << base::bits::Log2Ceiling(dimension);
83 } 83 }
84 84
85 // Computes one dimension of a mip. 85 // Computes one dimension of a mip.
86 inline unsigned ComputeMipDimension(int level, unsigned dimension) { 86 inline unsigned ComputeMipDimension(int level, unsigned dimension) {
87 unsigned v = dimension >> level; 87 unsigned v = dimension >> level;
88 return v > 0 ? v : 1u; 88 return v > 0 ? v : 1u;
89 } 89 }
90 90
91 // Computes the size of the buffer containing a mip-map chain, given its base 91 // Computes the size of the buffer containing a mip-map chain, given its base
92 // width, height, format and number of mip-map levels. 92 // width, height, format and number of mip-map levels.
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 int* src_pitch, 279 int* src_pitch,
280 int* dst_y, 280 int* dst_y,
281 int dst_width, 281 int dst_width,
282 int* dst_height); 282 int* dst_height);
283 283
284 } // namespace image 284 } // namespace image
285 } // namespace o3d 285 } // namespace o3d
286 286
287 #endif // O3D_CORE_CROSS_IMAGE_UTILS_H_ 287 #endif // O3D_CORE_CROSS_IMAGE_UTILS_H_
288 288
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698