[Libreoffice-commits] core.git: Branch 'feature/tiledrendering' - sw/Executable_tiledrendering.mk sw/qa

Jan Holesovsky kendy at collabora.com
Wed Oct 23 05:03:20 PDT 2013


 sw/Executable_tiledrendering.mk         |    6 
 sw/qa/tiledrendering/tiledrendering.cxx |   60 +++-
 sw/qa/tiledrendering/tiledrendering.ui  |  390 ++++++++++++++++----------------
 3 files changed, 259 insertions(+), 197 deletions(-)

New commits:
commit b2867c6f9270d600577df7bb26e78b1d0e80ad0f
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Oct 23 14:01:47 2013 +0200

    Tiled rendering: Do the same thing as in touch_lo_draw_tile().
    
    Change-Id: I6cfea5cb0fbc209cb378892c6959098965e7b5ef

diff --git a/sw/Executable_tiledrendering.mk b/sw/Executable_tiledrendering.mk
index d6d3da8..e174950 100644
--- a/sw/Executable_tiledrendering.mk
+++ b/sw/Executable_tiledrendering.mk
@@ -16,6 +16,12 @@ $(eval $(call gb_Executable_use_api,tiledrendering,\
     udkapi \
 ))
 
+$(eval $(call gb_Executable_set_include,tiledrendering,\
+    -I$(SRCDIR)/sw/inc \
+    -I$(SRCDIR)/sw/source/ui/inc \
+    $$(INCLUDE) \
+))
+
 $(eval $(call gb_Executable_use_static_libraries,tiledrendering,\
     vclmain \
 ))
diff --git a/sw/qa/tiledrendering/tiledrendering.cxx b/sw/qa/tiledrendering/tiledrendering.cxx
index 3a7a096..148a720 100644
--- a/sw/qa/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/tiledrendering/tiledrendering.cxx
@@ -7,10 +7,6 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/ucb/UniversalContentBroker.hpp>
 #include <comphelper/processfactory.hxx>
 #include <cppuhelper/bootstrap.hxx>
 #include <osl/file.hxx>
@@ -22,7 +18,15 @@
 #include <vcl/field.hxx>
 #include <vcl/button.hxx>
 #include <vcl/fixed.hxx>
+#include <vcl/virdev.hxx>
 #include <sfx2/filedlghelper.hxx>
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
 #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
 #include <com/sun/star/uno/XInterface.hpp>
@@ -55,6 +59,12 @@ class TiledRenderingDialog: public ModalDialog
 {
 private:
     TiledRenderingApp *mpApp;
+    NumericField *mpContextWidth;
+    NumericField *mpContextHeight;
+    NumericField *mpTilePosX;
+    NumericField *mpTilePosY;
+    NumericField *mpTileWidth;
+    NumericField *mpTileHeight;
     FixedImage *mpImage;
 
 public:
@@ -72,6 +82,12 @@ public:
 
         SetStyle(GetStyle()|WB_CLOSEABLE);
 
+        get(mpContextWidth, "spinContextWidth");
+        get(mpContextHeight, "spinContextHeight");
+        get(mpTilePosX, "spinTilePosX");
+        get(mpTilePosY, "spinTilePosY");
+        get(mpTileWidth, "spinTileWidth");
+        get(mpTileHeight, "spinTileHeight");
         get(mpImage, "imageTile");
     }
 
@@ -82,24 +98,40 @@ public:
     DECL_LINK ( RenderHdl, Button * );
     DECL_LINK ( ChooseDocumentHdl, Button * );
 
-    sal_Int32 ExtractInt(const char * name)
+    int extractInt(const NumericField *pField)
     {
-        NumericField * pField;
-        get(pField, name);
         OUString aString(pField->GetText());
         return aString.toInt32();
     }
