Code

GSoC C++-ificiation merge and cleanup.
[inkscape.git] / src / extension / internal / win32.cpp
index 85f502f00e8d2eb1222df7c024949eb9c9b40584..8b4ff13c840b34138f4bd1cb202a5be47fa50251 100644 (file)
@@ -1,21 +1,22 @@
-#define __SP_MODULE_WIN32_C__
-
-/*
- * Windows stuff
- *
- * Author:
+/** @file
+ * @brief Windows-specific stuff
+ */
+/* Author:
  *   Lauris Kaplinski <lauris@kaplinski.com>
+ *   Abhishek Sharma
  *
  * This code is in public domain
  */
 
+#ifdef WIN32
+
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
 #include <glib/gmem.h>
 #include <libnr/nr-macros.h>
-#include <libnr/nr-matrix.h>
+#include <2geom/transforms.h>
 
 #include "display/nr-arena-item.h"
 #include "display/nr-arena.h"
@@ -226,10 +227,10 @@ PrintWin32::begin (Inkscape::Extension::Print *mod, SPDocument *doc)
     };
     int res;
 
-    _PageWidth = sp_document_width (doc);
-    _PageHeight = sp_document_height (doc);
+    _PageWidth = doc->getWidth ();
+    _PageHeight = doc->getHeight ();
 
-    di.lpszDocName = SP_DOCUMENT_NAME (doc);
+    di.lpszDocName = doc->getName();
 
     SPWin32Modal = TRUE;
 
@@ -251,7 +252,6 @@ PrintWin32::finish (Inkscape::Extension::Print *mod)
     float scalex, scaley;
     int x0, y0, x1, y1;
     int width, height;
-    NR::Matrix affine;
     unsigned char *px;
     int sheight, row;
     BITMAPINFO bmInfo = {
@@ -293,14 +293,9 @@ PrintWin32::finish (Inkscape::Extension::Print *mod)
     scaley = dpiY / 72.0;
 
     // We simply map document 0,0 to physical page 0,0
-    affine[0] = scalex / 1.25;
-    affine[1] = 0.0;
-    affine[2] = 0.0;
-    affine[3] = scaley / 1.25;
-    affine[4] = 0.0;
-    affine[5] = 0.0;
+    Geom::Matrix affine = Geom::Scale(scalex / 1.25, scaley / 1.25);
 
-    nr_arena_item_set_transform (mod->root, &affine);
+    nr_arena_item_set_transform (mod->root, affine);
 
     // Calculate printable area in device coordinates
     x0 = pPhysicalOffsetX;
@@ -333,7 +328,7 @@ PrintWin32::finish (Inkscape::Extension::Print *mod)
         bbox.x1 = bbox.x0 + width;
         bbox.y1 = bbox.y0 + num_rows;
         /* Update to renderable state */
-        gc.transform.set_identity();
+        gc.transform.setIdentity();
         nr_arena_item_invoke_update (mod->root, &bbox, &gc, NR_ARENA_ITEM_STATE_ALL, NR_ARENA_ITEM_STATE_NONE);
 
         nr_pixblock_setup_extern (&pb, NR_PIXBLOCK_MODE_R8G8B8A8N, bbox.x0, bbox.y0, bbox.x1, bbox.y1, px, 4 * (bbox.x1 - bbox.x0), FALSE, FALSE);
@@ -500,3 +495,16 @@ PrintWin32::init (void)
 }  /* namespace Internal */
 }  /* namespace Extension */
 }  /* namespace Inkscape */
+
+#endif // ifdef WIN32
+
+/*
+  Local Variables:
+  mode:c++
+  c-file-style:"stroustrup"
+  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+  indent-tabs-mode:nil
+  fill-column:99
+  End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :