aboutsummaryrefslogtreecommitdiff
path: root/SrcUnix/EmPixMapUnix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'SrcUnix/EmPixMapUnix.cpp')
-rw-r--r--SrcUnix/EmPixMapUnix.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/SrcUnix/EmPixMapUnix.cpp b/SrcUnix/EmPixMapUnix.cpp
new file mode 100644
index 0000000..7ae7f6b
--- /dev/null
+++ b/SrcUnix/EmPixMapUnix.cpp
@@ -0,0 +1,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);
+}