summaryrefslogtreecommitdiffstats
path: root/package-lock.json
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-12 09:36:48 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-28 13:41:21 +0100
commite03e0323edd1e6580a355952d6cfc1a4436b42df (patch)
tree5d1845fddf8ae283e9b852147eb200ed60218315 /package-lock.json
parent58fd0d68bc8b46b23f8cdc65190f08d4e524eb57 (diff)
downloadsvg.js-e03e0323edd1e6580a355952d6cfc1a4436b42df.tar.gz
svg.js-e03e0323edd1e6580a355952d6cfc1a4436b42df.zip
started to add es6 tests using svgdom as fallback in case no dom is found
Diffstat (limited to 'package-lock.json')
-rw-r--r--package-lock.json70
1 files changed, 12 insertions, 58 deletions
diff --git a/package-lock.json b/package-lock.json
index e7a88bc..95b4822 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1051,11 +1051,6 @@
"dev": true,
"optional": true
},
- "animation-frame-polyfill": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/animation-frame-polyfill/-/animation-frame-polyfill-1.0.1.tgz",
- "integrity": "sha1-X1rZk6eHlL0Xas3lttzmKGdBDJ0="
- },
"ansi-align": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz",
@@ -4348,12 +4343,6 @@
"integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==",
"dev": true
},
- "graceful-readlink": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz",
- "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=",
- "dev": true
- },
"growl": {
"version": "1.10.5",
"resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz",
@@ -4698,12 +4687,6 @@
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
"dev": true
},
- "innersvg-polyfill": {
- "version": "0.0.2",
- "resolved": "https://registry.npmjs.org/innersvg-polyfill/-/innersvg-polyfill-0.0.2.tgz",
- "integrity": "sha1-i9M2G0UpHqOMv8brcYI+7RiQrzk=",
- "dev": true
- },
"inquirer": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.0.tgz",
@@ -5099,6 +5082,16 @@
}
}
},
+ "jasmine": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.3.0.tgz",
+ "integrity": "sha512-haZzMvmoWSI2VCKfDgPqyEOPBQA7C1fgtIMgKNU4hVMcrVkWU5NPOWQqOTA6mVFyKcSUUrnkXu/ZEgY0bRnd6A==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.0.6",
+ "jasmine-core": "~3.3.0"
+ }
+ },
"jasmine-core": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.3.0.tgz",
@@ -7108,37 +7101,6 @@
}
}
},
- "rollup-plugin-uglify-es": {
- "version": "0.0.1",
- "resolved": "https://registry.npmjs.org/rollup-plugin-uglify-es/-/rollup-plugin-uglify-es-0.0.1.tgz",
- "integrity": "sha1-5FZE8raFpZq9uTY0ByB6A6e1qbc=",
- "dev": true,
- "requires": {
- "uglify-es": "3.0.3"
- },
- "dependencies": {
- "commander": {
- "version": "2.9.0",
- "resolved": "http://registry.npmjs.org/commander/-/commander-2.9.0.tgz",
- "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=",
- "dev": true,
- "requires": {
- "graceful-readlink": ">= 1.0.0"
- }
- },
- "uglify-es": {
- "version": "3.0.3",
- "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.0.3.tgz",
- "integrity": "sha1-Y8yEqpRos0lzpIh3h8ZMAaiodXY=",
- "dev": true,
- "requires": {
- "commander": "~2.9.0",
- "source-map": "~0.5.1",
- "uglify-to-browserify": "~1.0.0"
- }
- }
- }
- },
"rollup-pluginutils": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.3.3.tgz",
@@ -7982,9 +7944,8 @@
}
},
"svgdom": {
- "version": "0.0.15",
- "resolved": "https://registry.npmjs.org/svgdom/-/svgdom-0.0.15.tgz",
- "integrity": "sha1-djlZYSQUjJ8eBlntNGgtN5s2dO4=",
+ "version": "github:svgdotjs/svgdom#a3643a60e67933a9d5ea439d068c432d50ce308f",
+ "from": "github:svgdotjs/svgdom",
"dev": true,
"requires": {
"fontkit": "^1.5.4",
@@ -8346,13 +8307,6 @@
}
}
},
- "uglify-to-browserify": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz",
- "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=",
- "dev": true,
- "optional": true
- },
"ultron": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz",
c */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/* Copyright (C) 2000-2003 Constantin Kaplinsky.  All Rights Reserved.
 * Copyright (C) 2011 D. R. Commander.  All Rights Reserved.
 * Copyright 2014 Pierre Ossman for Cendio AB
 *    
 * This 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.
 * 
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this software; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
 * USA.
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <assert.h>

#include <rdr/OutStream.h>
#include <rfb/PixelBuffer.h>
#include <rfb/Palette.h>
#include <rfb/encodings.h>
#include <rfb/SConnection.h>
#include <rfb/TightEncoder.h>
#include <rfb/TightConstants.h>

using namespace rfb;

struct TightConf {
  int idxZlibLevel, monoZlibLevel, rawZlibLevel;
};

//
// Compression level stuff. The following array contains zlib
// settings for each of 10 compression levels (0..9).
//
// NOTE: The parameters used in this encoder are the result of painstaking
// research by The VirtualGL Project using RFB session captures from a variety
// of both 2D and 3D applications.  See http://www.VirtualGL.org for the full
// reports.

static const TightConf conf[10] = {
  { 0, 0, 0 }, // 0
  { 1, 1, 1 }, // 1
  { 3, 3, 2 }, // 2
  { 5, 5, 2 }, // 3
  { 6, 7, 3 }, // 4
  { 7, 8, 4 }, // 5
  { 7, 8, 5 }, // 6
  { 8, 9, 6 }, // 7
  { 9, 9, 7 }, // 8
  { 9, 9, 9 }  // 9
};

TightEncoder::TightEncoder(SConnection* conn) :
  Encoder(conn, encodingTight, EncoderPlain, 256)
{
  setCompressLevel(-1);
}

TightEncoder::~TightEncoder()
{
}

bool TightEncoder::isSupported()
{
  return conn->client.supportsEncoding(encodingTight);
}

void TightEncoder::setCompressLevel(int level)
{
  if (level < 0 || level > 9)
    level = 2;

  idxZlibLevel = conf[level].idxZlibLevel;
  monoZlibLevel = conf[level].monoZlibLevel;
  rawZlibLevel = conf[level].rawZlibLevel;
}

void TightEncoder::writeRect(const PixelBuffer* pb, const Palette& palette)
{
  switch (palette.size()) {
  case 0:
    writeFullColourRect(pb);
    break;
  case 1:
    Encoder::writeSolidRect(pb, palette);
    break;
  case 2:
    writeMonoRect(pb, palette);
    break;
  default:
    writeIndexedRect(pb, palette);
  }
}

void TightEncoder::writeSolidRect(int /*width*/, int /*height*/,
                                  const PixelFormat& pf,
                                  const rdr::U8* colour)
{
  rdr::OutStream* os;

  os = conn->getOutStream();

  os->writeU8(tightFill << 4);
  writePixels(colour, pf, 1, os);
}

