1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/image/src/ImageMetadata.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,33 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#include "ImageMetadata.h" 1.11 + 1.12 +#include "RasterImage.h" 1.13 +#include "nsComponentManagerUtils.h" 1.14 +#include "nsISupportsPrimitives.h" 1.15 +#include "nsXPCOMCID.h" 1.16 + 1.17 +using namespace mozilla::image; 1.18 + 1.19 +void 1.20 +ImageMetadata::SetOnImage(RasterImage* image) 1.21 +{ 1.22 + if (mHotspotX != -1 && mHotspotY != -1) { 1.23 + nsCOMPtr<nsISupportsPRUint32> intwrapx = do_CreateInstance(NS_SUPPORTS_PRUINT32_CONTRACTID); 1.24 + nsCOMPtr<nsISupportsPRUint32> intwrapy = do_CreateInstance(NS_SUPPORTS_PRUINT32_CONTRACTID); 1.25 + intwrapx->SetData(mHotspotX); 1.26 + intwrapy->SetData(mHotspotY); 1.27 + image->Set("hotspotX", intwrapx); 1.28 + image->Set("hotspotY", intwrapy); 1.29 + } 1.30 + 1.31 + image->SetLoopCount(mLoopCount); 1.32 + 1.33 + for (uint32_t i = 0; i < image->GetNumFrames(); i++) { 1.34 + image->SetFrameAsNonPremult(i, mIsNonPremultiplied); 1.35 + } 1.36 +}