michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "ImageMetadata.h" michael@0: michael@0: #include "RasterImage.h" michael@0: #include "nsComponentManagerUtils.h" michael@0: #include "nsISupportsPrimitives.h" michael@0: #include "nsXPCOMCID.h" michael@0: michael@0: using namespace mozilla::image; michael@0: michael@0: void michael@0: ImageMetadata::SetOnImage(RasterImage* image) michael@0: { michael@0: if (mHotspotX != -1 && mHotspotY != -1) { michael@0: nsCOMPtr intwrapx = do_CreateInstance(NS_SUPPORTS_PRUINT32_CONTRACTID); michael@0: nsCOMPtr intwrapy = do_CreateInstance(NS_SUPPORTS_PRUINT32_CONTRACTID); michael@0: intwrapx->SetData(mHotspotX); michael@0: intwrapy->SetData(mHotspotY); michael@0: image->Set("hotspotX", intwrapx); michael@0: image->Set("hotspotY", intwrapy); michael@0: } michael@0: michael@0: image->SetLoopCount(mLoopCount); michael@0: michael@0: for (uint32_t i = 0; i < image->GetNumFrames(); i++) { michael@0: image->SetFrameAsNonPremult(i, mIsNonPremultiplied); michael@0: } michael@0: }