1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_dom_CanvasPattern_h
6 #define mozilla_dom_CanvasPattern_h
8 #include "mozilla/Attributes.h"
9 #include "mozilla/dom/CanvasRenderingContext2DBinding.h"
10 #include "mozilla/dom/CanvasRenderingContext2D.h"
11 #include "mozilla/RefPtr.h"
12 #include "nsISupports.h"
13 #include "nsWrapperCache.h"
25 class CanvasPattern MOZ_FINAL
: public nsWrapperCache
29 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CanvasPattern
)
30 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CanvasPattern
)
32 MOZ_BEGIN_NESTED_ENUM_CLASS(RepeatMode
, uint8_t)
37 MOZ_END_NESTED_ENUM_CLASS(RepeatMode
)
39 CanvasPattern(CanvasRenderingContext2D
* aContext
,
40 gfx::SourceSurface
* aSurface
,
42 nsIPrincipal
* principalForSecurityCheck
,
47 , mPrincipal(principalForSecurityCheck
)
49 , mForceWriteOnly(forceWriteOnly
)
56 JSObject
* WrapObject(JSContext
* aCx
) MOZ_OVERRIDE
58 return CanvasPatternBinding::Wrap(aCx
, this);
61 CanvasRenderingContext2D
* GetParentObject()
67 void SetTransform(SVGMatrix
& matrix
);
69 nsRefPtr
<CanvasRenderingContext2D
> mContext
;
70 RefPtr
<gfx::SourceSurface
> mSurface
;
71 nsCOMPtr
<nsIPrincipal
> mPrincipal
;
72 mozilla::gfx::Matrix mTransform
;
73 const bool mForceWriteOnly
;
75 const RepeatMode mRepeat
;
78 MOZ_FINISH_NESTED_ENUM_CLASS(CanvasPattern::RepeatMode
)
83 #endif // mozilla_dom_CanvasPattern_h