<commit_before>/* -*- mode: javascript; tab-width: 4; indent-tabs-mode: nil -*- */

/** @const */ var FORMAT_COLORMAPPED  = 3;
/** @const */ var FORMAT_15BPP        = 4;
/** @const */ var FORMAT_24BPP        = 5;
/** @const */ var FACTOR_5BBP         = 255 / 31;

function rgbToString(bytes, pos) {
  var red = bytes[pos];
  var green = bytes[pos + 1];
  var blue = bytes[pos + 2];
  return fromCharCode(red, green, blue);
}
function argbToString(bytes, pos) {
  var alpha = bytes[pos] / 0xff;
  if (!alpha)
    return '\x00\x00\x00\x00';
  // RGB values are alpha pre-multiplied (per SWF spec).
  var red = 0 | (bytes[pos + 1] / alpha);
  var green = 0 | (bytes[pos + 2] / alpha);
  var blue = 0 | (bytes[pos + 3] / alpha);
  return fromCharCode(red, green, blue, alpha);
}

function defineBitmap(tag) {
  var width = tag.width;
  var height = tag.height;
  var hasAlpha = tag.hasAlpha;
  var plte = '';
  var trns = '';
  var literals = '';

  var bmpData = tag.bmpData;
  switch (tag.format) {
  case FORMAT_COLORMAPPED:
    var colorType = '\x03';
    var bytesPerLine = (width + 3) & ~3;<commit_msg>Fix alpha channel in bitmaps.<commit_after>/* -*- mode: javascript; tab-width: 4; indent-tabs-mode: nil -*- */

/** @const */ var FORMAT_COLORMAPPED  = 3;
/** @const */ var FORMAT_15BPP        = 4;
/** @const */ var FORMAT_24BPP        = 5;
/** @const */ var FACTOR_5BBP         = 255 / 31;

function rgbToString(bytes, pos) {
  var red = bytes[pos];
  var green = bytes[pos + 1];
  var blue = bytes[pos + 2];
  return fromCharCode(red, green, blue);
}
function argbToString(bytes, pos) {
  var alpha = bytes[pos];
  if (!alpha)
    return '\x00\x00\x00\x00';
  var opacity = alpha / 0xff;
  // RGB values are alpha pre-multiplied (per SWF spec).
  var red = 0 | (bytes[pos + 1] / opacity);
  var green = 0 | (bytes[pos + 2] / opacity);
  var blue = 0 | (bytes[pos + 3] / opacity);
  return fromCharCode(red, green, blue, alpha);
}

function defineBitmap(tag) {
  var width = tag.width;
  var height = tag.height;
  var hasAlpha = tag.hasAlpha;
  var plte = '';
  var trns = '';
  var literals = '';

  var bmpData = tag.bmpData;
  switch (tag.format) {
  case FORMAT_COLORMAPPED:
    var colorType = '\x03';
    var bytesPerLine = (width + 3) & ~3;
{'fraction_non_alphanumeric': 0.16200621393697293, 'fraction_numerical': 0.031069684864624945, 'mean_word_length': 2.8595890410958904, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5171259', 'n_tokens_mistral': 882, 'n_tokens_neox': 814, 'n_words': 238}