xref: /haiku/src/apps/tv/ConvertBitmap.cpp (revision 8130a01dbe1a2553a3bdd0f9018268c31ef2ba0c)
1d4161a35SMarcus Overhagen /*
2d4161a35SMarcus Overhagen  * Copyright (c) 2004-2007 Marcus Overhagen <marcus@overhagen.de>
3d4161a35SMarcus Overhagen  *
4d4161a35SMarcus Overhagen  * Permission is hereby granted, free of charge, to any person
5d4161a35SMarcus Overhagen  * obtaining a copy of this software and associated documentation
6d4161a35SMarcus Overhagen  * files (the "Software"), to deal in the Software without restriction,
7d4161a35SMarcus Overhagen  * including without limitation the rights to use, copy, modify,
8d4161a35SMarcus Overhagen  * merge, publish, distribute, sublicense, and/or sell copies of
9d4161a35SMarcus Overhagen  * the Software, and to permit persons to whom the Software is
10d4161a35SMarcus Overhagen  * furnished to do so, subject to the following conditions:
11d4161a35SMarcus Overhagen  *
12d4161a35SMarcus Overhagen  * The above copyright notice and this permission notice shall be
13d4161a35SMarcus Overhagen  * included in all copies or substantial portions of the Software.
14d4161a35SMarcus Overhagen  *
15d4161a35SMarcus Overhagen  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16d4161a35SMarcus Overhagen  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17d4161a35SMarcus Overhagen  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18d4161a35SMarcus Overhagen  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19d4161a35SMarcus Overhagen  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20d4161a35SMarcus Overhagen  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21d4161a35SMarcus Overhagen  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22d4161a35SMarcus Overhagen  * OTHER DEALINGS IN THE SOFTWARE.
23d4161a35SMarcus Overhagen  */
24d4161a35SMarcus Overhagen 
25d4161a35SMarcus Overhagen #include <stdio.h>
26d4161a35SMarcus Overhagen #include <string.h>
27d4161a35SMarcus Overhagen #include <Debug.h>
28d4161a35SMarcus Overhagen #include <Bitmap.h>
29d4161a35SMarcus Overhagen 
30d4161a35SMarcus Overhagen #include "ConvertBitmap.h"
31d4161a35SMarcus Overhagen 
32d4161a35SMarcus Overhagen status_t ConvertBitmap_YCbCr422_to_RGB32(BBitmap *dst, const BBitmap *src);
33d4161a35SMarcus Overhagen 
34d4161a35SMarcus Overhagen status_t
ConvertBitmap(BBitmap * dst,const BBitmap * src)35d4161a35SMarcus Overhagen ConvertBitmap(BBitmap *dst, const BBitmap *src)
36d4161a35SMarcus Overhagen {
37d4161a35SMarcus Overhagen 	if (dst->Bounds() != src->Bounds())
38d4161a35SMarcus Overhagen 		return B_BAD_VALUE;
39d4161a35SMarcus Overhagen 
40*8130a01dSAdrien Destugues 	if (dst->ColorSpace() == src->ColorSpace()
41*8130a01dSAdrien Destugues 		&& dst->BytesPerRow() == src->BytesPerRow() ) {
42d4161a35SMarcus Overhagen 		memcpy(dst->Bits(), src->Bits(), src->BitsLength());
43d4161a35SMarcus Overhagen 		return B_OK;
44d4161a35SMarcus Overhagen 	}
45d4161a35SMarcus Overhagen 
46d4161a35SMarcus Overhagen 	if (src->ColorSpace() == B_YCbCr422 && dst->ColorSpace() == B_RGB32)
47d4161a35SMarcus Overhagen 		return ConvertBitmap_YCbCr422_to_RGB32(dst, src);
48d4161a35SMarcus Overhagen 
49d4161a35SMarcus Overhagen 	return B_ERROR;
50d4161a35SMarcus Overhagen }
51d4161a35SMarcus Overhagen 
52d4161a35SMarcus Overhagen 
53d4161a35SMarcus Overhagen status_t
ConvertBitmap_YCbCr422_to_RGB32(BBitmap * dst,const BBitmap * src)54d4161a35SMarcus Overhagen ConvertBitmap_YCbCr422_to_RGB32(BBitmap *dst, const BBitmap *src)
55d4161a35SMarcus Overhagen {
56d4161a35SMarcus Overhagen 	return B_ERROR;
57d4161a35SMarcus Overhagen }
58