Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 }