image/src/ImageMetadata.cpp

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     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 }

mercurial