image/src/OrientedImage.h

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 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef MOZILLA_IMAGELIB_ORIENTEDIMAGE_H_
     7 #define MOZILLA_IMAGELIB_ORIENTEDIMAGE_H_
     9 #include "ImageWrapper.h"
    10 #include "mozilla/gfx/2D.h"
    11 #include "mozilla/RefPtr.h"
    12 #include "Orientation.h"
    14 namespace mozilla {
    15 namespace image {
    17 /**
    18  * An Image wrapper that rotates and/or flips an image according to a specified
    19  * Orientation.
    20  *
    21  * XXX(seth): There a known (performance, not correctness) issue with
    22  * GetImageContainer. See the comments for that method for more information.
    23  */
    24 class OrientedImage : public ImageWrapper
    25 {
    26   typedef mozilla::gfx::SourceSurface SourceSurface;
    28 public:
    29   NS_DECL_ISUPPORTS
    31   virtual ~OrientedImage() { }
    33   virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE;
    35   NS_IMETHOD GetWidth(int32_t* aWidth) MOZ_OVERRIDE;
    36   NS_IMETHOD GetHeight(int32_t* aHeight) MOZ_OVERRIDE;
    37   NS_IMETHOD GetIntrinsicSize(nsSize* aSize) MOZ_OVERRIDE;
    38   NS_IMETHOD GetIntrinsicRatio(nsSize* aRatio) MOZ_OVERRIDE;
    39   NS_IMETHOD_(mozilla::TemporaryRef<SourceSurface>)
    40     GetFrame(uint32_t aWhichFrame, uint32_t aFlags) MOZ_OVERRIDE;
    41   NS_IMETHOD GetImageContainer(mozilla::layers::LayerManager* aManager,
    42                                mozilla::layers::ImageContainer** _retval) MOZ_OVERRIDE;
    43   NS_IMETHOD Draw(gfxContext* aContext,
    44                   GraphicsFilter aFilter,
    45                   const gfxMatrix& aUserSpaceToImageSpace,
    46                   const gfxRect& aFill,
    47                   const nsIntRect& aSubimage,
    48                   const nsIntSize& aViewportSize,
    49                   const SVGImageContext* aSVGContext,
    50                   uint32_t aWhichFrame,
    51                   uint32_t aFlags) MOZ_OVERRIDE;
    53 protected:
    54   OrientedImage(Image* aImage, Orientation aOrientation)
    55     : ImageWrapper(aImage)
    56     , mOrientation(aOrientation)
    57   { }
    59   gfxMatrix OrientationMatrix(const nsIntSize& aViewportSize);
    61 private:
    62   Orientation mOrientation;
    64   friend class ImageOps;
    65 };
    67 } // namespace image
    68 } // namespace mozilla
    70 #endif // MOZILLA_IMAGELIB_ORIENTEDIMAGE_H_

mercurial