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/. */ 5 6 #ifndef mozilla_image_SVGDrawingParameters_h 7 #define mozilla_image_SVGDrawingParameters_h 8 9 #include "gfxContext.h" 10 #include "gfxTypes.h" 11 #include "ImageRegion.h" 12 #include "mozilla/gfx/Point.h" 13 #include "mozilla/gfx/Types.h" 14 #include "mozilla/Maybe.h" 15 #include "mozilla/SVGImageContext.h" 16 #include "nsSize.h" 17 18 namespace mozilla { 19 namespace image { 20 21 struct SVGDrawingParameters { 22 typedef mozilla::gfx::IntSize IntSize; 23 typedef mozilla::gfx::SamplingFilter SamplingFilter; 24 SVGDrawingParametersSVGDrawingParameters25 SVGDrawingParameters(gfxContext* aContext, const nsIntSize& aRasterSize, 26 const nsIntSize& aDrawSize, const ImageRegion& aRegion, 27 SamplingFilter aSamplingFilter, 28 const Maybe<SVGImageContext>& aSVGContext, 29 float aAnimationTime, uint32_t aFlags, float aOpacity) 30 : context(aContext), 31 size(aRasterSize), 32 drawSize(aDrawSize), 33 region(aRegion), 34 samplingFilter(aSamplingFilter), 35 svgContext(aSVGContext), 36 viewportSize(aRasterSize), 37 animationTime(aAnimationTime), 38 flags(aFlags), 39 opacity(aOpacity) { 40 if (aSVGContext) { 41 auto sz = aSVGContext->GetViewportSize(); 42 if (sz) { 43 viewportSize = nsIntSize(sz->width, sz->height); // XXX losing unit 44 } 45 } 46 } 47 48 gfxContext* context; 49 IntSize size; // Size to rasterize a surface at. 50 IntSize drawSize; // Size to draw the given surface at. 51 ImageRegion region; 52 SamplingFilter samplingFilter; 53 const Maybe<SVGImageContext>& svgContext; 54 nsIntSize viewportSize; 55 float animationTime; 56 uint32_t flags; 57 gfxFloat opacity; 58 }; 59 60 } // namespace image 61 } // namespace mozilla 62 63 #endif // mozilla_image_SVGDrawingParameters_h 64