2
Free Pascal port of the Hermes C library.
3
Copyright (C) 2001-2003 Nikolay Nikolov (nickysn@users.sourceforge.net)
4
Original C version by Christian Nentwich (c.nentwich@cs.ucl.ac.uk)
6
This library is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Lesser General Public
8
License as published by the Free Software Foundation; either
9
version 2.1 of the License, or (at your option) any later version.
11
This library is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
Lesser General Public License for more details.
16
You should have received a copy of the GNU Lesser General Public
17
License along with this library; if not, write to the Free Software
18
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
C straight copy routines for the HERMES library
23
Copyright (c) 1998 Christian Nentwich (c.nentwich@cs.ucl.ac.uk)
24
This source code is licensed under the GNU LGPL
26
Please refer to the file COPYING.LIB contained in the distribution for
30
Procedure CopyP_4byte(source, dest : Pchar8; count, inc_source : DWord); CDecl;
33
Move(source^, dest^, count Shl 2);
36
Procedure CopyP_3byte(source, dest : Pchar8; count, inc_source : DWord); CDecl;
39
Move(source^, dest^, count * 3);
42
Procedure CopyP_2byte(source, dest : Pchar8; count, inc_source : DWord); CDecl;
45
Move(source^, dest^, count Shl 1);
48
Procedure CopyP_1byte(source, dest : Pchar8; count, inc_source : DWord); CDecl;
51
Move(source^, dest^, count);
54
Procedure CopyP_4byte_S(source, dest : Pchar8; count, inc_source : DWord); CDecl;
62
Pint32(dest)^ := (Pint32(source)+(x Shr 16))^;
71
Procedure CopyP_3byte_S(source, dest : Pchar8; count, inc_source : DWord); CDecl;
79
dest[R_24] := source[R_24];
80
dest[G_24] := source[G_24];
81
dest[B_24] := source[B_24];
84
Inc(source, 3*(x Shr 16));
91
Procedure CopyP_2byte_S(source, dest : Pchar8; count, inc_source : DWord); CDecl;
100
If (PtrUInt(dest) And 3) <> 0 Then
102
Pshort16(dest)^ := (Pshort16(source) + (x Shr 16))^;
113
{ TODO: make fast :) }
114
p := (Pshort16(source) + (x Shr 16))^; Inc(x, inc_source);
115
p := p Or ((Pshort16(source) + (x Shr 16))^ Shl 16);
122
If (count And 1) <> 0 Then
123
Pshort16(dest)^ := (Pshort16(source) + (x Shr 16))^;
126
Procedure CopyP_1byte_S(source, dest : Pchar8; count, inc_source : DWord); CDecl;
135
While (PtrUInt(dest) And 3) <> 0 Do
137
dest^ := (source + (x Shr 16))^;
139
Inc(dest); Dec(count);
144
{ Write blocks of four pixels }
149
p := (source + (x Shr 16))^; Inc(x, inc_source);
150
p := p Or ((source + (x Shr 16))^ Shl 8); Inc(x, inc_source);
151
p := p Or ((source + (x Shr 16))^ Shl 16); Inc(x, inc_source);
152
p := p Or ((source + (x Shr 16))^ Shl 24); Inc(x, inc_source);
158
{ Write up to three trailing pixels }
163
dest^ := (source + (x Shr 16))^;