image/ImageMetadata.cpp
author Birunthan Mohanathas <birunthan@mohanathas.com>
Thu, 14 May 2015 20:52:05 -0700
changeset 244294 7701abd924856d65acbf9927629cf27dd2335ec1
parent 243923 image/src/ImageMetadata.cpp@2ef80cf97822b7b4e475da1536b282971029c97a
child 255755 8372b72b359cb1265b7d6a93bfe4f180bee4a212
permissions -rw-r--r--
Bug 1038536 - Flatten image/src/ directory. r=seth

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "ImageMetadata.h"

#include "RasterImage.h"
#include "nsComponentManagerUtils.h"
#include "nsISupportsPrimitives.h"
#include "nsXPCOMCID.h"

namespace mozilla {
namespace image {

void
ImageMetadata::SetOnImage(RasterImage* image)
{
  if (mHotspotX != -1 && mHotspotY != -1) {
    nsCOMPtr<nsISupportsPRUint32> intwrapx =
      do_CreateInstance(NS_SUPPORTS_PRUINT32_CONTRACTID);
    nsCOMPtr<nsISupportsPRUint32> intwrapy =
      do_CreateInstance(NS_SUPPORTS_PRUINT32_CONTRACTID);
    intwrapx->SetData(mHotspotX);
    intwrapy->SetData(mHotspotY);
    image->Set("hotspotX", intwrapx);
    image->Set("hotspotY", intwrapy);
  }

  image->SetLoopCount(mLoopCount);
}

} // namespace image
} // namespace mozilla