Minor fix.
[xy_vsfilter.git] / src / subtitles / xy_bitmap.h
blob6295eeed5e309009f805d77d46fc839a2e849f0e
1 #ifndef __XY_BITMAP_674EB983_2A49_432D_A750_62C3B3E9DA67_H__
2 #define __XY_BITMAP_674EB983_2A49_432D_A750_62C3B3E9DA67_H__
4 #include <atltypes.h>
5 #include <boost/shared_ptr.hpp>
6 #include "XySubRenderIntf.h"
8 class XyBitmap
10 public:
11 enum MemLayout { PACK, PLANNA, RESERVED };
13 int type;
15 int x, y, w, h;
16 int pitch, bpp;
17 void* bits;
18 BYTE* plans[4];
19 public:
20 XyBitmap()
22 x = y = w = h = 0;
23 type = 0;
24 pitch = 0;
25 bits = NULL;
26 plans[0] = plans[1] = plans[2] = plans[3] = NULL;
28 ~XyBitmap();
30 static XyBitmap *CreateBitmap(const CRect& target_rect, MemLayout layout);
32 static void AlphaBltPack(SubPicDesc& spd, POINT pos, SIZE size, LPCVOID pixels, int pitch);
33 static void AlphaBltPlannar(SubPicDesc& spd, POINT pos, SIZE size, const XyPlannerFormatExtra& pixels, int pitch);
34 private:
35 static void ClearBitmap(XyBitmap *bitmap);
38 class XySubRenderFrame: public CUnknown, public IXySubRenderFrame
40 public:
41 DECLARE_IUNKNOWN;
42 STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
44 STDMETHODIMP GetOutputRect(RECT *outputRect);
45 STDMETHODIMP GetClipRect(RECT *clipRect);
46 STDMETHODIMP GetXyColorSpace(int *xyColorSpace);
47 STDMETHODIMP GetBitmapCount(int *count);
48 STDMETHODIMP GetBitmap(int index, ULONGLONG *id, POINT *position, SIZE *size, LPCVOID *pixels, int *pitch);
49 STDMETHODIMP GetBitmapExtra(int index, LPVOID extra_info);
50 public:
51 XySubRenderFrame();
52 ~XySubRenderFrame();
54 typedef ::boost::shared_ptr<XyBitmap> SharedBitmap;
55 public:
56 CAtlArray<SharedBitmap> m_bitmaps;
57 CAtlArray<int> m_bitmap_ids;
58 CRect m_output_rect;
59 CRect m_clip_rect;
60 XyColorSpace m_xy_color_space;
63 typedef ::boost::shared_ptr<XySubRenderFrame> SharedPtrXySubRenderFrame;
65 class XySubRenderFrameCreater
67 public:
68 static XySubRenderFrameCreater* GetDefaultCreater();
70 HRESULT SetOutputRect(const RECT& output_rect);
71 HRESULT SetClipRect(const RECT& clip_rect);
72 HRESULT SetColorSpace(XyColorSpace color_space);
74 HRESULT GetOutputRect(RECT *output_rect);
75 HRESULT GetClipRect(RECT *clip_rect);
76 HRESULT GetColorSpace(XyColorSpace *color_space);
78 XySubRenderFrame* NewXySubRenderFrame(UINT bitmap_count);
79 XyBitmap* CreateBitmap(const RECT& target_rect);
80 DWORD TransColor(DWORD argb);
82 XySubRenderFrameCreater():m_xy_color_space(XY_CS_ARGB), m_bitmap_layout(XyBitmap::PACK){}
83 private:
84 CRect m_output_rect;
85 CRect m_clip_rect;
86 XyColorSpace m_xy_color_space;
87 XyBitmap::MemLayout m_bitmap_layout;
91 #endif // __XY_BITMAP_674EB983_2A49_432D_A750_62C3B3E9DA67_H__