-
 };
 
 IMPL_LINK ( TiledRenderingDialog,  RenderHdl, Button *, EMPTYARG )
 {
-    ExtractInt("spinContextWidth");
-    ExtractInt("spinContextHeight");
-    ExtractInt("spinTilePosX");
-    ExtractInt("spinTilePosY");
-    ExtractInt("spinTileWidth");
-    ExtractInt("spinTileHeight");
+    int contextWidth = extractInt(mpContextWidth);
+    int contextHeight = extractInt(mpContextHeight);
+    int tilePosX = extractInt(mpTilePosX);
+    int tilePosY = extractInt(mpTilePosY);
+    int tileWidth = extractInt(mpTileWidth);
+    int tileHeight = extractInt(mpTileHeight);
+
+    // do the same thing we are doing in touch_lo_draw_tile()
+    SwWrtShell *pViewShell = GetActiveWrtShell();
+
+    if (pViewShell)
+    {
+        // TODO create a VirtualDevice based on SystemGraphicsData instead so
+        // that we get direct rendering; something like:
+        //
+        // SystemGraphicsData aData;
+        // [setup the aData]
+        // VirtualDevice aDevice(&aData, [color depth]);
+        VirtualDevice aDevice;
+        aDevice.SetOutputSizePixel(Size(contextWidth, contextHeight));
+
+        pViewShell->PaintTile(&aDevice, Rectangle(tilePosX, tilePosY, tileWidth, tileHeight));
+        //TODO now get it to the 'context'
+    }
+
     return 1;
 }
 
diff --git a/sw/qa/tiledrendering/tiledrendering.ui b/sw/qa/tiledrendering/tiledrendering.ui
index 22222d4..59dc1e6 100644
--- a/sw/qa/tiledrendering/tiledrendering.ui
+++ b/sw/qa/tiledrendering/tiledrendering.ui
@@ -1,243 +1,267 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="lower">1</property>
+    <property name="upper">1000</property>
+    <property name="value">256</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment2">
+    <property name="upper">10000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
   <object class="GtkWindow" id="TiledRendering">
     <property name="can_focus">False</property>
     <child>
       <object class="GtkBox" id="box1">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="border_width">12</property>
+        <property name="spacing">12</property>
         <child>
-          <object class="GtkBox" id="box2">
+          <object class="GtkBox" id="box7">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="orientation">vertical</property>
+            <property name="spacing">12</property>
             <child>
-              <object class="GtkBox" id="box3">
+              <object class="GtkGrid" id="grid2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="row_spacing">12</property>
+                <property name="column_spacing">13</property>
                 <child>
-                  <object class="GtkBox" id="box4">
+                  <object class="GtkLabel" id="labelContextWidth">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="orientation">vertical</property>
-                    <child>
-                      <object class="GtkLabel" id="labelContextWidth">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">contextWidth</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="labelContextHeight">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">contextHeight</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="labelTilePosX">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">tilePosX</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">2</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="labelTilePoxY">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">tilePosY</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">3</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="labelTileWidth">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">tileWidth</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">4</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="labelTileHeight">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">tileHeight</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">5</property>
-                      </packing>
-                    </child>
+                    <property name="hexpand">True</property>
+                    <property name="label" translatable="yes">contextWidth</property>
                   </object>
                   <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkBox" id="box5">
+                  <object class="GtkLabel" id="labelContextHeight">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="orientation">vertical</property>
-                    <child>
-                      <object class="GtkSpinButton" id="spinContextWidth">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">•</property>
-                        <property name="progress_pulse_step">1</property>
-                        <property name="numeric">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkSpinButton" id="spinContextHeight">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">•</property>
-                        <property name="progress_pulse_step">1</property>
-                        <property name="numeric">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkSpinButton" id="spinTilePosX">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">•</property>
-                        <property name="progress_pulse_step">1</property>
-                        <property name="numeric">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">2</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkSpinButton" id="spinTilePosY">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">•</property>
-                        <property name="progress_pulse_step">1</property>
-                        <property name="numeric">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">3</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkSpinButton" id="spinTileWidth">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">•</property>
-                        <property name="progress_pulse_step">1</property>
-                        <property name="numeric">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">4</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkSpinButton" id="spinTileHeight">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">•</property>
-                        <property name="width_chars">1</property>
-                        <property name="progress_pulse_step">1</property>
-                        <property name="numeric">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">5</property>
-                      </packing>
-                    </child>
+                    <property name="hexpand">True</property>
+                    <property name="label" translatable="yes">contextHeight</property>
                   </object>
                   <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="labelTilePosX">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
