Bug 1039883 - release Tiled layer's gralloc when an application is background r=nical
[gecko.git] / layout / svg / nsSVGPaintServerFrame.h
blob6ca58c9cb0327a8df5a0ff307681871af902fd6c
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 __NS_SVGPAINTSERVERFRAME_H__
7 #define __NS_SVGPAINTSERVERFRAME_H__
9 #include "mozilla/Attributes.h"
10 #include "nsCOMPtr.h"
11 #include "nsFrame.h"
12 #include "nsIFrame.h"
13 #include "nsQueryFrame.h"
14 #include "nsSVGContainerFrame.h"
15 #include "nsSVGUtils.h"
17 class gfxContext;
18 class gfxPattern;
19 class nsStyleContext;
21 struct gfxRect;
23 typedef nsSVGContainerFrame nsSVGPaintServerFrameBase;
25 class nsSVGPaintServerFrame : public nsSVGPaintServerFrameBase
27 protected:
28 nsSVGPaintServerFrame(nsStyleContext* aContext)
29 : nsSVGPaintServerFrameBase(aContext)
31 AddStateBits(NS_FRAME_IS_NONDISPLAY);
34 public:
35 NS_DECL_FRAMEARENA_HELPERS
37 /**
38 * Constructs a gfxPattern of the paint server rendering.
40 * @param aContextMatrix The transform matrix that is currently applied to
41 * the gfxContext that is being drawn to. This is needed by SVG patterns so
42 * that surfaces of the correct size can be created. (SVG gradients are
43 * vector based, so it's not used there.)
45 virtual already_AddRefed<gfxPattern>
46 GetPaintServerPattern(nsIFrame *aSource,
47 const gfxMatrix& aContextMatrix,
48 nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
49 float aOpacity,
50 const gfxRect *aOverrideBounds = nullptr) = 0;
52 /**
53 * Configure paint server prior to rendering
54 * @return false to skip rendering
56 virtual bool SetupPaintServer(gfxContext *aContext,
57 nsIFrame *aSource,
58 nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
59 float aOpacity);
61 // nsIFrame methods:
62 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
63 const nsRect& aDirtyRect,
64 const nsDisplayListSet& aLists) MOZ_OVERRIDE {}
66 virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
68 return nsSVGPaintServerFrameBase::IsFrameOfType(aFlags & ~nsIFrame::eSVGPaintServer);
72 #endif // __NS_SVGPAINTSERVERFRAME_H__