content/canvas/src/CanvasPattern.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/canvas/src/CanvasPattern.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,76 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#ifndef mozilla_dom_CanvasPattern_h
     1.9 +#define mozilla_dom_CanvasPattern_h
    1.10 +
    1.11 +#include "mozilla/Attributes.h"
    1.12 +#include "mozilla/dom/CanvasRenderingContext2DBinding.h"
    1.13 +#include "mozilla/dom/CanvasRenderingContext2D.h"
    1.14 +#include "mozilla/RefPtr.h"
    1.15 +#include "nsISupports.h"
    1.16 +#include "nsWrapperCache.h"
    1.17 +
    1.18 +class nsIPrincipal;
    1.19 +
    1.20 +namespace mozilla {
    1.21 +namespace gfx {
    1.22 +class SourceSurface;
    1.23 +}
    1.24 +
    1.25 +namespace dom {
    1.26 +
    1.27 +class CanvasPattern MOZ_FINAL : public nsWrapperCache
    1.28 +{
    1.29 +public:
    1.30 +  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CanvasPattern)
    1.31 +  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CanvasPattern)
    1.32 +
    1.33 +  MOZ_BEGIN_NESTED_ENUM_CLASS(RepeatMode, uint8_t)
    1.34 +    REPEAT,
    1.35 +    REPEATX,
    1.36 +    REPEATY,
    1.37 +    NOREPEAT
    1.38 +  MOZ_END_NESTED_ENUM_CLASS(RepeatMode)
    1.39 +
    1.40 +  CanvasPattern(CanvasRenderingContext2D* aContext,
    1.41 +                gfx::SourceSurface* aSurface,
    1.42 +                RepeatMode aRepeat,
    1.43 +                nsIPrincipal* principalForSecurityCheck,
    1.44 +                bool forceWriteOnly,
    1.45 +                bool CORSUsed)
    1.46 +    : mContext(aContext)
    1.47 +    , mSurface(aSurface)
    1.48 +    , mPrincipal(principalForSecurityCheck)
    1.49 +    , mForceWriteOnly(forceWriteOnly)
    1.50 +    , mCORSUsed(CORSUsed)
    1.51 +    , mRepeat(aRepeat)
    1.52 +  {
    1.53 +    SetIsDOMBinding();
    1.54 +  }
    1.55 +
    1.56 +  JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE
    1.57 +  {
    1.58 +    return CanvasPatternBinding::Wrap(aCx, this);
    1.59 +  }
    1.60 +
    1.61 +  CanvasRenderingContext2D* GetParentObject()
    1.62 +  {
    1.63 +    return mContext;
    1.64 +  }
    1.65 +
    1.66 +  nsRefPtr<CanvasRenderingContext2D> mContext;
    1.67 +  RefPtr<gfx::SourceSurface> mSurface;
    1.68 +  nsCOMPtr<nsIPrincipal> mPrincipal;
    1.69 +  const bool mForceWriteOnly;
    1.70 +  const bool mCORSUsed;
    1.71 +  const RepeatMode mRepeat;
    1.72 +};
    1.73 +
    1.74 +MOZ_FINISH_NESTED_ENUM_CLASS(CanvasPattern::RepeatMode)
    1.75 +
    1.76 +}
    1.77 +}
    1.78 +
    1.79 +#endif // mozilla_dom_CanvasPattern_h

mercurial