nomlib
Main Page
Related Pages
Namespaces
Classes
Files
File List
graphics
scale2x
scale4x.cpp
1
/******************************************************************************
2
3
nomlib - C++11 cross-platform game engine
4
5
Copyright (c) 2013, Jeffrey Carpenter <jeffrey.carp@gmail.com>
6
All rights reserved.
7
8
Redistribution and use in source and binary forms, with or without
9
modification, are permitted provided that the following conditions are met:
10
11
1. Redistributions of source code must retain the above copyright notice, this
12
list of conditions and the following disclaimer.
13
2. Redistributions in binary form must reproduce the above copyright notice,
14
this list of conditions and the following disclaimer in the documentation
15
and/or other materials provided with the distribution.
16
17
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28
******************************************************************************/
29
#include "nomlib/graphics/scale2x/scale2x.hpp"
30
31
namespace
nom {
32
namespace
priv {
33
34
bool
scale4x (
void
* source_buffer,
void
* destination_buffer,
35
const
int32 source_width,
const
int32 source_height,
36
const
int32 depth,
37
const
int16 source_pitch, int16 destination_pitch
38
)
39
{
40
// Save a temporary copy of the *existing* width & height for scaling
41
// calculation.
42
//int32 width = source_width;
43
//int32 height = source_height;
44
45
// The existing video surface pitch (width) is used for scaling calculations.
46
//uint16 srcpitch = source_pitch;
47
48
// We must use the new video surface configuration for computing the pitch as
49
// this is dependent upon width & height parameters.
50
//uint16 dstpitch = destination_pitch;
51
52
// Existing & resulting pixel arrays
53
//uint8* srcpix = static_cast<uint8*> ( source_buffer );
54
//uint8* dstpix = static_cast<uint8*> ( destination_buffer );
55
56
// Use the existing video surface BPP for choosing scaling algorithm.
57
switch
( depth )
58
{
59
default
:
// Err, we could not determine a valid color depth!
60
{
61
return
false
;
62
}
// end unsupported color depth
63
break
;
64
65
case
8:
66
{
67
// Not implemented
68
}
69
break
;
70
71
case
16:
72
{
73
// Not implemented
74
}
75
break
;
76
77
case
24:
78
{
79
// Not implemented
80
}
81
break
;
82
83
case
32:
84
{
85
// Not implemented
86
}
87
break
;
88
}
// end switch (BytesPerPixel)
89
90
return
false
;
91
}
92
93
94
}
// namespace priv
95
}
// namespace nom