| 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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 DCHECK(y_contrib <= dst_height); | 608 DCHECK(y_contrib <= dst_height); |
| 609 unsigned int contrib = x_contrib * y_contrib; | 609 unsigned int contrib = x_contrib * y_contrib; |
| 610 for (unsigned int c = 0; c < components; ++c) { | 610 for (unsigned int c = 0; c < components; ++c) { |
| 611 accum[c] += | 611 accum[c] += |
| 612 contrib * src_data[(src_y * src_width + src_x) * components + c]; | 612 contrib * src_data[(src_y * src_width + src_x) * components + c]; |
| 613 } | 613 } |
| 614 } | 614 } |
| 615 } | 615 } |
| 616 for (unsigned int c = 0; c < components; ++c) { | 616 for (unsigned int c = 0; c < components; ++c) { |
| 617 uint64 value = accum[c] / (src_height * src_width); | 617 uint64 value = accum[c] / (src_height * src_width); |
| 618 DCHECK_LE(value, 255); | 618 DCHECK_LE(value, 255u); |
| 619 dst_data[(y * dst_width + x) * components + c] = | 619 dst_data[(y * dst_width + x) * components + c] = |
| 620 static_cast<unsigned char>(value); | 620 static_cast<unsigned char>(value); |
| 621 } | 621 } |
| 622 } | 622 } |
| 623 | 623 |
| 624 bool Bitmap::GenerateMipmaps(unsigned int base_width, | 624 bool Bitmap::GenerateMipmaps(unsigned int base_width, |
| 625 unsigned int base_height, | 625 unsigned int base_height, |
| 626 Texture::Format format, | 626 Texture::Format format, |
| 627 unsigned int num_mipmaps, | 627 unsigned int num_mipmaps, |
| 628 unsigned char *data) { | 628 unsigned char *data) { |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 return false; | 966 return false; |
| 967 } | 967 } |
| 968 return true; | 968 return true; |
| 969 } | 969 } |
| 970 | 970 |
| 971 ObjectBase::Ref Bitmap::Create(ServiceLocator* service_locator) { | 971 ObjectBase::Ref Bitmap::Create(ServiceLocator* service_locator) { |
| 972 return ObjectBase::Ref(new Bitmap(service_locator)); | 972 return ObjectBase::Ref(new Bitmap(service_locator)); |
| 973 } | 973 } |
| 974 | 974 |
| 975 } // namespace o3d | 975 } // namespace o3d |
| OLD | NEW |