[Pkg-javascript-commits] [pdf.js] 220/246: Implements paintFormXObject in svg.js

David Prévot taffit at moszumanska.debian.org
Sun Sep 7 15:36:43 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 32853c07f45b6b7ecb019909a167bd0a05060db5
Author: Tim van der Meij <timvandermeij at gmail.com>
Date:   Thu Aug 14 22:54:38 2014 +0200

    Implements paintFormXObject in svg.js
---
 src/display/svg.js | 38 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/src/display/svg.js b/src/display/svg.js
index 52bd230..1ebdaf5 100644
--- a/src/display/svg.js
+++ b/src/display/svg.js
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/* globals PDFJS, FONT_IDENTITY_MATRIX, IDENTITY_MATRIX,
+/* globals PDFJS, FONT_IDENTITY_MATRIX, IDENTITY_MATRIX, isArray,
            isNum, OPS, Promise, Util, warn, ImageKind, PDFJS */
 
 'use strict';
@@ -570,6 +570,12 @@ var SVGGraphics = (function SVGGraphicsClosure() {
           case OPS.paintImageMaskXObject:
             this.paintImageMaskXObject(args[0]);
             break;
+          case OPS.paintFormXObjectBegin:
+            this.paintFormXObjectBegin(args[0], args[1]);
+            break;
+          case OPS.paintFormXObjectEnd:
+            this.paintFormXObjectEnd();
+            break;
           case OPS.closePath:
             this.closePath();
             break;
@@ -757,6 +763,7 @@ var SVGGraphics = (function SVGGraphicsClosure() {
 
     endText: function SVGGraphics_endText() {
       if (this.current.pendingClip) {
+        this.cgrp.appendChild(this.tgrp);
         this.pgrp.appendChild(this.cgrp);
       } else {
         this.pgrp.appendChild(this.tgrp);
@@ -1111,6 +1118,35 @@ var SVGGraphics = (function SVGGraphicsClosure() {
 
       this.paintInlineImageXObject(imgData, mask);
     },
+
+    paintFormXObjectBegin:
+        function SVGGraphics_paintFormXObjectBegin(matrix, bbox) {
+      this.save();
+
+      if (isArray(matrix) && matrix.length === 6) {
+        this.transform(matrix[0], matrix[1], matrix[2],
+                       matrix[3], matrix[4], matrix[5]);
+      }
+
+      if (isArray(bbox) && bbox.length === 4) {
+        var width = bbox[2] - bbox[0];
+        var height = bbox[3] - bbox[1];
+
+        var cliprect = document.createElementNS(NS, 'svg:rect');
+        cliprect.setAttributeNS(null, 'x', bbox[0]);
+        cliprect.setAttributeNS(null, 'y', bbox[1]);
+        cliprect.setAttributeNS(null, 'width', pf(width));
+        cliprect.setAttributeNS(null, 'height', pf(height));
+        this.current.element = cliprect;
+        this.clip('nonzero');
+        this.endPath();
+      }
+    },
+
+    paintFormXObjectEnd:
+        function SVGGraphics_paintFormXObjectEnd() {
+      this.restore();
+    }
   };
   return SVGGraphics;
 })();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list