4 * Implementation of OLE IPicture and related interfaces
6 * Copyright 2000 Huw D M Davies for CodeWeavers.
7 * Copyright 2001 Marcus Meissner
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 * Support PICTYPE_BITMAP and PICTYPE_ICON, altough only bitmaps very well..
26 * Lots of methods are just stubs.
29 * NOTES (or things that msdn doesn't tell you)
31 * The width and height properties are returned in HIMETRIC units (0.01mm)
32 * IPicture::Render also uses these to select a region of the src picture.
33 * A bitmap's size is converted into these units by using the screen resolution
34 * thus an 8x8 bitmap on a 96dpi screen has a size of 212x212 (8/96 * 2540).
47 /* Must be before wine includes, the header has things conflicting with
54 #define NONAMELESSUNION
55 #define NONAMELESSSTRUCT
65 #include "wine/debug.h"
67 #include "wine/wingdi16.h"
68 #include "cursoricon.h"
71 /* This is a hack, so jpeglib.h does not redefine INT32 and the like*/
73 #define UINT8 JPEG_UINT8
74 #define UINT16 JPEG_UINT16
82 WINE_DEFAULT_DEBUG_CHANNEL(ole);
84 /*************************************************************************
85 * Declaration of implementation class
88 typedef struct OLEPictureImpl {
91 * IPicture handles IUnknown
94 ICOM_VTABLE(IPicture) *lpvtbl1;
95 ICOM_VTABLE(IDispatch) *lpvtbl2;
96 ICOM_VTABLE(IPersistStream) *lpvtbl3;
97 ICOM_VTABLE(IConnectionPointContainer) *lpvtbl4;
99 /* Object referenece count */
102 /* We own the object and must destroy it ourselves */
105 /* Picture description */
108 /* These are the pixel size of a bitmap */
112 /* And these are the size of the picture converted into HIMETRIC units */
113 OLE_XSIZE_HIMETRIC himetricWidth;
114 OLE_YSIZE_HIMETRIC himetricHeight;
116 IConnectionPoint *pCP;
121 /* Bitmap transparency mask */
131 * Macros to retrieve pointer to IUnknown (IPicture) from the other VTables.
133 #define ICOM_THIS_From_IDispatch(impl, name) \
134 impl *This = (impl*)(((char*)name)-sizeof(void*));
135 #define ICOM_THIS_From_IPersistStream(impl, name) \
136 impl *This = (impl*)(((char*)name)-2*sizeof(void*));
137 #define ICOM_THIS_From_IConnectionPointContainer(impl, name) \
138 impl *This = (impl*)(((char*)name)-3*sizeof(void*));
141 * Predeclare VTables. They get initialized at the end.
143 static ICOM_VTABLE(IPicture) OLEPictureImpl_VTable;
144 static ICOM_VTABLE(IDispatch) OLEPictureImpl_IDispatch_VTable;
145 static ICOM_VTABLE(IPersistStream) OLEPictureImpl_IPersistStream_VTable;
146 static ICOM_VTABLE(IConnectionPointContainer) OLEPictureImpl_IConnectionPointContainer_VTable;
148 /***********************************************************************
149 * Implementation of the OLEPictureImpl class.
152 static void OLEPictureImpl_SetBitmap(OLEPictureImpl*This) {
156 TRACE("bitmap handle %p\n", This->desc.u.bmp.hbitmap);
157 if(GetObjectA(This->desc.u.bmp.hbitmap, sizeof(bm), &bm) != sizeof(bm)) {
158 ERR("GetObject fails\n");
161 This->origWidth = bm.bmWidth;
162 This->origHeight = bm.bmHeight;
163 /* The width and height are stored in HIMETRIC units (0.01 mm),
164 so we take our pixel width divide by pixels per inch and
165 multiply by 25.4 * 100 */
166 /* Should we use GetBitmapDimension if available? */
167 hdcRef = CreateCompatibleDC(0);
168 This->himetricWidth =(bm.bmWidth *2540)/GetDeviceCaps(hdcRef, LOGPIXELSX);
169 This->himetricHeight=(bm.bmHeight*2540)/GetDeviceCaps(hdcRef, LOGPIXELSY);
173 /************************************************************************
174 * OLEPictureImpl_Construct
176 * This method will construct a new instance of the OLEPictureImpl
179 * The caller of this method must release the object when it's
182 static OLEPictureImpl* OLEPictureImpl_Construct(LPPICTDESC pictDesc, BOOL fOwn)
184 OLEPictureImpl* newObject = 0;
187 TRACE("(%p) type = %d\n", pictDesc, pictDesc->picType);
190 * Allocate space for the object.
192 newObject = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(OLEPictureImpl));
198 * Initialize the virtual function table.
200 newObject->lpvtbl1 = &OLEPictureImpl_VTable;
201 newObject->lpvtbl2 = &OLEPictureImpl_IDispatch_VTable;
202 newObject->lpvtbl3 = &OLEPictureImpl_IPersistStream_VTable;
203 newObject->lpvtbl4 = &OLEPictureImpl_IConnectionPointContainer_VTable;
205 CreateConnectionPoint((IUnknown*)newObject,&IID_IPropertyNotifySink,&newObject->pCP);
208 * Start with one reference count. The caller of this function
209 * must release the interface pointer when it is done.
212 newObject->hDCCur = 0;
214 newObject->fOwn = fOwn;
216 /* dunno about original value */
217 newObject->keepOrigFormat = TRUE;
219 newObject->hbmMask = NULL;
222 if(pictDesc->cbSizeofstruct != sizeof(PICTDESC)) {
223 FIXME("struct size = %d\n", pictDesc->cbSizeofstruct);
225 memcpy(&newObject->desc, pictDesc, sizeof(PICTDESC));
228 switch(pictDesc->picType) {
230 OLEPictureImpl_SetBitmap(newObject);
233 case PICTYPE_METAFILE:
234 TRACE("metafile handle %p\n", pictDesc->u.wmf.hmeta);
235 newObject->himetricWidth = pictDesc->u.wmf.xExt;
236 newObject->himetricHeight = pictDesc->u.wmf.yExt;
240 /* not sure what to do here */
241 newObject->himetricWidth = newObject->himetricHeight = 0;
245 case PICTYPE_ENHMETAFILE:
247 FIXME("Unsupported type %d\n", pictDesc->picType);
248 newObject->himetricWidth = newObject->himetricHeight = 0;
252 newObject->desc.picType = PICTYPE_UNINITIALIZED;
255 TRACE("returning %p\n", newObject);
259 /************************************************************************
260 * OLEPictureImpl_Destroy
262 * This method is called by the Release method when the reference
263 * count goes down to 0. It will free all resources used by
265 static void OLEPictureImpl_Destroy(OLEPictureImpl* Obj)
267 TRACE("(%p)\n", Obj);
269 if(Obj->fOwn) { /* We need to destroy the picture */
270 switch(Obj->desc.picType) {
272 DeleteObject(Obj->desc.u.bmp.hbitmap);
274 case PICTYPE_METAFILE:
275 DeleteMetaFile(Obj->desc.u.wmf.hmeta);
278 DestroyIcon(Obj->desc.u.icon.hicon);
280 case PICTYPE_ENHMETAFILE:
281 DeleteEnhMetaFile(Obj->desc.u.emf.hemf);
284 FIXME("Unsupported type %d - unable to delete\n", Obj->desc.picType);
288 if (Obj->data) HeapFree(GetProcessHeap(), 0, Obj->data);
289 HeapFree(GetProcessHeap(), 0, Obj);
292 static ULONG WINAPI OLEPictureImpl_AddRef(IPicture* iface);
294 /************************************************************************
295 * OLEPictureImpl_QueryInterface (IUnknown)
297 * See Windows documentation for more details on IUnknown methods.
299 static HRESULT WINAPI OLEPictureImpl_QueryInterface(
304 ICOM_THIS(OLEPictureImpl, iface);
305 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObject);
308 * Perform a sanity check on the parameters.
310 if ( (This==0) || (ppvObject==0) )
314 * Initialize the return parameter.
319 * Compare the riid with the interface IDs implemented by this object.
321 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0)
323 *ppvObject = (IPicture*)This;
325 else if (memcmp(&IID_IPicture, riid, sizeof(IID_IPicture)) == 0)
327 *ppvObject = (IPicture*)This;
329 else if (memcmp(&IID_IDispatch, riid, sizeof(IID_IDispatch)) == 0)
331 *ppvObject = (IDispatch*)&(This->lpvtbl2);
333 else if (memcmp(&IID_IPictureDisp, riid, sizeof(IID_IPictureDisp)) == 0)
335 *ppvObject = (IDispatch*)&(This->lpvtbl2);
337 else if (memcmp(&IID_IPersistStream, riid, sizeof(IID_IPersistStream)) == 0)
339 *ppvObject = (IPersistStream*)&(This->lpvtbl3);
341 else if (memcmp(&IID_IConnectionPointContainer, riid, sizeof(IID_IConnectionPointContainer)) == 0)
343 *ppvObject = (IConnectionPointContainer*)&(This->lpvtbl4);
346 * Check that we obtained an interface.
350 FIXME("() : asking for un supported interface %s\n",debugstr_guid(riid));
351 return E_NOINTERFACE;
355 * Query Interface always increases the reference count by one when it is
358 OLEPictureImpl_AddRef((IPicture*)This);
362 /***********************************************************************
363 * OLEPicture_SendNotify (internal)
365 * Sends notification messages of changed properties to any interested
368 static void OLEPicture_SendNotify(OLEPictureImpl* this, DISPID dispID)
370 IEnumConnections *pEnum;
373 if (IConnectionPoint_EnumConnections(this->pCP, &pEnum))
375 while(IEnumConnections_Next(pEnum, 1, &CD, NULL) == S_OK) {
376 IPropertyNotifySink *sink;
378 IUnknown_QueryInterface(CD.pUnk, &IID_IPropertyNotifySink, (LPVOID)&sink);
379 IPropertyNotifySink_OnChanged(sink, dispID);
380 IPropertyNotifySink_Release(sink);
381 IUnknown_Release(CD.pUnk);
383 IEnumConnections_Release(pEnum);
387 /************************************************************************
388 * OLEPictureImpl_AddRef (IUnknown)
390 * See Windows documentation for more details on IUnknown methods.
392 static ULONG WINAPI OLEPictureImpl_AddRef(
395 ICOM_THIS(OLEPictureImpl, iface);
396 TRACE("(%p)->(ref=%ld)\n", This, This->ref);
402 /************************************************************************
403 * OLEPictureImpl_Release (IUnknown)
405 * See Windows documentation for more details on IUnknown methods.
407 static ULONG WINAPI OLEPictureImpl_Release(
410 ICOM_THIS(OLEPictureImpl, iface);
411 TRACE("(%p)->(ref=%ld)\n", This, This->ref);
414 * Decrease the reference count on this object.
419 * If the reference count goes down to 0, perform suicide.
423 OLEPictureImpl_Destroy(This);
432 /************************************************************************
433 * OLEPictureImpl_get_Handle
435 static HRESULT WINAPI OLEPictureImpl_get_Handle(IPicture *iface,
438 ICOM_THIS(OLEPictureImpl, iface);
439 TRACE("(%p)->(%p)\n", This, phandle);
440 switch(This->desc.picType) {
442 *phandle = (OLE_HANDLE)This->desc.u.bmp.hbitmap;
444 case PICTYPE_METAFILE:
445 *phandle = (OLE_HANDLE)This->desc.u.wmf.hmeta;
448 *phandle = (OLE_HANDLE)This->desc.u.icon.hicon;
450 case PICTYPE_ENHMETAFILE:
451 *phandle = (OLE_HANDLE)This->desc.u.emf.hemf;
454 FIXME("Unimplemented type %d\n", This->desc.picType);
457 TRACE("returning handle %08x\n", *phandle);
461 /************************************************************************
462 * OLEPictureImpl_get_hPal
464 static HRESULT WINAPI OLEPictureImpl_get_hPal(IPicture *iface,
467 ICOM_THIS(OLEPictureImpl, iface);
468 FIXME("(%p)->(%p): stub\n", This, phandle);
472 /************************************************************************
473 * OLEPictureImpl_get_Type
475 static HRESULT WINAPI OLEPictureImpl_get_Type(IPicture *iface,
478 ICOM_THIS(OLEPictureImpl, iface);
479 TRACE("(%p)->(%p): type is %d\n", This, ptype, This->desc.picType);
480 *ptype = This->desc.picType;
484 /************************************************************************
485 * OLEPictureImpl_get_Width
487 static HRESULT WINAPI OLEPictureImpl_get_Width(IPicture *iface,
488 OLE_XSIZE_HIMETRIC *pwidth)
490 ICOM_THIS(OLEPictureImpl, iface);
491 TRACE("(%p)->(%p): width is %ld\n", This, pwidth, This->himetricWidth);
492 *pwidth = This->himetricWidth;
496 /************************************************************************
497 * OLEPictureImpl_get_Height
499 static HRESULT WINAPI OLEPictureImpl_get_Height(IPicture *iface,
500 OLE_YSIZE_HIMETRIC *pheight)
502 ICOM_THIS(OLEPictureImpl, iface);
503 TRACE("(%p)->(%p): height is %ld\n", This, pheight, This->himetricHeight);
504 *pheight = This->himetricHeight;
508 /************************************************************************
509 * OLEPictureImpl_Render
511 static HRESULT WINAPI OLEPictureImpl_Render(IPicture *iface, HDC hdc,
512 long x, long y, long cx, long cy,
513 OLE_XPOS_HIMETRIC xSrc,
514 OLE_YPOS_HIMETRIC ySrc,
515 OLE_XSIZE_HIMETRIC cxSrc,
516 OLE_YSIZE_HIMETRIC cySrc,
519 ICOM_THIS(OLEPictureImpl, iface);
520 TRACE("(%p)->(%p, (%ld,%ld), (%ld,%ld) <- (%ld,%ld), (%ld,%ld), %p)\n",
521 This, hdc, x, y, cx, cy, xSrc, ySrc, cxSrc, cySrc, prcWBounds);
523 TRACE("prcWBounds (%ld,%ld) - (%ld,%ld)\n", prcWBounds->left, prcWBounds->top,
524 prcWBounds->right, prcWBounds->bottom);
527 * While the documentation suggests this to be here (or after rendering?)
528 * it does cause an endless recursion in my sample app. -MM 20010804
529 OLEPicture_SendNotify(This,DISPID_PICT_RENDER);
532 switch(This->desc.picType) {
538 /* Set a mapping mode that maps bitmap pixels into HIMETRIC units.
539 NB y-axis gets flipped */
541 hdcBmp = CreateCompatibleDC(0);
542 SetMapMode(hdcBmp, MM_ANISOTROPIC);
543 SetWindowOrgEx(hdcBmp, 0, 0, NULL);
544 SetWindowExtEx(hdcBmp, This->himetricWidth, This->himetricHeight, NULL);
545 SetViewportOrgEx(hdcBmp, 0, This->origHeight, NULL);
546 SetViewportExtEx(hdcBmp, This->origWidth, -This->origHeight, NULL);
548 hbmpOld = SelectObject(hdcBmp, This->desc.u.bmp.hbitmap);
551 HDC hdcMask = CreateCompatibleDC(0);
552 HBITMAP hOldbm = SelectObject(hdcMask, This->hbmMask);
554 SetMapMode(hdcMask, MM_ANISOTROPIC);
555 SetWindowOrgEx(hdcMask, 0, 0, NULL);
556 SetWindowExtEx(hdcMask, This->himetricWidth, This->himetricHeight, NULL);
557 SetViewportOrgEx(hdcMask, 0, This->origHeight, NULL);
558 SetViewportExtEx(hdcMask, This->origWidth, -This->origHeight, NULL);
560 SetBkColor(hdc, RGB(255, 255, 255));
561 SetTextColor(hdc, RGB(0, 0, 0));
562 StretchBlt(hdc, x, y, cx, cy, hdcMask, xSrc, ySrc, cxSrc, cySrc, SRCAND);
563 StretchBlt(hdc, x, y, cx, cy, hdcBmp, xSrc, ySrc, cxSrc, cySrc, SRCPAINT);
565 SelectObject(hdcMask, hOldbm);
568 StretchBlt(hdc, x, y, cx, cy, hdcBmp, xSrc, ySrc, cxSrc, cySrc, SRCCOPY);
570 SelectObject(hdcBmp, hbmpOld);
575 FIXME("Not quite correct implementation of rendering icons...\n");
576 DrawIcon(hdc,x,y,This->desc.u.icon.hicon);
579 case PICTYPE_METAFILE:
580 case PICTYPE_ENHMETAFILE:
582 FIXME("type %d not implemented\n", This->desc.picType);
588 /************************************************************************
589 * OLEPictureImpl_set_hPal
591 static HRESULT WINAPI OLEPictureImpl_set_hPal(IPicture *iface,
594 ICOM_THIS(OLEPictureImpl, iface);
595 FIXME("(%p)->(%08x): stub\n", This, hpal);
596 OLEPicture_SendNotify(This,DISPID_PICT_HPAL);
600 /************************************************************************
601 * OLEPictureImpl_get_CurDC
603 static HRESULT WINAPI OLEPictureImpl_get_CurDC(IPicture *iface,
606 ICOM_THIS(OLEPictureImpl, iface);
607 TRACE("(%p), returning %p\n", This, This->hDCCur);
608 if (phdc) *phdc = This->hDCCur;
612 /************************************************************************
613 * OLEPictureImpl_SelectPicture
615 static HRESULT WINAPI OLEPictureImpl_SelectPicture(IPicture *iface,
618 OLE_HANDLE *phbmpOut)
620 ICOM_THIS(OLEPictureImpl, iface);
621 TRACE("(%p)->(%p, %p, %p)\n", This, hdcIn, phdcOut, phbmpOut);
622 if (This->desc.picType == PICTYPE_BITMAP) {
623 SelectObject(hdcIn,This->desc.u.bmp.hbitmap);
626 *phdcOut = This->hDCCur;
627 This->hDCCur = hdcIn;
629 *phbmpOut = (OLE_HANDLE)This->desc.u.bmp.hbitmap;
632 FIXME("Don't know how to select picture type %d\n",This->desc.picType);
637 /************************************************************************
638 * OLEPictureImpl_get_KeepOriginalFormat
640 static HRESULT WINAPI OLEPictureImpl_get_KeepOriginalFormat(IPicture *iface,
643 ICOM_THIS(OLEPictureImpl, iface);
644 TRACE("(%p)->(%p)\n", This, pfKeep);
647 *pfKeep = This->keepOrigFormat;
651 /************************************************************************
652 * OLEPictureImpl_put_KeepOriginalFormat
654 static HRESULT WINAPI OLEPictureImpl_put_KeepOriginalFormat(IPicture *iface,
657 ICOM_THIS(OLEPictureImpl, iface);
658 TRACE("(%p)->(%d)\n", This, keep);
659 This->keepOrigFormat = keep;
660 /* FIXME: what DISPID notification here? */
664 /************************************************************************
665 * OLEPictureImpl_PictureChanged
667 static HRESULT WINAPI OLEPictureImpl_PictureChanged(IPicture *iface)
669 ICOM_THIS(OLEPictureImpl, iface);
670 TRACE("(%p)->()\n", This);
671 OLEPicture_SendNotify(This,DISPID_PICT_HANDLE);
675 /************************************************************************
676 * OLEPictureImpl_SaveAsFile
678 static HRESULT WINAPI OLEPictureImpl_SaveAsFile(IPicture *iface,
683 ICOM_THIS(OLEPictureImpl, iface);
684 FIXME("(%p)->(%p, %d, %p), hacked stub.\n", This, pstream, SaveMemCopy, pcbSize);
685 return IStream_Write(pstream,This->data,This->datalen,(ULONG*)pcbSize);
688 /************************************************************************
689 * OLEPictureImpl_get_Attributes
691 static HRESULT WINAPI OLEPictureImpl_get_Attributes(IPicture *iface,
694 ICOM_THIS(OLEPictureImpl, iface);
695 TRACE("(%p)->(%p).\n", This, pdwAttr);
697 switch (This->desc.picType) {
698 case PICTYPE_BITMAP: break; /* not 'truely' scalable, see MSDN. */
699 case PICTYPE_ICON: *pdwAttr = PICTURE_TRANSPARENT;break;
700 case PICTYPE_METAFILE: *pdwAttr = PICTURE_TRANSPARENT|PICTURE_SCALABLE;break;
701 default:FIXME("Unknown pictype %d\n",This->desc.picType);break;
707 /************************************************************************
708 * IConnectionPointContainer
711 static HRESULT WINAPI OLEPictureImpl_IConnectionPointContainer_QueryInterface(
712 IConnectionPointContainer* iface,
716 ICOM_THIS_From_IConnectionPointContainer(IPicture,iface);
718 return IPicture_QueryInterface(This,riid,ppvoid);
721 static ULONG WINAPI OLEPictureImpl_IConnectionPointContainer_AddRef(
722 IConnectionPointContainer* iface)
724 ICOM_THIS_From_IConnectionPointContainer(IPicture, iface);
726 return IPicture_AddRef(This);
729 static ULONG WINAPI OLEPictureImpl_IConnectionPointContainer_Release(
730 IConnectionPointContainer* iface)
732 ICOM_THIS_From_IConnectionPointContainer(IPicture, iface);
734 return IPicture_Release(This);
737 static HRESULT WINAPI OLEPictureImpl_EnumConnectionPoints(
738 IConnectionPointContainer* iface,
739 IEnumConnectionPoints** ppEnum
741 ICOM_THIS_From_IConnectionPointContainer(IPicture, iface);
743 FIXME("(%p,%p), stub!\n",This,ppEnum);
747 static HRESULT WINAPI OLEPictureImpl_FindConnectionPoint(
748 IConnectionPointContainer* iface,
750 IConnectionPoint **ppCP
752 ICOM_THIS_From_IConnectionPointContainer(OLEPictureImpl, iface);
753 TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppCP);
757 if (IsEqualGUID(riid,&IID_IPropertyNotifySink))
758 return IConnectionPoint_QueryInterface(This->pCP,&IID_IConnectionPoint,(LPVOID)ppCP);
759 FIXME("tried to find connection point on %s?\n",debugstr_guid(riid));
762 /************************************************************************
765 /************************************************************************
766 * OLEPictureImpl_IPersistStream_QueryInterface (IUnknown)
768 * See Windows documentation for more details on IUnknown methods.
770 static HRESULT WINAPI OLEPictureImpl_IPersistStream_QueryInterface(
771 IPersistStream* iface,
775 ICOM_THIS_From_IPersistStream(IPicture, iface);
777 return IPicture_QueryInterface(This, riid, ppvoid);
780 /************************************************************************
781 * OLEPictureImpl_IPersistStream_AddRef (IUnknown)
783 * See Windows documentation for more details on IUnknown methods.
785 static ULONG WINAPI OLEPictureImpl_IPersistStream_AddRef(
786 IPersistStream* iface)
788 ICOM_THIS_From_IPersistStream(IPicture, iface);
790 return IPicture_AddRef(This);
793 /************************************************************************
794 * OLEPictureImpl_IPersistStream_Release (IUnknown)
796 * See Windows documentation for more details on IUnknown methods.
798 static ULONG WINAPI OLEPictureImpl_IPersistStream_Release(
799 IPersistStream* iface)
801 ICOM_THIS_From_IPersistStream(IPicture, iface);
803 return IPicture_Release(This);
806 /************************************************************************
807 * OLEPictureImpl_IPersistStream_GetClassID
809 static HRESULT WINAPI OLEPictureImpl_GetClassID(
810 IPersistStream* iface,CLSID* pClassID)
812 ICOM_THIS_From_IPersistStream(IPicture, iface);
813 FIXME("(%p),stub!\n",This);
817 /************************************************************************
818 * OLEPictureImpl_IPersistStream_IsDirty
820 static HRESULT WINAPI OLEPictureImpl_IsDirty(
821 IPersistStream* iface)
823 ICOM_THIS_From_IPersistStream(IPicture, iface);
824 FIXME("(%p),stub!\n",This);
829 /* for the jpeg decompressor source manager. */
830 static void _jpeg_init_source(j_decompress_ptr cinfo) { }
832 static boolean _jpeg_fill_input_buffer(j_decompress_ptr cinfo) {
833 ERR("(), should not get here.\n");
837 static void _jpeg_skip_input_data(j_decompress_ptr cinfo,long num_bytes) {
838 TRACE("Skipping %ld bytes...\n", num_bytes);
839 cinfo->src->next_input_byte += num_bytes;
840 cinfo->src->bytes_in_buffer -= num_bytes;
843 static boolean _jpeg_resync_to_restart(j_decompress_ptr cinfo, int desired) {
844 ERR("(desired=%d), should not get here.\n",desired);
847 static void _jpeg_term_source(j_decompress_ptr cinfo) { }
848 #endif /* HAVE_LIBJPEG */
857 static int _gif_inputfunc(GifFileType *gif, GifByteType *data, int len) {
858 struct gifdata *gd = (struct gifdata*)gif->UserData;
860 if (len+gd->curoff > gd->len) {
861 FIXME("Trying to read %d bytes, but only %d available.\n",len, gd->len-gd->curoff);
862 len = gd->len - gd->curoff;
864 memcpy(data, gd->data+gd->curoff, len);
870 /************************************************************************
871 * OLEPictureImpl_IPersistStream_Load (IUnknown)
873 * Loads the binary data from the IStream. Starts at current position.
874 * There appears to be an 2 DWORD header:
878 * Currently implemented: BITMAP, ICON, JPEG.
880 static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
887 ICOM_THIS_From_IPersistStream(OLEPictureImpl, iface);
889 TRACE("(%p,%p)\n",This,pStm);
891 /* Sometimes we have a header, sometimes we don't. Apply some guesses to find
894 hr=IStream_Stat(pStm,&statstg,STATFLAG_NONAME);
896 FIXME("Stat failed with hres %lx\n",hr);
897 hr=IStream_Read(pStm,header,8,&xread);
898 if (hr || xread!=8) {
899 FIXME("Failure while reading picture header (hr is %lx, nread is %ld).\n",hr,xread);
902 if (header[1] > statstg.cbSize.QuadPart || (header[1]==0)) {/* Incorrect header, assume none. */
904 xbuf = This->data = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,statstg.cbSize.QuadPart);
905 memcpy(xbuf,&header,8);
906 This->datalen = statstg.cbSize.QuadPart;
907 while (xread < This->datalen) {
909 hr = IStream_Read(pStm,xbuf+xread,This->datalen-xread,&nread);
914 if (xread != This->datalen)
915 FIXME("Could only read %ld of %d bytes in no-header case?\n",xread,This->datalen);
918 xbuf = This->data = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,header[1]);
919 This->datalen = header[1];
920 while (xread < header[1]) {
922 hr = IStream_Read(pStm,xbuf+xread,header[1]-xread,&nread);
927 if (xread != header[1])
928 FIXME("Could only read %ld of %ld bytes?\n",xread,header[1]);
930 magic = xbuf[0] + (xbuf[1]<<8);
932 case 0x4947: { /* GIF */
943 int transparent = -1;
949 gif = DGifOpen((void*)&gd, _gif_inputfunc);
950 ret = DGifSlurp(gif);
951 if (ret == GIF_ERROR) {
952 FIXME("Failed reading GIF using libgif.\n");
955 TRACE("screen height %d, width %d\n", gif->SWidth, gif->SHeight);
956 TRACE("color res %d, backgcolor %d\n", gif->SColorResolution, gif->SBackGroundColor);
957 TRACE("imgcnt %d\n", gif->ImageCount);
958 if (gif->ImageCount<1) {
959 FIXME("GIF stream does not have images inside?\n");
962 TRACE("curimage: %d x %d, on %dx%d, interlace %d\n",
963 gif->Image.Width, gif->Image.Height,
964 gif->Image.Left, gif->Image.Top,
968 bmi = HeapAlloc(GetProcessHeap(),0,sizeof(BITMAPINFOHEADER)+(1<<gif->SColorResolution)*sizeof(RGBQUAD));
969 bytes= HeapAlloc(GetProcessHeap(),0,gif->SWidth*gif->SHeight);
970 si = gif->SavedImages+0;
971 gid = &(si->ImageDesc);
973 if (!cm) cm = gif->SColorMap;
975 /* look for the transparent color extension */
976 for (i = 0; i < si->ExtensionBlockCount; ++i) {
977 eb = si->ExtensionBlocks + i;
978 if (eb->Function == 0xF9 && eb->ByteCount == 4) {
979 if ((eb->Bytes[0] & 1) == 1) {
980 transparent = eb->Bytes[3];
985 for (i=0;i<(1<<gif->SColorResolution);i++) {
986 bmi->bmiColors[i].rgbRed = cm->Colors[i].Red;
987 bmi->bmiColors[i].rgbGreen = cm->Colors[i].Green;
988 bmi->bmiColors[i].rgbBlue = cm->Colors[i].Blue;
989 if (i == transparent) {
990 This->rgbTrans = RGB(bmi->bmiColors[i].rgbRed,
991 bmi->bmiColors[i].rgbGreen,
992 bmi->bmiColors[i].rgbBlue);
996 /* Map to in picture coordinates */
997 for (i=0;i<gid->Height;i++)
998 for (j=0;j<gid->Width;j++)
999 bytes[(gid->Top+(gif->SHeight-i-1))*gif->SWidth+gid->Left+j]=si->RasterBits[i*gid->Width+j];
1000 bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
1001 bmi->bmiHeader.biWidth = gif->SWidth;
1002 bmi->bmiHeader.biHeight = gif->SHeight;
1003 bmi->bmiHeader.biPlanes = 1;
1004 bmi->bmiHeader.biBitCount = 8;
1005 bmi->bmiHeader.biCompression = BI_RGB;
1006 bmi->bmiHeader.biSizeImage = gif->SWidth*gif->SHeight;
1007 bmi->bmiHeader.biXPelsPerMeter = 0;
1008 bmi->bmiHeader.biYPelsPerMeter = 0;
1009 bmi->bmiHeader.biClrUsed = 1 << gif->SColorResolution;
1010 bmi->bmiHeader.biClrImportant = 0;
1013 This->desc.u.bmp.hbitmap=CreateDIBitmap(
1022 if (transparent > -1) {
1023 /* Create the Mask */
1024 HDC hdc = CreateCompatibleDC(0);
1025 HDC hdcMask = CreateCompatibleDC(0);
1027 HBITMAP hOldbitmapmask;
1029 This->hbmMask = CreateBitmap(bmi->bmiHeader.biWidth, bmi->bmiHeader.biHeight, 1, 1, NULL);
1031 hOldbitmap = SelectObject(hdc,This->desc.u.bmp.hbitmap);
1032 hOldbitmapmask = SelectObject(hdcMask, This->hbmMask);
1033 SetBkColor(hdc, This->rgbTrans);
1034 BitBlt(hdcMask, 0, 0, bmi->bmiHeader.biWidth, bmi->bmiHeader.biHeight, hdc, 0, 0, SRCCOPY);
1036 /* We no longer need the original bitmap, so we apply the first
1037 transformation with the mask to speed up the rendering */
1038 SetBkColor(hdc, RGB(0,0,0));
1039 SetTextColor(hdc, RGB(255,255,255));
1040 BitBlt(hdc, 0, 0, bmi->bmiHeader.biWidth, bmi->bmiHeader.biHeight,
1041 hdcMask, 0, 0, SRCAND);
1043 SelectObject(hdc, hOldbitmap);
1044 SelectObject(hdcMask, hOldbitmapmask);
1050 This->desc.picType = PICTYPE_BITMAP;
1051 OLEPictureImpl_SetBitmap(This);
1053 HeapFree(GetProcessHeap(),0,bytes);
1056 FIXME("Trying to load GIF, but no support for libgif/libungif compiled in.\n");
1061 case 0xd8ff: { /* JPEG */
1063 struct jpeg_decompress_struct jd;
1064 struct jpeg_error_mgr jerr;
1067 JSAMPROW samprow,oldsamprow;
1068 BITMAPINFOHEADER bmi;
1071 struct jpeg_source_mgr xjsm;
1075 /* This is basically so we can use in-memory data for jpeg decompression.
1076 * We need to have all the functions.
1078 xjsm.next_input_byte = xbuf;
1079 xjsm.bytes_in_buffer = xread;
1080 xjsm.init_source = _jpeg_init_source;
1081 xjsm.fill_input_buffer = _jpeg_fill_input_buffer;
1082 xjsm.skip_input_data = _jpeg_skip_input_data;
1083 xjsm.resync_to_restart = _jpeg_resync_to_restart;
1084 xjsm.term_source = _jpeg_term_source;
1086 jd.err = jpeg_std_error(&jerr);
1087 jpeg_create_decompress(&jd);
1089 ret=jpeg_read_header(&jd,TRUE);
1090 jd.out_color_space = JCS_RGB;
1091 jpeg_start_decompress(&jd);
1092 if (ret != JPEG_HEADER_OK) {
1093 ERR("Jpeg image in stream has bad format, read header returned %d.\n",ret);
1094 HeapFree(GetProcessHeap(),0,xbuf);
1098 bits = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
1099 (jd.output_height+1) * ((jd.output_width*jd.output_components + 3) & ~3) );
1100 samprow=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,jd.output_width*jd.output_components);
1103 oldsamprow = samprow;
1104 while ( jd.output_scanline<jd.output_height ) {
1105 x = jpeg_read_scanlines(&jd,&samprow,1);
1107 FIXME("failed to read current scanline?\n");
1110 /* We have to convert from RGB to BGR, see MSDN/ BITMAPINFOHEADER */
1111 for(i=0;i<jd.output_width;i++,samprow+=jd.output_components) {
1112 *(bits++) = *(samprow+2);
1113 *(bits++) = *(samprow+1);
1114 *(bits++) = *(samprow);
1116 bits = (LPBYTE)(((UINT_PTR)bits + 3) & ~3);
1117 samprow = oldsamprow;
1121 bmi.biSize = sizeof(bmi);
1122 bmi.biWidth = jd.output_width;
1123 bmi.biHeight = -jd.output_height;
1125 bmi.biBitCount = jd.output_components<<3;
1126 bmi.biCompression = BI_RGB;
1127 bmi.biSizeImage = jd.output_height*jd.output_width*jd.output_components;
1128 bmi.biXPelsPerMeter = 0;
1129 bmi.biYPelsPerMeter = 0;
1131 bmi.biClrImportant = 0;
1133 HeapFree(GetProcessHeap(),0,samprow);
1134 jpeg_finish_decompress(&jd);
1135 jpeg_destroy_decompress(&jd);
1137 This->desc.u.bmp.hbitmap=CreateDIBitmap(
1146 This->desc.picType = PICTYPE_BITMAP;
1147 OLEPictureImpl_SetBitmap(This);
1149 HeapFree(GetProcessHeap(),0,bits);
1151 ERR("Trying to load JPEG picture, but JPEG supported not compiled in.\n");
1156 case 0x4d42: { /* Bitmap */
1157 BITMAPFILEHEADER *bfh = (BITMAPFILEHEADER*)xbuf;
1158 BITMAPINFO *bi = (BITMAPINFO*)(bfh+1);
1161 /* Does not matter whether this is a coreheader or not, we only use
1162 * components which are in both
1165 This->desc.u.bmp.hbitmap = CreateDIBitmap(
1169 xbuf+bfh->bfOffBits,
1171 (bi->bmiHeader.biBitCount<=8)?DIB_PAL_COLORS:DIB_RGB_COLORS
1174 This->desc.picType = PICTYPE_BITMAP;
1175 OLEPictureImpl_SetBitmap(This);
1179 case 0x0000: { /* ICON , first word is dwReserved */
1181 CURSORICONFILEDIR *cifd = (CURSORICONFILEDIR*)xbuf;
1185 FIXME("icon.idReserved=%d\n",cifd->idReserved);
1186 FIXME("icon.idType=%d\n",cifd->idType);
1187 FIXME("icon.idCount=%d\n",cifd->idCount);
1189 for (i=0;i<cifd->idCount;i++) {
1190 FIXME("[%d] width %d\n",i,cifd->idEntries[i].bWidth);
1191 FIXME("[%d] height %d\n",i,cifd->idEntries[i].bHeight);
1192 FIXME("[%d] bColorCount %d\n",i,cifd->idEntries[i].bColorCount);
1193 FIXME("[%d] bReserved %d\n",i,cifd->idEntries[i].bReserved);
1194 FIXME("[%d] xHotspot %d\n",i,cifd->idEntries[i].xHotspot);
1195 FIXME("[%d] yHotspot %d\n",i,cifd->idEntries[i].yHotspot);
1196 FIXME("[%d] dwDIBSize %d\n",i,cifd->idEntries[i].dwDIBSize);
1197 FIXME("[%d] dwDIBOffset %d\n",i,cifd->idEntries[i].dwDIBOffset);
1201 /* If we have more than one icon, try to find the best.
1202 * this currently means '32 pixel wide'.
1204 if (cifd->idCount!=1) {
1205 for (i=0;i<cifd->idCount;i++) {
1206 if (cifd->idEntries[i].bWidth == 32)
1209 if (i==cifd->idCount) i=0;
1212 hicon = CreateIconFromResourceEx(
1213 xbuf+cifd->idEntries[i].dwDIBOffset,
1214 cifd->idEntries[i].dwDIBSize,
1217 cifd->idEntries[i].bWidth,
1218 cifd->idEntries[i].bHeight,
1222 FIXME("CreateIcon failed.\n");
1225 This->desc.picType = PICTYPE_ICON;
1226 This->desc.u.icon.hicon = hicon;
1227 This->himetricWidth = cifd->idEntries[i].bWidth;
1228 This->himetricHeight = cifd->idEntries[i].bHeight;
1236 FIXME("Unknown magic %04x, %ld read bytes:\n",magic,xread);
1238 for (i=0;i<xread+8;i++) {
1239 if (i<8) MESSAGE("%02x ",((unsigned char*)&header)[i]);
1240 else MESSAGE("%02x ",xbuf[i-8]);
1241 if (i % 10 == 9) MESSAGE("\n");
1248 /* FIXME: this notify is not really documented */
1250 OLEPicture_SendNotify(This,DISPID_PICT_TYPE);
1254 static HRESULT WINAPI OLEPictureImpl_Save(
1255 IPersistStream* iface,IStream*pStm,BOOL fClearDirty)
1257 ICOM_THIS_From_IPersistStream(IPicture, iface);
1258 FIXME("(%p,%p,%d),stub!\n",This,pStm,fClearDirty);
1262 static HRESULT WINAPI OLEPictureImpl_GetSizeMax(
1263 IPersistStream* iface,ULARGE_INTEGER*pcbSize)
1265 ICOM_THIS_From_IPersistStream(IPicture, iface);
1266 FIXME("(%p,%p),stub!\n",This,pcbSize);
1270 /************************************************************************
1273 /************************************************************************
1274 * OLEPictureImpl_IDispatch_QueryInterface (IUnknown)
1276 * See Windows documentation for more details on IUnknown methods.
1278 static HRESULT WINAPI OLEPictureImpl_IDispatch_QueryInterface(
1283 ICOM_THIS_From_IDispatch(IPicture, iface);
1285 return IPicture_QueryInterface(This, riid, ppvoid);
1288 /************************************************************************
1289 * OLEPictureImpl_IDispatch_AddRef (IUnknown)
1291 * See Windows documentation for more details on IUnknown methods.
1293 static ULONG WINAPI OLEPictureImpl_IDispatch_AddRef(
1296 ICOM_THIS_From_IDispatch(IPicture, iface);
1298 return IPicture_AddRef(This);
1301 /************************************************************************
1302 * OLEPictureImpl_IDispatch_Release (IUnknown)
1304 * See Windows documentation for more details on IUnknown methods.
1306 static ULONG WINAPI OLEPictureImpl_IDispatch_Release(
1309 ICOM_THIS_From_IDispatch(IPicture, iface);
1311 return IPicture_Release(This);
1314 /************************************************************************
1315 * OLEPictureImpl_GetTypeInfoCount (IDispatch)
1317 * See Windows documentation for more details on IDispatch methods.
1319 static HRESULT WINAPI OLEPictureImpl_GetTypeInfoCount(
1321 unsigned int* pctinfo)
1328 /************************************************************************
1329 * OLEPictureImpl_GetTypeInfo (IDispatch)
1331 * See Windows documentation for more details on IDispatch methods.
1333 static HRESULT WINAPI OLEPictureImpl_GetTypeInfo(
1337 ITypeInfo** ppTInfo)
1344 /************************************************************************
1345 * OLEPictureImpl_GetIDsOfNames (IDispatch)
1347 * See Windows documentation for more details on IDispatch methods.
1349 static HRESULT WINAPI OLEPictureImpl_GetIDsOfNames(
1352 LPOLESTR* rgszNames,
1362 /************************************************************************
1363 * OLEPictureImpl_Invoke (IDispatch)
1365 * See Windows documentation for more details on IDispatch methods.
1367 static HRESULT WINAPI OLEPictureImpl_Invoke(
1369 DISPID dispIdMember,
1373 DISPPARAMS* pDispParams,
1374 VARIANT* pVarResult,
1375 EXCEPINFO* pExepInfo,
1378 FIXME("(dispid: %ld):Stub\n",dispIdMember);
1380 VariantInit(pVarResult);
1381 V_VT(pVarResult) = VT_BOOL;
1382 V_UNION(pVarResult,boolVal) = FALSE;
1387 static ICOM_VTABLE(IPicture) OLEPictureImpl_VTable =
1389 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1390 OLEPictureImpl_QueryInterface,
1391 OLEPictureImpl_AddRef,
1392 OLEPictureImpl_Release,
1393 OLEPictureImpl_get_Handle,
1394 OLEPictureImpl_get_hPal,
1395 OLEPictureImpl_get_Type,
1396 OLEPictureImpl_get_Width,
1397 OLEPictureImpl_get_Height,
1398 OLEPictureImpl_Render,
1399 OLEPictureImpl_set_hPal,
1400 OLEPictureImpl_get_CurDC,
1401 OLEPictureImpl_SelectPicture,
1402 OLEPictureImpl_get_KeepOriginalFormat,
1403 OLEPictureImpl_put_KeepOriginalFormat,
1404 OLEPictureImpl_PictureChanged,
1405 OLEPictureImpl_SaveAsFile,
1406 OLEPictureImpl_get_Attributes
1409 static ICOM_VTABLE(IDispatch) OLEPictureImpl_IDispatch_VTable =
1411 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1412 OLEPictureImpl_IDispatch_QueryInterface,
1413 OLEPictureImpl_IDispatch_AddRef,
1414 OLEPictureImpl_IDispatch_Release,
1415 OLEPictureImpl_GetTypeInfoCount,
1416 OLEPictureImpl_GetTypeInfo,
1417 OLEPictureImpl_GetIDsOfNames,
1418 OLEPictureImpl_Invoke
1421 static ICOM_VTABLE(IPersistStream) OLEPictureImpl_IPersistStream_VTable =
1423 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1424 OLEPictureImpl_IPersistStream_QueryInterface,
1425 OLEPictureImpl_IPersistStream_AddRef,
1426 OLEPictureImpl_IPersistStream_Release,
1427 OLEPictureImpl_GetClassID,
1428 OLEPictureImpl_IsDirty,
1429 OLEPictureImpl_Load,
1430 OLEPictureImpl_Save,
1431 OLEPictureImpl_GetSizeMax
1434 static ICOM_VTABLE(IConnectionPointContainer) OLEPictureImpl_IConnectionPointContainer_VTable =
1436 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1437 OLEPictureImpl_IConnectionPointContainer_QueryInterface,
1438 OLEPictureImpl_IConnectionPointContainer_AddRef,
1439 OLEPictureImpl_IConnectionPointContainer_Release,
1440 OLEPictureImpl_EnumConnectionPoints,
1441 OLEPictureImpl_FindConnectionPoint
1444 /***********************************************************************
1445 * OleCreatePictureIndirect (OLEAUT32.419)
1447 HRESULT WINAPI OleCreatePictureIndirect(LPPICTDESC lpPictDesc, REFIID riid,
1448 BOOL fOwn, LPVOID *ppvObj )
1450 OLEPictureImpl* newPict = NULL;
1453 TRACE("(%p,%p,%d,%p)\n", lpPictDesc, riid, fOwn, ppvObj);
1464 * Try to construct a new instance of the class.
1466 newPict = OLEPictureImpl_Construct(lpPictDesc, fOwn);
1468 if (newPict == NULL)
1469 return E_OUTOFMEMORY;
1472 * Make sure it supports the interface required by the caller.
1474 hr = IPicture_QueryInterface((IPicture*)newPict, riid, ppvObj);
1477 * Release the reference obtained in the constructor. If
1478 * the QueryInterface was unsuccessful, it will free the class.
1480 IPicture_Release((IPicture*)newPict);
1486 /***********************************************************************
1487 * OleLoadPicture (OLEAUT32.418)
1489 HRESULT WINAPI OleLoadPicture( LPSTREAM lpstream, LONG lSize, BOOL fRunmode,
1490 REFIID riid, LPVOID *ppvObj )
1496 TRACE("(%p,%ld,%d,%s,%p), partially implemented.\n",
1497 lpstream, lSize, fRunmode, debugstr_guid(riid), ppvObj);
1499 hr = OleCreatePictureIndirect(NULL,riid,!fRunmode,(LPVOID*)&newpic);
1502 hr = IPicture_QueryInterface(newpic,&IID_IPersistStream, (LPVOID*)&ps);
1504 FIXME("Could not get IPersistStream iface from Ole Picture?\n");
1505 IPicture_Release(newpic);
1509 IPersistStream_Load(ps,lpstream);
1510 IPersistStream_Release(ps);
1511 hr = IPicture_QueryInterface(newpic,riid,ppvObj);
1513 FIXME("Failed to get interface %s from IPicture.\n",debugstr_guid(riid));
1514 IPicture_Release(newpic);
1518 /***********************************************************************
1519 * OleLoadPictureEx (OLEAUT32.401)
1521 HRESULT WINAPI OleLoadPictureEx( LPSTREAM lpstream, LONG lSize, BOOL fRunmode,
1522 REFIID riid, DWORD xsiz, DWORD ysiz, DWORD flags, LPVOID *ppvObj )
1528 FIXME("(%p,%ld,%d,%s,x=%ld,y=%ld,f=%lx,%p), partially implemented.\n",
1529 lpstream, lSize, fRunmode, debugstr_guid(riid), xsiz, ysiz, flags, ppvObj);
1531 hr = OleCreatePictureIndirect(NULL,riid,!fRunmode,(LPVOID*)&newpic);
1534 hr = IPicture_QueryInterface(newpic,&IID_IPersistStream, (LPVOID*)&ps);
1536 FIXME("Could not get IPersistStream iface from Ole Picture?\n");
1537 IPicture_Release(newpic);
1541 IPersistStream_Load(ps,lpstream);
1542 IPersistStream_Release(ps);
1543 hr = IPicture_QueryInterface(newpic,riid,ppvObj);
1545 FIXME("Failed to get interface %s from IPicture.\n",debugstr_guid(riid));
1546 IPicture_Release(newpic);
1550 /*******************************************************************************
1551 * StdPic ClassFactory
1555 /* IUnknown fields */
1556 ICOM_VFIELD(IClassFactory);
1558 } IClassFactoryImpl;
1560 static HRESULT WINAPI
1561 SPCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
1562 ICOM_THIS(IClassFactoryImpl,iface);
1564 FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
1565 return E_NOINTERFACE;
1569 SPCF_AddRef(LPCLASSFACTORY iface) {
1570 ICOM_THIS(IClassFactoryImpl,iface);
1571 return ++(This->ref);
1574 static ULONG WINAPI SPCF_Release(LPCLASSFACTORY iface) {
1575 ICOM_THIS(IClassFactoryImpl,iface);
1576 /* static class, won't be freed */
1577 return --(This->ref);
1580 static HRESULT WINAPI SPCF_CreateInstance(
1581 LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
1585 FIXME("(%p,%p,%s,%p), creating stdpic with PICTYPE_NONE.\n",iface,pOuter,debugstr_guid(riid),ppobj);
1586 pd.cbSizeofstruct = sizeof(pd);
1587 pd.picType = PICTYPE_NONE;
1588 return OleCreatePictureIndirect(&pd,riid,TRUE,ppobj);
1592 static HRESULT WINAPI SPCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
1593 ICOM_THIS(IClassFactoryImpl,iface);
1594 FIXME("(%p)->(%d),stub!\n",This,dolock);
1598 static ICOM_VTABLE(IClassFactory) SPCF_Vtbl = {
1599 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1600 SPCF_QueryInterface,
1603 SPCF_CreateInstance,
1606 static IClassFactoryImpl STDPIC_CF = {&SPCF_Vtbl, 1 };
1608 void _get_STDPIC_CF(LPVOID *ppv) { *ppv = (LPVOID)&STDPIC_CF; }