1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/* -*- mode: C++; tab-width: 4 -*- */
/* ===================================================================== *\
Copyright (c) 2000-2001 Palm, Inc. or its subsidiaries.
All rights reserved.
This file is part of the Palm OS Emulator.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
\* ===================================================================== */
#include "EmCommon.h"
#include "EmPixMapUnix.h"
// ---------------------------------------------------------------------------
// ¥ ConvertPixMapToHost
// ---------------------------------------------------------------------------
void ConvertPixMapToHost ( const EmPixMap& src, void* dest,
int firstLine, int lastLine, Bool scale)
{
// Determine a lot of the values we'll need.
int factor = scale ? 2 : 1;
EmPoint factorPoint = EmPoint (factor, factor);
EmPoint srcSize = src.GetSize ();
EmPixMapRowBytes destRowBytes = srcSize.fX * 3 * factor;
// Finally, copy the bits, converting to 24 bit format along the way.
EmPixMap wrapper;
wrapper.SetSize (srcSize * factorPoint);
wrapper.SetFormat (kPixMapFormat24RGB);
wrapper.SetRowBytes (destRowBytes);
wrapper.SetColorTable (src.GetColorTable ());
wrapper.SetBits (dest);
EmRect srcBounds (0, firstLine, srcSize.fX, lastLine);
EmRect destBounds (srcBounds * factorPoint);
EmPixMap::CopyRect (wrapper, src, destBounds, srcBounds);
}
|