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
)
55 JSObject
* WrapObject(JSContext
* aCx
) MOZ_OVERRIDE
57 return CanvasPatternBinding::Wrap(aCx
, this);
60 CanvasRenderingContext2D
* GetParentObject()
66 void SetTransform(SVGMatrix
& matrix
);
68 nsRefPtr
<CanvasRenderingContext2D
> mContext
;
69 RefPtr
<gfx::SourceSurface
> mSurface
;
70 nsCOMPtr
<nsIPrincipal
> mPrincipal
;
71 mozilla::gfx::Matrix mTransform
;
72 const bool mForceWriteOnly
;
74 const RepeatMode mRepeat
;
77 MOZ_FINISH_NESTED_ENUM_CLASS(CanvasPattern::RepeatMode
)
82 #endif // mozilla_dom_CanvasPattern_h