+                    <property name="label" translatable="yes">tilePosX</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">2</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="labelTilePoxY">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
+                    <property name="label" translatable="yes">tilePosY</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">3</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="labelTileWidth">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
+                    <property name="label" translatable="yes">tileWidth</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">4</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="labelTileHeight">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
+                    <property name="label" translatable="yes">tileHeight</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">5</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="spinContextWidth">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">•</property>
+                    <property name="invisible_char_set">True</property>
+                    <property name="progress_pulse_step">1</property>
+                    <property name="input_purpose">number</property>
+                    <property name="adjustment">adjustment1</property>
+                    <property name="numeric">True</property>
+                    <property name="update_policy">if-valid</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="spinContextHeight">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">•</property>
+                    <property name="invisible_char_set">True</property>
+                    <property name="progress_pulse_step">1</property>
+                    <property name="adjustment">adjustment1</property>
+                    <property name="numeric">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="spinTilePosX">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">•</property>
+                    <property name="invisible_char_set">True</property>
+                    <property name="progress_pulse_step">1</property>
+                    <property name="adjustment">adjustment2</property>
+                    <property name="numeric">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">2</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="spinTilePosY">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">•</property>
+                    <property name="invisible_char_set">True</property>
+                    <property name="progress_pulse_step">1</property>
+                    <property name="adjustment">adjustment2</property>
+                    <property name="numeric">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">3</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="spinTileWidth">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">•</property>
+                    <property name="invisible_char_set">True</property>
+                    <property name="progress_pulse_step">1</property>
+                    <property name="adjustment">adjustment1</property>
+                    <property name="numeric">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">4</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="spinTileHeight">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">•</property>
+                    <property name="width_chars">1</property>
+                    <property name="invisible_char_set">True</property>
+                    <property name="progress_pulse_step">1</property>
+                    <property name="adjustment">adjustment1</property>
+                    <property name="numeric">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">5</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
                   </packing>
                 </child>
               </object>
               <packing>
-                <property name="expand">True</property>
+                <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">0</property>
               </packing>
             </child>
             <child>
-              <object class="GtkBox" id="box6">
+              <object class="GtkButtonBox" id="buttonbox1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="spacing">12</property>
+                <property name="layout_style">start</property>
                 <child>
-                  <object class="GtkButton" id="buttonRenderTile">
-                    <property name="label" translatable="yes">render tile</property>
-                    <property name="use_action_appearance">False</property>
+                  <object class="GtkButton" id="buttonChooseDocument">
+                    <property name="label" translatable="yes">choose document</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
-                    <property name="use_action_appearance">False</property>
+                    <property name="xalign">0.50999999046325684</property>
+                    <property name="yalign">0.47999998927116394</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
-                    <property name="pack_type">end</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkButton" id="buttonChooseDocument">
-                    <property name="label" translatable="yes">choose document</property>
-                    <property name="use_action_appearance">False</property>
+                  <object class="GtkButton" id="buttonRenderTile">
+                    <property name="label" translatable="yes">render tile</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
-                    <property name="use_action_appearance">False</property>
-                    <property name="xalign">0.50999999046325684</property>
-                    <property name="yalign">0.47999998927116394</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
+                    <property name="pack_type">end</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
@@ -250,7 +274,7 @@
             </child>
           </object>
           <packing>
-            <property name="expand">True</property>
+            <property name="expand">False</property>
             <property name="fill">True</property>
             <property name="position">0</property>
           </packing>


More information about the Libreoffice-commits mailing list