/*
  DefineBitsJPEG parser
*/
goog.provide('FlappSWFTagDefineBitsJPEG');

goog.scope(function() {

/**
 * @constructor
 */
FlappSWFTagDefineBitsJPEG = function(code, length, ibit) {
//	console.log("FlappSWFTagDefineBitsJPEG(code:"+code+", length:"+length+", ibit)");
    this.code = code;
    this.length = length;
    this.id = ibit.ui16();
    if (code <= 21) { // DefineBits & DefineBitsJPEG2
        this.jpegData = ibit.sub(length - 2);
    } else {          // DefineBitsJPEG3
        var alphaDataOffset = ibit.ui32();
        this.jpegData = ibit.sub(alphaDataOffset);
        this.bitmapAlphaData = (length - 2 - alphaDataOffset);
    }
};

});
