Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "ImageMetadata.h"
9 #include "RasterImage.h"
10 #include "nsComponentManagerUtils.h"
11 #include "nsISupportsPrimitives.h"
12 #include "nsXPCOMCID.h"
14 using namespace mozilla::image;
16 void
17 ImageMetadata::SetOnImage(RasterImage* image)
18 {
19 if (mHotspotX != -1 && mHotspotY != -1) {
20 nsCOMPtr<nsISupportsPRUint32> intwrapx = do_CreateInstance(NS_SUPPORTS_PRUINT32_CONTRACTID);
21 nsCOMPtr<nsISupportsPRUint32> intwrapy = do_CreateInstance(NS_SUPPORTS_PRUINT32_CONTRACTID);
22 intwrapx->SetData(mHotspotX);
23 intwrapy->SetData(mHotspotY);
24 image->Set("hotspotX", intwrapx);
25 image->Set("hotspotY", intwrapy);
26 }
28 image->SetLoopCount(mLoopCount);
30 for (uint32_t i = 0; i < image->GetNumFrames(); i++) {
31 image->SetFrameAsNonPremult(i, mIsNonPremultiplied);
32 }
33 }