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