2
Copyright (c) 1993-2008, Cognitive Technologies
5
����������� ��������� ��������������� � ������������� ��� � ���� ��������� ����,
6
��� � � �������� �����, � ����������� ��� ���, ��� ���������� ��������� �������:
8
* ��� ��������� ��������������� ��������� ���� ������ ���������� ���������
9
���� ����������� �� ��������� �����, ���� ������ ������� � �����������
11
* ��� ��������� ��������������� ��������� ���� � ������������ �/��� �
12
������ ����������, ������������ ��� ���������������, ������ �����������
13
��������� ���� ���������� �� ��������� �����, ���� ������ ������� �
14
����������� ����� �� ��������.
15
* �� �������� Cognitive Technologies, �� ����� �� ����������� �� �����
16
���� ������������ � �������� �������� ��������� �/��� �����������
17
���������, ���������� �� ���� ��, ��� ���������������� �����������
20
��� ��������� ������������� ����������� ��������� ���� �/��� ������� ������ "���
21
��� ����" ��� ������-���� ���� ��������, ���������� ���� ��� ���������������,
22
������� �������� ������������ �������� � ����������� ��� ���������� ����, �� ��
23
������������� ���. �� �������� ��������� ���� � �� ���� ������ ����, �������
24
����� �������� �/��� �������� �������������� ���������, �� � ���� ������ ��
25
��Ѩ� ���������������, ������� ����� �����, ���������, ����������� ���
26
������������� ������, ��������� � �������������� ��� ���������� ����������
27
������������� ������������� ��������� (������� ������ ������, ��� ������,
28
������� ���������, ��� ������ �/��� ������ �������, ���������� ��-�� ��������
29
������� ��� �/��� ������ ��������� �������� ��������� � ������� �����������,
30
�� �� ������������� ����� ��������), �� �� ������������� ���, ���� ���� �����
31
�������� ��� ������ ���� ���� �������� � ����������� ����� ������� � ������.
33
Redistribution and use in source and binary forms, with or without modification,
34
are permitted provided that the following conditions are met:
36
* Redistributions of source code must retain the above copyright notice,
37
this list of conditions and the following disclaimer.
38
* Redistributions in binary form must reproduce the above copyright notice,
39
this list of conditions and the following disclaimer in the documentation
40
and/or other materials provided with the distribution.
41
* Neither the name of the Cognitive Technologies nor the names of its
42
contributors may be used to endorse or promote products derived from this
43
software without specific prior written permission.
45
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
46
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
47
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
48
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
49
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
51
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
52
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
53
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
54
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61
///////////////////////////////////////////////////////////////////
62
static Int32* buff=NULL;
63
static int nLines=0; // count of lines passed through buffer
64
static int width_dword =0;
66
#define DEF_SMOOTH_HEIGHT 4
67
#define MAX_SMOOTH_HEIGHT 16 // crazy...
69
static int nSmoothHeight=DEF_SMOOTH_HEIGHT; // count of lines smoothed vertically
71
Bool smooth_start(int _width_dword)
73
nSmoothHeight = LnsGetProfileInt("nSmoothHeight", DEF_SMOOTH_HEIGHT);
74
if (nSmoothHeight < 0 || nSmoothHeight > MAX_SMOOTH_HEIGHT)
75
nSmoothHeight = DEF_SMOOTH_HEIGHT;
77
if (nSmoothHeight == 0)
78
return TRUE; // no smoothing
80
width_dword = _width_dword;
81
buff = (Int32 *)(malloc(4*width_dword*(nSmoothHeight+1) ) );
85
memset(buff, 0xff, 4*width_dword*(nSmoothHeight+1) ); // start - all white
90
Int32 smooth_get_height() // count of lines joined lines
95
Int32* smooth_update(Int32* new_line)
97
if (nSmoothHeight==0 || nSmoothHeight==1)
100
int pos = 1 + (nLines % nSmoothHeight); // 1..nSmoothHeight used to keep lines
101
// 0 pos used for result
104
memcpy(buff + pos * width_dword, new_line, 4*width_dword); // save line
107
if (nSmoothHeight == 4)
110
Int32* p1=buff + width_dword;
111
Int32* p2=buff + width_dword*2;
112
Int32* p3=buff + width_dword*3;
113
Int32* p4=buff + width_dword*4;
115
int wi = width_dword;
118
*p0++ = ((*p1++) & (*p2++)) & ((*p3++) & (*p4++));
123
if (nSmoothHeight == 3)
126
Int32* p1=buff + width_dword;
127
Int32* p2=buff + width_dword*2;
128
Int32* p3=buff + width_dword*3;
130
int wi = width_dword;
133
*p0++ = ((*p1++) & (*p2++)) & ((*p3++));
136
if (nSmoothHeight == 2)
139
Int32* p1=buff + width_dword;
140
Int32* p2=buff + width_dword*2;
142
int wi = width_dword;
145
*p0++ = ((*p1++) & (*p2++));
148
if (nSmoothHeight > 4)
151
int wi = width_dword;
155
int sh = nSmoothHeight;