void TightEncoder::writeMonoRect(const PixelBuffer* pb, const Palette& palette)
{
  const rdr::U8* buffer;
  int stride;

  buffer = pb->getBuffer(pb->getRect(), &stride);

  switch (pb->getPF().bpp) {
  case 32:
    writeMonoRect(pb->width(), pb->height(), (rdr::U32*)buffer, stride,
                  pb->getPF(), palette);
    break;
  case 16:
    writeMonoRect(pb->width(), pb->height(), (rdr::U16*)buffer, stride,
                  pb->getPF(), palette);
    break;
  default:
    writeMonoRect(pb->width(), pb->height(), (rdr::U8*)buffer, stride,
                  pb->getPF(), palette);
  }
}

void TightEncoder::writeIndexedRect(const PixelBuffer* pb, const Palette& palette)
{
  const rdr::U8* buffer;
  int stride;

  buffer = pb->getBuffer(pb->getRect(), &stride);

  switch (pb->getPF().bpp) {
  case 32:
    writeIndexedRect(pb->width(), pb->height(), (rdr::U32*)buffer, stride,
                     pb->getPF(), palette);
    break;
  case 16:
    writeIndexedRect(pb->width(), pb->height(), (rdr::U16*)buffer, stride,
                     pb->getPF(), palette);
    break;
  default:
    // It's more efficient to just do raw pixels
    writeFullColourRect(pb);
  }
}

