no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / gfx / 2d / ConicGradientEffectD2D1.h
blobb0e168417b9c796ddf58a3e2f1c478b0d71593ff
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef MOZILLA_GFX_CONICGRADIENTEFFECTD2D1_H_
8 #define MOZILLA_GFX_CONICGRADIENTEFFECTD2D1_H_
10 #include <d2d1_1.h>
11 #include <d2d1effectauthor.h>
12 #include <d2d1effecthelpers.h>
14 #include "2D.h"
15 #include "mozilla/Attributes.h"
17 // {fa4e3246-be57-4052-8c8b-881cc3633287}
18 DEFINE_GUID(CLSID_ConicGradientEffect, 0xfa4e3246, 0xbe57, 0x4052, 0x8c, 0x8b,
19 0x88, 0x1c, 0xc3, 0x63, 0x32, 0x87);
21 // Macro to keep our class nice and clean.
22 #define SIMPLE_PROP(type, name) \
23 public: \
24 HRESULT Set##name(type a##name) { \
25 m##name = a##name; \
26 return S_OK; \
27 } \
28 type Get##name() const { return m##name; } \
30 private: \
31 type m##name;
33 namespace mozilla {
34 namespace gfx {
36 enum {
37 CONIC_PROP_STOP_COLLECTION = 0,
38 CONIC_PROP_CENTER,
39 CONIC_PROP_ANGLE,
40 CONIC_PROP_START_OFFSET,
41 CONIC_PROP_END_OFFSET,
42 CONIC_PROP_TRANSFORM
45 class ConicGradientEffectD2D1 final : public ID2D1EffectImpl,
46 public ID2D1DrawTransform {
47 public:
48 // ID2D1EffectImpl
49 IFACEMETHODIMP Initialize(ID2D1EffectContext* pContextInternal,
50 ID2D1TransformGraph* pTransformGraph);
51 IFACEMETHODIMP PrepareForRender(D2D1_CHANGE_TYPE changeType);
52 IFACEMETHODIMP SetGraph(ID2D1TransformGraph* pGraph);
54 // IUnknown
55 IFACEMETHODIMP_(ULONG) AddRef();
56 IFACEMETHODIMP_(ULONG) Release();
57 IFACEMETHODIMP QueryInterface(REFIID riid, void** ppOutput);
59 // ID2D1Transform
60 IFACEMETHODIMP MapInputRectsToOutputRect(
61 const D2D1_RECT_L* pInputRects, const D2D1_RECT_L* pInputOpaqueSubRects,
62 UINT32 inputRectCount, D2D1_RECT_L* pOutputRect,
63 D2D1_RECT_L* pOutputOpaqueSubRect);
64 IFACEMETHODIMP MapOutputRectToInputRects(const D2D1_RECT_L* pOutputRect,
65 D2D1_RECT_L* pInputRects,
66 UINT32 inputRectCount) const;
67 IFACEMETHODIMP MapInvalidRect(UINT32 inputIndex, D2D1_RECT_L invalidInputRect,
68 D2D1_RECT_L* pInvalidOutputRect) const;
70 // ID2D1TransformNode
71 IFACEMETHODIMP_(UINT32) GetInputCount() const { return 1; }
73 // ID2D1DrawTransform
74 IFACEMETHODIMP SetDrawInfo(ID2D1DrawInfo* pDrawInfo);
76 static HRESULT Register(ID2D1Factory1* aFactory);
77 static void Unregister(ID2D1Factory1* aFactory);
78 static HRESULT __stdcall CreateEffect(IUnknown** aEffectImpl);
80 HRESULT SetStopCollection(IUnknown* aStopCollection);
81 IUnknown* GetStopCollection() const { return mStopCollection; }
83 private:
84 already_AddRefed<ID2D1ResourceTexture> CreateGradientTexture();
86 ConicGradientEffectD2D1();
88 uint32_t mRefCount;
89 RefPtr<ID2D1GradientStopCollection> mStopCollection;
90 RefPtr<ID2D1EffectContext> mEffectContext;
91 RefPtr<ID2D1DrawInfo> mDrawInfo;
92 SIMPLE_PROP(D2D1_VECTOR_2F, Center);
93 SIMPLE_PROP(FLOAT, Angle);
94 SIMPLE_PROP(FLOAT, StartOffset);
95 SIMPLE_PROP(FLOAT, EndOffset);
96 SIMPLE_PROP(D2D_MATRIX_3X2_F, Transform);
99 } // namespace gfx
100 } // namespace mozilla
101 #undef SIMPLE_PROP
103 #endif