//
// DO NOT MODIFY!!! This file was machine generated. DO NOT MODIFY!!!
// 
// Copyright (c) 2014 Vincent W. Chen.
// 
// This file is part of XJavaB.
// 
// XJavaB is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// XJavaB 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 Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public License
// along with XJavaB.  If not, see <http://www.gnu.org/licenses/>.
//


package com.noodlewiz.xjavab.ext.dri2.internal;

import java.nio.ByteBuffer;
import com.noodlewiz.xjavab.core.internal.Unpacker;
import com.noodlewiz.xjavab.core.internal.Util;
import com.noodlewiz.xjavab.ext.dri2.BufferSwapCompleteEvent;
import com.noodlewiz.xjavab.ext.dri2.InvalidateBuffersEvent;

public class EventUnpacker {


    public static BufferSwapCompleteEvent unpackBufferSwapComplete(final ByteBuffer __xjb_buf) {
        final boolean __xjb_fromSendEvent = Util.isFromSendEvent(Unpacker.unpackUByte(__xjb_buf));
        __xjb_buf.position(2);
        final int __xjb_seqNum = Unpacker.unpackUShort(__xjb_buf);
        __xjb_buf.position(1);
        Unpacker.unpackPad(__xjb_buf, 1);
        __xjb_buf.position(4);
        final int eventType = Unpacker.unpackUShort(__xjb_buf);
        Unpacker.unpackPad(__xjb_buf, 2);
        final long drawable = Unpacker.unpackUInt(__xjb_buf);
        final long ustHi = Unpacker.unpackUInt(__xjb_buf);
        final long ustLo = Unpacker.unpackUInt(__xjb_buf);
        final long mscHi = Unpacker.unpackUInt(__xjb_buf);
        final long mscLo = Unpacker.unpackUInt(__xjb_buf);
        final long sbc = Unpacker.unpackUInt(__xjb_buf);
        return new BufferSwapCompleteEvent(__xjb_fromSendEvent, __xjb_seqNum, eventType, drawable, ustHi, ustLo, mscHi, mscLo, sbc);
    }

    public static InvalidateBuffersEvent unpackInvalidateBuffers(final ByteBuffer __xjb_buf) {
        final boolean __xjb_fromSendEvent = Util.isFromSendEvent(Unpacker.unpackUByte(__xjb_buf));
        __xjb_buf.position(2);
        final int __xjb_seqNum = Unpacker.unpackUShort(__xjb_buf);
        __xjb_buf.position(1);
        Unpacker.unpackPad(__xjb_buf, 1);
        __xjb_buf.position(4);
        final long drawable = Unpacker.unpackUInt(__xjb_buf);
        return new InvalidateBuffersEvent(__xjb_fromSendEvent, __xjb_seqNum, drawable);
    }

}
