// skia/public/mojom/skcolorspace_primaries.mojom.js is auto generated by mojom_bindings_generator.py, do not edit

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

'use strict';

(function() {
  var mojomId = 'skia/public/mojom/skcolorspace_primaries.mojom';
  if (mojo.internal.isMojomLoaded(mojomId)) {
    console.warn('The following mojom is loaded multiple times: ' + mojomId);
    return;
  }
  mojo.internal.markMojomLoaded(mojomId);
  var bindings = mojo;
  var associatedBindings = mojo;
  var codec = mojo.internal;
  var validator = mojo.internal;

  var exports = mojo.internal.exposeNamespace('skia.mojom');



  function SkColorSpacePrimaries(values) {
    this.initDefaults_();
    this.initFields_(values);
  }


  SkColorSpacePrimaries.prototype.initDefaults_ = function() {
    this.rX = 0;
    this.rY = 0;
    this.gX = 0;
    this.gY = 0;
    this.bX = 0;
    this.bY = 0;
    this.wX = 0;
    this.wY = 0;
  };
  SkColorSpacePrimaries.prototype.initFields_ = function(fields) {
    for(var field in fields) {
        if (this.hasOwnProperty(field))
          this[field] = fields[field];
    }
  };

  SkColorSpacePrimaries.validate = function(messageValidator, offset) {
    var err;
    err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
    if (err !== validator.validationError.NONE)
        return err;

    var kVersionSizes = [
      {version: 0, numBytes: 40}
    ];
    err = messageValidator.validateStructVersion(offset, kVersionSizes);
    if (err !== validator.validationError.NONE)
        return err;









    return validator.validationError.NONE;
  };

  SkColorSpacePrimaries.encodedSize = codec.kStructHeaderSize + 32;

  SkColorSpacePrimaries.decode = function(decoder) {
    var packed;
    var val = new SkColorSpacePrimaries();
    var numberOfBytes = decoder.readUint32();
    var version = decoder.readUint32();
    val.rX =
        decoder.decodeStruct(codec.Float);
    val.rY =
        decoder.decodeStruct(codec.Float);
    val.gX =
        decoder.decodeStruct(codec.Float);
    val.gY =
        decoder.decodeStruct(codec.Float);
    val.bX =
        decoder.decodeStruct(codec.Float);
    val.bY =
        decoder.decodeStruct(codec.Float);
    val.wX =
        decoder.decodeStruct(codec.Float);
    val.wY =
        decoder.decodeStruct(codec.Float);
    return val;
  };

  SkColorSpacePrimaries.encode = function(encoder, val) {
    var packed;
    encoder.writeUint32(SkColorSpacePrimaries.encodedSize);
    encoder.writeUint32(0);
    encoder.encodeStruct(codec.Float, val.rX);
    encoder.encodeStruct(codec.Float, val.rY);
    encoder.encodeStruct(codec.Float, val.gX);
    encoder.encodeStruct(codec.Float, val.gY);
    encoder.encodeStruct(codec.Float, val.bX);
    encoder.encodeStruct(codec.Float, val.bY);
    encoder.encodeStruct(codec.Float, val.wX);
    encoder.encodeStruct(codec.Float, val.wY);
  };
  exports.SkColorSpacePrimaries = SkColorSpacePrimaries;
})();