Geoff Lang | fe28ca0 | 2013-06-04 10:10:48 -0400 | [diff] [blame] | 1 | // |
| 2 | // Copyright (c) 2013 The ANGLE Project Authors. All rights reserved. |
| 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
| 7 | // copyimage.h: Defines image copying functions |
| 8 | |
| 9 | #ifndef LIBGLESV2_RENDERER_COPYIMAGE_H_ |
| 10 | #define LIBGLESV2_RENDERER_COPYIMAGE_H_ |
| 11 | |
| 12 | #include "common/mathutil.h" |
| 13 | #include "libGLESv2/angletypes.h" |
| 14 | |
| 15 | namespace rx |
| 16 | { |
| 17 | |
| 18 | template <typename sourceType, typename colorDataType> |
| 19 | void ReadColor(const void *source, void *dest) |
| 20 | { |
| 21 | sourceType::readColor(reinterpret_cast<gl::Color<colorDataType>*>(dest), reinterpret_cast<const sourceType*>(source)); |
| 22 | } |
| 23 | |
| 24 | template <typename destType, typename colorDataType> |
| 25 | void WriteColor(const void *source, void *dest) |
| 26 | { |
| 27 | destType::writeColor(reinterpret_cast<destType*>(dest), reinterpret_cast<const gl::Color<colorDataType>*>(source)); |
| 28 | } |
| 29 | |
| 30 | template <typename sourceType, typename destType, typename colorDataType> |
| 31 | void CopyPixel(const void *source, void *dest) |
| 32 | { |
| 33 | colorType temp; |
| 34 | ReadColor<sourceType, colorDataType>(source, &temp); |
| 35 | WriteColor<destType, colorDataType>(&temp, dest); |
| 36 | } |
| 37 | |
| 38 | void CopyBGRAUByteToRGBAUByte(const void *source, void *dest); |
| 39 | |
| 40 | } |
| 41 | |
| 42 | #endif // LIBGLESV2_RENDERER_COPYIMAGE_H_ |