blob: 2f37e1cedd02ac65b3eaf4440db51d406b6a849e [file] [log] [blame]
Geoff Langfe28ca02013-06-04 10:10:48 -04001//
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
15namespace rx
16{
17
18template <typename sourceType, typename colorDataType>
19void ReadColor(const void *source, void *dest)
20{
21 sourceType::readColor(reinterpret_cast<gl::Color<colorDataType>*>(dest), reinterpret_cast<const sourceType*>(source));
22}
23
24template <typename destType, typename colorDataType>
25void WriteColor(const void *source, void *dest)
26{
27 destType::writeColor(reinterpret_cast<destType*>(dest), reinterpret_cast<const gl::Color<colorDataType>*>(source));
28}
29
30template <typename sourceType, typename destType, typename colorDataType>
31void CopyPixel(const void *source, void *dest)
32{
33 colorType temp;
34 ReadColor<sourceType, colorDataType>(source, &temp);
35 WriteColor<destType, colorDataType>(&temp, dest);
36}
37
38void CopyBGRAUByteToRGBAUByte(const void *source, void *dest);
39
40}
41
42#endif // LIBGLESV2_RENDERER_COPYIMAGE_H_