image/src/ImageOps.cpp

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

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 "imgIContainer.h"
     8 #include "ClippedImage.h"
     9 #include "FrozenImage.h"
    10 #include "OrientedImage.h"
    11 #include "Image.h"
    13 #include "ImageOps.h"
    15 namespace mozilla {
    16 namespace image {
    18 /* static */ already_AddRefed<Image>
    19 ImageOps::Freeze(Image* aImage)
    20 {
    21   nsRefPtr<Image> frozenImage = new FrozenImage(aImage);
    22   return frozenImage.forget();
    23 }
    25 /* static */ already_AddRefed<imgIContainer>
    26 ImageOps::Freeze(imgIContainer* aImage)
    27 {
    28   nsCOMPtr<imgIContainer> frozenImage =
    29     new FrozenImage(static_cast<Image*>(aImage));
    30   return frozenImage.forget();
    31 }
    33 /* static */ already_AddRefed<Image>
    34 ImageOps::Clip(Image* aImage, nsIntRect aClip)
    35 {
    36   nsRefPtr<Image> clippedImage = new ClippedImage(aImage, aClip);
    37   return clippedImage.forget();
    38 }
    40 /* static */ already_AddRefed<imgIContainer>
    41 ImageOps::Clip(imgIContainer* aImage, nsIntRect aClip)
    42 {
    43   nsCOMPtr<imgIContainer> clippedImage =
    44     new ClippedImage(static_cast<Image*>(aImage), aClip);
    45   return clippedImage.forget();
    46 }
    48 /* static */ already_AddRefed<Image>
    49 ImageOps::Orient(Image* aImage, Orientation aOrientation)
    50 {
    51   nsRefPtr<Image> orientedImage = new OrientedImage(aImage, aOrientation);
    52   return orientedImage.forget();
    53 }
    55 /* static */ already_AddRefed<imgIContainer>
    56 ImageOps::Orient(imgIContainer* aImage, Orientation aOrientation)
    57 {
    58   nsCOMPtr<imgIContainer> orientedImage =
    59     new OrientedImage(static_cast<Image*>(aImage), aOrientation);
    60   return orientedImage.forget();
    61 }
    63 } // namespace image
    64 } // namespace mozilla

mercurial