void TightEncoder::writeFullColourRect(const PixelBuffer* pb)
{
  const int streamId = 0;

  rdr::OutStream* os;
  rdr::OutStream* zos;
  int length;

  const rdr::U8* buffer;
  int stride, h;

  os = conn->getOutStream();

  os->writeU8(streamId << 4);

  // Set up compression
  if ((pb->getPF().bpp != 32) || !pb->getPF().is888())
    length = pb->getRect().area() * pb->getPF().bpp/8;
  else
    length = pb->getRect().area() * 3;

  zos = getZlibOutStream(streamId, rawZlibLevel, length);

  // And then just dump all the raw pixels
  buffer = pb->getBuffer(pb->getRect(), &stride);
  h = pb->height();

  while (h--) {
    writePixels(buffer, pb->getPF(), pb->width(), zos);
    buffer += stride * pb->getPF().bpp/8;
  }

  // Finish the zlib stream
  flushZlibOutStream(zos);
}

void TightEncoder::writePixels(const rdr::U8* buffer, const PixelFormat& pf,
                               unsigned int count, rdr::OutStream* os)
{
  rdr::U8 rgb[2048];

  if ((pf.bpp != 32) || !pf.is888()) {
    os->writeBytes(buffer, count * pf.bpp/8);
    return;
  }

  while (count) {
    unsigned int iter_count;

    iter_count = sizeof(rgb)/3;
    if (iter_count > count)
      iter_count = count;

    pf.rgbFromBuffer(rgb, buffer, iter_count);
    os->writeBytes(rgb, iter_count * 3);

    buffer += iter_count * pf.bpp/8;
    count -= iter_count;
  }
}

void TightEncoder::writeCompact(rdr::OutStream* os, rdr::U32 value)
{
  rdr::U8 b;
  b = value & 0x7F;
  if (value <= 0x7F) {
    os->writeU8(b);
  } else {
    os->writeU8(b | 0x80);
    b = value >> 7 & 0x7F;
    if (value <= 0x3FFF) {
      os->writeU8(b);
    } else {
      os->writeU8(b | 0x80);
      os->writeU8(value >> 14 & 0xFF);
    }
  }
}

rdr::OutStream* TightEncoder::getZlibOutStream(int streamId, int level, size_t length)
{
  // Minimum amount of data to be compressed. This value should not be
  // changed, doing so will break compatibility with existing clients.
  if (length < 12)
    return conn->getOutStream();

  assert(streamId >= 0);
  assert(streamId < 4);

  zlibStreams[streamId].setUnderlying(&memStream);
  zlibStreams[streamId].setCompressionLevel(level);
  zlibStreams[streamId].cork(true);

  return &zlibStreams[streamId];
}

void TightEncoder::flushZlibOutStream(rdr::OutStream* os_)
{
  rdr::OutStream* os;
  rdr::ZlibOutStream* zos;

  zos = dynamic_cast<rdr::ZlibOutStream*>(os_);
  if (zos == NULL)
    return;

  zos->cork(false);
  zos->flush();
  zos->setUnderlying(NULL);

  os = conn->getOutStream();

  writeCompact(os, memStream.length());
  os->writeBytes(memStream.data(), memStream.length());
  memStream.clear();
}

//
// Including BPP-dependent implementation of the encoder.
//

#define BPP 8
#include <rfb/TightEncoderBPP.cxx>
#undef BPP
#define BPP 16
#include <rfb/TightEncoderBPP.cxx>
#undef BPP
#define BPP 32
#include <rfb/TightEncoderBPP.cxx>
#undef BPP