| 1 | /* $Id: olepicture.c,v 1.5 2001-09-05 13:19:01 bird Exp $ */
|
|---|
| 2 | /*
|
|---|
| 3 | * OLE Picture object
|
|---|
| 4 | *
|
|---|
| 5 | * Implementation of OLE IPicture and related interfaces
|
|---|
| 6 | *
|
|---|
| 7 | * Copyright 2000 Huw D M Davies for CodeWeavers.
|
|---|
| 8 | * Copyright 2001 Marcus Meissner
|
|---|
| 9 | *
|
|---|
| 10 | *
|
|---|
| 11 | * BUGS
|
|---|
| 12 | *
|
|---|
| 13 | * Support PICTYPE_BITMAP and PICTYPE_ICON, altough only bitmaps very well..
|
|---|
| 14 | * Lots of methods are just stubs.
|
|---|
| 15 | *
|
|---|
| 16 | *
|
|---|
| 17 | * NOTES (or things that msdn doesn't tell you)
|
|---|
| 18 | *
|
|---|
| 19 | * The width and height properties are returned in HIMETRIC units (0.01mm)
|
|---|
| 20 | * IPicture::Render also uses these to select a region of the src picture.
|
|---|
| 21 | * A bitmap's size is converted into these units by using the screen resolution
|
|---|
| 22 | * thus an 8x8 bitmap on a 96dpi screen has a size of 212x212 (8/96 * 2540).
|
|---|
| 23 | *
|
|---|
| 24 | */
|
|---|
| 25 | #ifdef __WIN32OS2__
|
|---|
| 26 | #define HAVE_FLOAT_H
|
|---|
| 27 | #define WINE_LARGE_INTEGER
|
|---|
| 28 | #include "oleaut32.h"
|
|---|
| 29 | #endif
|
|---|
| 30 |
|
|---|
| 31 | #include "config.h"
|
|---|
| 32 |
|
|---|
| 33 | #include <unistd.h>
|
|---|
| 34 | #include <stdio.h>
|
|---|
| 35 | #include <string.h>
|
|---|
| 36 | #include "winerror.h"
|
|---|
| 37 | #include "winbase.h"
|
|---|
| 38 | #include "wingdi.h"
|
|---|
| 39 | #include "winuser.h"
|
|---|
| 40 | #include "ole2.h"
|
|---|
| 41 | #include "olectl.h"
|
|---|
| 42 | #include "oleauto.h"
|
|---|
| 43 | #include "wine/obj_picture.h"
|
|---|
| 44 | #include "wine/obj_connection.h"
|
|---|
| 45 | #include "connpt.h"
|
|---|
| 46 | #include "debugtools.h"
|
|---|
| 47 |
|
|---|
| 48 | #include "wine/wingdi16.h"
|
|---|
| 49 | #include "cursoricon.h"
|
|---|
| 50 |
|
|---|
| 51 | #ifdef HAVE_LIBJPEG
|
|---|
| 52 | /* This is a hack, so jpeglib.h does not redefine INT32 and the like*/
|
|---|
| 53 | #define XMD_H
|
|---|
| 54 | #ifdef HAVE_JPEGLIB_H
|
|---|
| 55 | # include <jpeglib.h>
|
|---|
| 56 | #endif
|
|---|
| 57 | #endif
|
|---|
| 58 |
|
|---|
| 59 | #ifdef __WIN32OS2__
|
|---|
| 60 | #undef FIXME
|
|---|
| 61 | #undef TRACE
|
|---|
| 62 | #ifdef DEBUG
|
|---|
| 63 | #define TRACE WriteLog("%s", __FUNCTION__); WriteLog
|
|---|
| 64 | #define FIXME WriteLog("FIXME %s", __FUNCTION__); WriteLog
|
|---|
| 65 | #else
|
|---|
| 66 | #define TRACE 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)
|
|---|
| 67 | #define FIXME 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)
|
|---|
| 68 | #endif
|
|---|
| 69 | #endif
|
|---|
| 70 |
|
|---|
| 71 | DEFAULT_DEBUG_CHANNEL(ole);
|
|---|
| 72 |
|
|---|
| 73 | /*************************************************************************
|
|---|
| 74 | * Declaration of implementation class
|
|---|
| 75 | */
|
|---|
| 76 |
|
|---|
| 77 | typedef struct OLEPictureImpl {
|
|---|
| 78 |
|
|---|
| 79 | /*
|
|---|
| 80 | * IPicture handles IUnknown
|
|---|
| 81 | */
|
|---|
| 82 |
|
|---|
| 83 | ICOM_VTABLE(IPicture) *lpvtbl1;
|
|---|
| 84 | ICOM_VTABLE(IDispatch) *lpvtbl2;
|
|---|
| 85 | ICOM_VTABLE(IPersistStream) *lpvtbl3;
|
|---|
| 86 | ICOM_VTABLE(IConnectionPointContainer) *lpvtbl4;
|
|---|
| 87 |
|
|---|
| 88 | /* Object referenece count */
|
|---|
| 89 | DWORD ref;
|
|---|
| 90 |
|
|---|
| 91 | /* We own the object and must destroy it ourselves */
|
|---|
| 92 | BOOL fOwn;
|
|---|
| 93 |
|
|---|
| 94 | /* Picture description */
|
|---|
| 95 | PICTDESC desc;
|
|---|
| 96 |
|
|---|
| 97 | /* These are the pixel size of a bitmap */
|
|---|
| 98 | DWORD origWidth;
|
|---|
| 99 | DWORD origHeight;
|
|---|
| 100 |
|
|---|
| 101 | /* And these are the size of the picture converted into HIMETRIC units */
|
|---|
| 102 | OLE_XSIZE_HIMETRIC himetricWidth;
|
|---|
| 103 | OLE_YSIZE_HIMETRIC himetricHeight;
|
|---|
| 104 |
|
|---|
| 105 | IConnectionPoint *pCP;
|
|---|
| 106 |
|
|---|
| 107 | BOOL keepOrigFormat;
|
|---|
| 108 | HDC hDCCur;
|
|---|
| 109 | } OLEPictureImpl;
|
|---|
| 110 |
|
|---|
| 111 | /*
|
|---|
| 112 | * Macros to retrieve pointer to IUnknown (IPicture) from the other VTables.
|
|---|
| 113 | */
|
|---|
| 114 | #define ICOM_THIS_From_IDispatch(impl, name) \
|
|---|
| 115 | impl *This = (impl*)(((char*)name)-sizeof(void*));
|
|---|
| 116 | #define ICOM_THIS_From_IPersistStream(impl, name) \
|
|---|
| 117 | impl *This = (impl*)(((char*)name)-2*sizeof(void*));
|
|---|
| 118 | #define ICOM_THIS_From_IConnectionPointContainer(impl, name) \
|
|---|
| 119 | impl *This = (impl*)(((char*)name)-3*sizeof(void*));
|
|---|
| 120 |
|
|---|
| 121 | /*
|
|---|
| 122 | * Predeclare VTables. They get initialized at the end.
|
|---|
| 123 | */
|
|---|
| 124 | static ICOM_VTABLE(IPicture) OLEPictureImpl_VTable;
|
|---|
| 125 | static ICOM_VTABLE(IDispatch) OLEPictureImpl_IDispatch_VTable;
|
|---|
| 126 | static ICOM_VTABLE(IPersistStream) OLEPictureImpl_IPersistStream_VTable;
|
|---|
| 127 | static ICOM_VTABLE(IConnectionPointContainer) OLEPictureImpl_IConnectionPointContainer_VTable;
|
|---|
| 128 |
|
|---|
| 129 | /***********************************************************************
|
|---|
| 130 | * Implementation of the OLEPictureImpl class.
|
|---|
| 131 | */
|
|---|
| 132 |
|
|---|
| 133 | static void OLEPictureImpl_SetBitmap(OLEPictureImpl*This) {
|
|---|
| 134 | BITMAP bm;
|
|---|
| 135 | HDC hdcRef;
|
|---|
| 136 |
|
|---|
| 137 | TRACE("bitmap handle %08x\n", This->desc.u.bmp.hbitmap);
|
|---|
| 138 | if(GetObjectA(This->desc.u.bmp.hbitmap, sizeof(bm), &bm) != sizeof(bm)) {
|
|---|
| 139 | ERR("GetObject fails\n");
|
|---|
| 140 | return;
|
|---|
| 141 | }
|
|---|
| 142 | This->origWidth = bm.bmWidth;
|
|---|
| 143 | This->origHeight = bm.bmHeight;
|
|---|
| 144 | /* The width and height are stored in HIMETRIC units (0.01 mm),
|
|---|
| 145 | so we take our pixel width divide by pixels per inch and
|
|---|
| 146 | multiply by 25.4 * 100 */
|
|---|
| 147 | /* Should we use GetBitmapDimension if available? */
|
|---|
| 148 | hdcRef = CreateCompatibleDC(0);
|
|---|
| 149 | This->himetricWidth =(bm.bmWidth *2540)/GetDeviceCaps(hdcRef, LOGPIXELSX);
|
|---|
| 150 | This->himetricHeight=(bm.bmHeight*2540)/GetDeviceCaps(hdcRef, LOGPIXELSY);
|
|---|
| 151 | DeleteDC(hdcRef);
|
|---|
| 152 | }
|
|---|
| 153 |
|
|---|
| 154 | /************************************************************************
|
|---|
| 155 | * OLEPictureImpl_Construct
|
|---|
| 156 | *
|
|---|
| 157 | * This method will construct a new instance of the OLEPictureImpl
|
|---|
| 158 | * class.
|
|---|
| 159 | *
|
|---|
| 160 | * The caller of this method must release the object when it's
|
|---|
| 161 | * done with it.
|
|---|
| 162 | */
|
|---|
| 163 | static OLEPictureImpl* OLEPictureImpl_Construct(LPPICTDESC pictDesc, BOOL fOwn)
|
|---|
| 164 | {
|
|---|
| 165 | OLEPictureImpl* newObject = 0;
|
|---|
| 166 |
|
|---|
| 167 | if (pictDesc)
|
|---|
| 168 | TRACE("(%p) type = %d\n", pictDesc, pictDesc->picType);
|
|---|
| 169 |
|
|---|
| 170 | /*
|
|---|
| 171 | * Allocate space for the object.
|
|---|
| 172 | */
|
|---|
| 173 | newObject = HeapAlloc(GetProcessHeap(), 0, sizeof(OLEPictureImpl));
|
|---|
| 174 |
|
|---|
| 175 | if (newObject==0)
|
|---|
| 176 | return newObject;
|
|---|
| 177 |
|
|---|
| 178 | /*
|
|---|
| 179 | * Initialize the virtual function table.
|
|---|
| 180 | */
|
|---|
| 181 | newObject->lpvtbl1 = &OLEPictureImpl_VTable;
|
|---|
| 182 | newObject->lpvtbl2 = &OLEPictureImpl_IDispatch_VTable;
|
|---|
| 183 | newObject->lpvtbl3 = &OLEPictureImpl_IPersistStream_VTable;
|
|---|
| 184 | newObject->lpvtbl4 = &OLEPictureImpl_IConnectionPointContainer_VTable;
|
|---|
| 185 |
|
|---|
| 186 | CreateConnectionPoint((IUnknown*)newObject,&IID_IPropertyNotifySink,&newObject->pCP);
|
|---|
| 187 |
|
|---|
| 188 | /*
|
|---|
| 189 | * Start with one reference count. The caller of this function
|
|---|
| 190 | * must release the interface pointer when it is done.
|
|---|
| 191 | */
|
|---|
| 192 | newObject->ref = 1;
|
|---|
| 193 | newObject->hDCCur = 0;
|
|---|
| 194 |
|
|---|
| 195 | newObject->fOwn = fOwn;
|
|---|
| 196 |
|
|---|
| 197 | /* dunno about original value */
|
|---|
| 198 | newObject->keepOrigFormat = TRUE;
|
|---|
| 199 |
|
|---|
| 200 | if (pictDesc) {
|
|---|
| 201 | if(pictDesc->cbSizeofstruct != sizeof(PICTDESC)) {
|
|---|
| 202 | FIXME("struct size = %d\n", pictDesc->cbSizeofstruct);
|
|---|
| 203 | }
|
|---|
| 204 | memcpy(&newObject->desc, pictDesc, sizeof(PICTDESC));
|
|---|
| 205 |
|
|---|
| 206 |
|
|---|
| 207 | switch(pictDesc->picType) {
|
|---|
| 208 | case PICTYPE_BITMAP:
|
|---|
| 209 | OLEPictureImpl_SetBitmap(newObject);
|
|---|
| 210 | break;
|
|---|
| 211 |
|
|---|
| 212 | case PICTYPE_METAFILE:
|
|---|
| 213 | TRACE("metafile handle %08x\n", pictDesc->u.wmf.hmeta);
|
|---|
| 214 | newObject->himetricWidth = pictDesc->u.wmf.xExt;
|
|---|
| 215 | newObject->himetricHeight = pictDesc->u.wmf.yExt;
|
|---|
| 216 | break;
|
|---|
| 217 |
|
|---|
| 218 | case PICTYPE_ICON:
|
|---|
| 219 | case PICTYPE_ENHMETAFILE:
|
|---|
| 220 | default:
|
|---|
| 221 | FIXME("Unsupported type %d\n", pictDesc->picType);
|
|---|
| 222 | newObject->himetricWidth = newObject->himetricHeight = 0;
|
|---|
| 223 | break;
|
|---|
| 224 | }
|
|---|
| 225 | } else {
|
|---|
| 226 | newObject->desc.picType = PICTYPE_UNINITIALIZED;
|
|---|
| 227 | }
|
|---|
| 228 |
|
|---|
| 229 | TRACE("returning %p\n", newObject);
|
|---|
| 230 | return newObject;
|
|---|
| 231 | }
|
|---|
| 232 |
|
|---|
| 233 | /************************************************************************
|
|---|
| 234 | * OLEPictureImpl_Destroy
|
|---|
| 235 | *
|
|---|
| 236 | * This method is called by the Release method when the reference
|
|---|
| 237 | * count goes down to 0. It will free all resources used by
|
|---|
| 238 | * this object. */
|
|---|
| 239 | static void OLEPictureImpl_Destroy(OLEPictureImpl* Obj)
|
|---|
| 240 | {
|
|---|
| 241 | TRACE("(%p)\n", Obj);
|
|---|
| 242 |
|
|---|
| 243 | if(Obj->fOwn) { /* We need to destroy the picture */
|
|---|
| 244 | switch(Obj->desc.picType) {
|
|---|
| 245 | case PICTYPE_BITMAP:
|
|---|
| 246 | DeleteObject(Obj->desc.u.bmp.hbitmap);
|
|---|
| 247 | break;
|
|---|
| 248 | case PICTYPE_METAFILE:
|
|---|
| 249 | DeleteMetaFile(Obj->desc.u.wmf.hmeta);
|
|---|
| 250 | break;
|
|---|
| 251 | case PICTYPE_ICON:
|
|---|
| 252 | DestroyIcon(Obj->desc.u.icon.hicon);
|
|---|
| 253 | break;
|
|---|
| 254 | case PICTYPE_ENHMETAFILE:
|
|---|
| 255 | DeleteEnhMetaFile(Obj->desc.u.emf.hemf);
|
|---|
| 256 | break;
|
|---|
| 257 | default:
|
|---|
| 258 | FIXME("Unsupported type %d - unable to delete\n", Obj->desc.picType);
|
|---|
| 259 | break;
|
|---|
| 260 | }
|
|---|
| 261 | }
|
|---|
| 262 | HeapFree(GetProcessHeap(), 0, Obj);
|
|---|
| 263 | }
|
|---|
| 264 |
|
|---|
| 265 | static ULONG WINAPI OLEPictureImpl_AddRef(IPicture* iface);
|
|---|
| 266 |
|
|---|
| 267 | /************************************************************************
|
|---|
| 268 | * OLEPictureImpl_QueryInterface (IUnknown)
|
|---|
| 269 | *
|
|---|
| 270 | * See Windows documentation for more details on IUnknown methods.
|
|---|
| 271 | */
|
|---|
| 272 | static HRESULT WINAPI OLEPictureImpl_QueryInterface(
|
|---|
| 273 | IPicture* iface,
|
|---|
| 274 | REFIID riid,
|
|---|
| 275 | void** ppvObject)
|
|---|
| 276 | {
|
|---|
| 277 | ICOM_THIS(OLEPictureImpl, iface);
|
|---|
| 278 | TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObject);
|
|---|
| 279 |
|
|---|
| 280 | /*
|
|---|
| 281 | * Perform a sanity check on the parameters.
|
|---|
| 282 | */
|
|---|
| 283 | if ( (This==0) || (ppvObject==0) )
|
|---|
| 284 | return E_INVALIDARG;
|
|---|
| 285 |
|
|---|
| 286 | /*
|
|---|
| 287 | * Initialize the return parameter.
|
|---|
| 288 | */
|
|---|
| 289 | *ppvObject = 0;
|
|---|
| 290 |
|
|---|
| 291 | /*
|
|---|
| 292 | * Compare the riid with the interface IDs implemented by this object.
|
|---|
| 293 | */
|
|---|
| 294 | if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0)
|
|---|
| 295 | {
|
|---|
| 296 | *ppvObject = (IPicture*)This;
|
|---|
| 297 | }
|
|---|
| 298 | else if (memcmp(&IID_IPicture, riid, sizeof(IID_IPicture)) == 0)
|
|---|
| 299 | {
|
|---|
| 300 | *ppvObject = (IPicture*)This;
|
|---|
| 301 | }
|
|---|
| 302 | else if (memcmp(&IID_IDispatch, riid, sizeof(IID_IDispatch)) == 0)
|
|---|
| 303 | {
|
|---|
| 304 | *ppvObject = (IDispatch*)&(This->lpvtbl2);
|
|---|
| 305 | }
|
|---|
| 306 | else if (memcmp(&IID_IPictureDisp, riid, sizeof(IID_IPictureDisp)) == 0)
|
|---|
| 307 | {
|
|---|
| 308 | *ppvObject = (IDispatch*)&(This->lpvtbl2);
|
|---|
| 309 | }
|
|---|
| 310 | else if (memcmp(&IID_IPersistStream, riid, sizeof(IID_IPersistStream)) == 0)
|
|---|
| 311 | {
|
|---|
| 312 | *ppvObject = (IPersistStream*)&(This->lpvtbl3);
|
|---|
| 313 | }
|
|---|
| 314 | else if (memcmp(&IID_IConnectionPointContainer, riid, sizeof(IID_IConnectionPointContainer)) == 0)
|
|---|
| 315 | {
|
|---|
| 316 | *ppvObject = (IConnectionPointContainer*)&(This->lpvtbl4);
|
|---|
| 317 | }
|
|---|
| 318 | /*
|
|---|
| 319 | * Check that we obtained an interface.
|
|---|
| 320 | */
|
|---|
| 321 | if ((*ppvObject)==0)
|
|---|
| 322 | {
|
|---|
| 323 | FIXME("() : asking for un supported interface %s\n",debugstr_guid(riid));
|
|---|
| 324 | return E_NOINTERFACE;
|
|---|
| 325 | }
|
|---|
| 326 |
|
|---|
| 327 | /*
|
|---|
| 328 | * Query Interface always increases the reference count by one when it is
|
|---|
| 329 | * successful
|
|---|
| 330 | */
|
|---|
| 331 | OLEPictureImpl_AddRef((IPicture*)This);
|
|---|
| 332 |
|
|---|
| 333 | return S_OK;;
|
|---|
| 334 | }
|
|---|
| 335 | /***********************************************************************
|
|---|
| 336 | * OLEPicture_SendNotify (internal)
|
|---|
| 337 | *
|
|---|
| 338 | * Sends notification messages of changed properties to any interested
|
|---|
| 339 | * connections.
|
|---|
| 340 | */
|
|---|
| 341 | static void OLEPicture_SendNotify(OLEPictureImpl* this, DISPID dispID)
|
|---|
| 342 | {
|
|---|
| 343 | IEnumConnections *pEnum;
|
|---|
| 344 | CONNECTDATA CD;
|
|---|
| 345 |
|
|---|
| 346 | if (IConnectionPoint_EnumConnections(this->pCP, &pEnum))
|
|---|
| 347 | return;
|
|---|
| 348 | while(IEnumConnections_Next(pEnum, 1, &CD, NULL) == S_OK) {
|
|---|
| 349 | IPropertyNotifySink *sink;
|
|---|
| 350 |
|
|---|
| 351 | IUnknown_QueryInterface(CD.pUnk, &IID_IPropertyNotifySink, (LPVOID)&sink);
|
|---|
| 352 | IPropertyNotifySink_OnChanged(sink, dispID);
|
|---|
| 353 | IPropertyNotifySink_Release(sink);
|
|---|
| 354 | IUnknown_Release(CD.pUnk);
|
|---|
| 355 | }
|
|---|
| 356 | IEnumConnections_Release(pEnum);
|
|---|
| 357 | return;
|
|---|
| 358 | }
|
|---|
| 359 |
|
|---|
| 360 | /************************************************************************
|
|---|
| 361 | * OLEPictureImpl_AddRef (IUnknown)
|
|---|
| 362 | *
|
|---|
| 363 | * See Windows documentation for more details on IUnknown methods.
|
|---|
| 364 | */
|
|---|
| 365 | static ULONG WINAPI OLEPictureImpl_AddRef(
|
|---|
| 366 | IPicture* iface)
|
|---|
| 367 | {
|
|---|
| 368 | ICOM_THIS(OLEPictureImpl, iface);
|
|---|
| 369 | TRACE("(%p)->(ref=%ld)\n", This, This->ref);
|
|---|
| 370 | This->ref++;
|
|---|
| 371 |
|
|---|
| 372 | return This->ref;
|
|---|
| 373 | }
|
|---|
| 374 |
|
|---|
| 375 | /************************************************************************
|
|---|
| 376 | * OLEPictureImpl_Release (IUnknown)
|
|---|
| 377 | *
|
|---|
| 378 | * See Windows documentation for more details on IUnknown methods.
|
|---|
| 379 | */
|
|---|
| 380 | static ULONG WINAPI OLEPictureImpl_Release(
|
|---|
| 381 | IPicture* iface)
|
|---|
| 382 | {
|
|---|
| 383 | ICOM_THIS(OLEPictureImpl, iface);
|
|---|
| 384 | TRACE("(%p)->(ref=%ld)\n", This, This->ref);
|
|---|
| 385 |
|
|---|
| 386 | /*
|
|---|
| 387 | * Decrease the reference count on this object.
|
|---|
| 388 | */
|
|---|
| 389 | This->ref--;
|
|---|
| 390 |
|
|---|
| 391 | /*
|
|---|
| 392 | * If the reference count goes down to 0, perform suicide.
|
|---|
| 393 | */
|
|---|
| 394 | if (This->ref==0)
|
|---|
| 395 | {
|
|---|
| 396 | OLEPictureImpl_Destroy(This);
|
|---|
| 397 |
|
|---|
| 398 | return 0;
|
|---|
| 399 | }
|
|---|
| 400 |
|
|---|
| 401 | return This->ref;
|
|---|
| 402 | }
|
|---|
| 403 |
|
|---|
| 404 |
|
|---|
| 405 | /************************************************************************
|
|---|
| 406 | * OLEPictureImpl_get_Handle
|
|---|
| 407 | */
|
|---|
| 408 | static HRESULT WINAPI OLEPictureImpl_get_Handle(IPicture *iface,
|
|---|
| 409 | OLE_HANDLE *phandle)
|
|---|
| 410 | {
|
|---|
| 411 | ICOM_THIS(OLEPictureImpl, iface);
|
|---|
| 412 | TRACE("(%p)->(%p)\n", This, phandle);
|
|---|
| 413 | switch(This->desc.picType) {
|
|---|
| 414 | case PICTYPE_BITMAP:
|
|---|
| 415 | *phandle = This->desc.u.bmp.hbitmap;
|
|---|
| 416 | break;
|
|---|
| 417 | case PICTYPE_METAFILE:
|
|---|
| 418 | *phandle = This->desc.u.wmf.hmeta;
|
|---|
| 419 | break;
|
|---|
| 420 | case PICTYPE_ICON:
|
|---|
| 421 | *phandle = This->desc.u.icon.hicon;
|
|---|
| 422 | break;
|
|---|
| 423 | case PICTYPE_ENHMETAFILE:
|
|---|
| 424 | *phandle = This->desc.u.emf.hemf;
|
|---|
| 425 | break;
|
|---|
| 426 | default:
|
|---|
| 427 | FIXME("Unimplemented type %d\n", This->desc.picType);
|
|---|
| 428 | return E_NOTIMPL;
|
|---|
| 429 | }
|
|---|
| 430 | TRACE("returning handle %08x\n", *phandle);
|
|---|
| 431 | return S_OK;
|
|---|
| 432 | }
|
|---|
| 433 |
|
|---|
| 434 | /************************************************************************
|
|---|
| 435 | * OLEPictureImpl_get_hPal
|
|---|
| 436 | */
|
|---|
| 437 | static HRESULT WINAPI OLEPictureImpl_get_hPal(IPicture *iface,
|
|---|
| 438 | OLE_HANDLE *phandle)
|
|---|
| 439 | {
|
|---|
| 440 | ICOM_THIS(OLEPictureImpl, iface);
|
|---|
| 441 | FIXME("(%p)->(%p): stub\n", This, phandle);
|
|---|
| 442 | return E_NOTIMPL;
|
|---|
| 443 | }
|
|---|
| 444 |
|
|---|
| 445 | /************************************************************************
|
|---|
| 446 | * OLEPictureImpl_get_Type
|
|---|
| 447 | */
|
|---|
| 448 | static HRESULT WINAPI OLEPictureImpl_get_Type(IPicture *iface,
|
|---|
| 449 | short *ptype)
|
|---|
| 450 | {
|
|---|
| 451 | ICOM_THIS(OLEPictureImpl, iface);
|
|---|
| 452 | TRACE("(%p)->(%p): type is %d\n", This, ptype, This->desc.picType);
|
|---|
| 453 | *ptype = This->desc.picType;
|
|---|
| 454 | return S_OK;
|
|---|
| 455 | }
|
|---|
| 456 |
|
|---|
| 457 | /************************************************************************
|
|---|
| 458 | * OLEPictureImpl_get_Width
|
|---|
| 459 | */
|
|---|
| 460 | static HRESULT WINAPI OLEPictureImpl_get_Width(IPicture *iface,
|
|---|
| 461 | OLE_XSIZE_HIMETRIC *pwidth)
|
|---|
| 462 | {
|
|---|
| 463 | ICOM_THIS(OLEPictureImpl, iface);
|
|---|
| 464 | TRACE("(%p)->(%p): width is %ld\n", This, pwidth, This->himetricWidth);
|
|---|
| 465 | *pwidth = This->himetricWidth;
|
|---|
| 466 | return S_OK;
|
|---|
| 467 | }
|
|---|
| 468 |
|
|---|
| 469 | /************************************************************************
|
|---|
| 470 | * OLEPictureImpl_get_Height
|
|---|
| 471 | */
|
|---|
| 472 | static HRESULT WINAPI OLEPictureImpl_get_Height(IPicture *iface,
|
|---|
| 473 | OLE_YSIZE_HIMETRIC *pheight)
|
|---|
| 474 | {
|
|---|
| 475 | ICOM_THIS(OLEPictureImpl, iface);
|
|---|
| 476 | TRACE("(%p)->(%p): height is %ld\n", This, pheight, This->himetricHeight);
|
|---|
| 477 | *pheight = This->himetricHeight;
|
|---|
| 478 | return S_OK;
|
|---|
| 479 | }
|
|---|
| 480 |
|
|---|
| 481 | /************************************************************************
|
|---|
| 482 | * OLEPictureImpl_Render
|
|---|
| 483 | */
|
|---|
| 484 | static HRESULT WINAPI OLEPictureImpl_Render(IPicture *iface, HDC hdc,
|
|---|
| 485 | long x, long y, long cx, long cy,
|
|---|
| 486 | OLE_XPOS_HIMETRIC xSrc,
|
|---|
| 487 | OLE_YPOS_HIMETRIC ySrc,
|
|---|
| 488 | OLE_XSIZE_HIMETRIC cxSrc,
|
|---|
| 489 | OLE_YSIZE_HIMETRIC cySrc,
|
|---|
| 490 | LPCRECT prcWBounds)
|
|---|
| 491 | {
|
|---|
| 492 | ICOM_THIS(OLEPictureImpl, iface);
|
|---|
| 493 | TRACE("(%p)->(%08x, (%ld,%ld), (%ld,%ld) <- (%ld,%ld), (%ld,%ld), %p)\n",
|
|---|
| 494 | This, hdc, x, y, cx, cy, xSrc, ySrc, cxSrc, cySrc, prcWBounds);
|
|---|
| 495 | if(prcWBounds)
|
|---|
| 496 | TRACE("prcWBounds (%d,%d) - (%d,%d)\n", prcWBounds->left, prcWBounds->top,
|
|---|
| 497 | prcWBounds->right, prcWBounds->bottom);
|
|---|
| 498 |
|
|---|
| 499 | /*
|
|---|
| 500 | * While the documentation suggests this to be here (or after rendering?)
|
|---|
| 501 | * it does cause an endless recursion in my sample app. -MM 20010804
|
|---|
| 502 | OLEPicture_SendNotify(This,DISPID_PICT_RENDER);
|
|---|
| 503 | */
|
|---|
| 504 |
|
|---|
| 505 | switch(This->desc.picType) {
|
|---|
| 506 | case PICTYPE_BITMAP:
|
|---|
| 507 | {
|
|---|
| 508 | HBITMAP hbmpOld;
|
|---|
| 509 | HDC hdcBmp;
|
|---|
| 510 |
|
|---|
| 511 | /* Set a mapping mode that maps bitmap pixels into HIMETRIC units.
|
|---|
| 512 | NB y-axis gets flipped */
|
|---|
| 513 |
|
|---|
| 514 | hdcBmp = CreateCompatibleDC(0);
|
|---|
| 515 | SetMapMode(hdcBmp, MM_ANISOTROPIC);
|
|---|
| 516 | SetWindowOrgEx(hdcBmp, 0, 0, NULL);
|
|---|
| 517 | SetWindowExtEx(hdcBmp, This->himetricWidth, This->himetricHeight, NULL);
|
|---|
| 518 | SetViewportOrgEx(hdcBmp, 0, This->origHeight, NULL);
|
|---|
| 519 | SetViewportExtEx(hdcBmp, This->origWidth, -This->origHeight, NULL);
|
|---|
| 520 |
|
|---|
| 521 | hbmpOld = SelectObject(hdcBmp, This->desc.u.bmp.hbitmap);
|
|---|
| 522 |
|
|---|
| 523 | StretchBlt(hdc, x, y, cx, cy, hdcBmp, xSrc, ySrc, cxSrc, cySrc, SRCCOPY);
|
|---|
| 524 |
|
|---|
| 525 | SelectObject(hdcBmp, hbmpOld);
|
|---|
| 526 | DeleteDC(hdcBmp);
|
|---|
| 527 | }
|
|---|
| 528 | break;
|
|---|
| 529 | case PICTYPE_ICON:
|
|---|
| 530 | FIXME("Not quite correct implementation of rendering icons...\n");
|
|---|
| 531 | DrawIcon(hdc,x,y,This->desc.u.icon.hicon);
|
|---|
| 532 | break;
|
|---|
| 533 |
|
|---|
| 534 | case PICTYPE_METAFILE:
|
|---|
| 535 | case PICTYPE_ENHMETAFILE:
|
|---|
| 536 | default:
|
|---|
| 537 | FIXME("type %d not implemented\n", This->desc.picType);
|
|---|
| 538 | return E_NOTIMPL;
|
|---|
| 539 | }
|
|---|
| 540 | return S_OK;
|
|---|
| 541 | }
|
|---|
| 542 |
|
|---|
| 543 | /************************************************************************
|
|---|
| 544 | * OLEPictureImpl_set_hPal
|
|---|
| 545 | */
|
|---|
| 546 | static HRESULT WINAPI OLEPictureImpl_set_hPal(IPicture *iface,
|
|---|
| 547 | OLE_HANDLE hpal)
|
|---|
| 548 | {
|
|---|
| 549 | ICOM_THIS(OLEPictureImpl, iface);
|
|---|
| 550 | FIXME("(%p)->(%08x): stub\n", This, hpal);
|
|---|
| 551 | OLEPicture_SendNotify(This,DISPID_PICT_HPAL);
|
|---|
| 552 | return E_NOTIMPL;
|
|---|
| 553 | }
|
|---|
| 554 |
|
|---|
| 555 | /************************************************************************
|
|---|
| 556 | * OLEPictureImpl_get_CurDC
|
|---|
| 557 | */
|
|---|
| 558 | static HRESULT WINAPI OLEPictureImpl_get_CurDC(IPicture *iface,
|
|---|
| 559 | HDC *phdc)
|
|---|
| 560 | {
|
|---|
| 561 | ICOM_THIS(OLEPictureImpl, iface);
|
|---|
| 562 | TRACE("(%p), returning %x\n", This, This->hDCCur);
|
|---|
| 563 | if (phdc) *phdc = This->hDCCur;
|
|---|
| 564 | return S_OK;
|
|---|
| 565 | }
|
|---|
| 566 |
|
|---|
| 567 | /************************************************************************
|
|---|
| 568 | * OLEPictureImpl_SelectPicture
|
|---|
| 569 | */
|
|---|
| 570 | static HRESULT WINAPI OLEPictureImpl_SelectPicture(IPicture *iface,
|
|---|
| 571 | HDC hdcIn,
|
|---|
| 572 | HDC *phdcOut,
|
|---|
| 573 | OLE_HANDLE *phbmpOut)
|
|---|
| 574 | {
|
|---|
| 575 | ICOM_THIS(OLEPictureImpl, iface);
|
|---|
| 576 | TRACE("(%p)->(%08x, %p, %p)\n", This, hdcIn, phdcOut, phbmpOut);
|
|---|
| 577 | if (This->desc.picType == PICTYPE_BITMAP) {
|
|---|
| 578 | SelectObject(hdcIn,This->desc.u.bmp.hbitmap);
|
|---|
| 579 |
|
|---|
| 580 | if (phdcOut)
|
|---|
| 581 | *phdcOut = This->hDCCur;
|
|---|
| 582 | This->hDCCur = hdcIn;
|
|---|
| 583 | if (phbmpOut)
|
|---|
| 584 | *phbmpOut = This->desc.u.bmp.hbitmap;
|
|---|
| 585 | return S_OK;
|
|---|
| 586 | } else {
|
|---|
| 587 | FIXME("Don't know how to select picture type %d\n",This->desc.picType);
|
|---|
| 588 | return E_FAIL;
|
|---|
| 589 | }
|
|---|
| 590 | }
|
|---|
| 591 |
|
|---|
| 592 | /************************************************************************
|
|---|
| 593 | * OLEPictureImpl_get_KeepOriginalFormat
|
|---|
| 594 | */
|
|---|
| 595 | static HRESULT WINAPI OLEPictureImpl_get_KeepOriginalFormat(IPicture *iface,
|
|---|
| 596 | BOOL *pfKeep)
|
|---|
| 597 | {
|
|---|
| 598 | ICOM_THIS(OLEPictureImpl, iface);
|
|---|
| 599 | TRACE("(%p)->(%p)\n", This, pfKeep);
|
|---|
| 600 | if (!pfKeep)
|
|---|
| 601 | return E_POINTER;
|
|---|
| 602 | *pfKeep = This->keepOrigFormat;
|
|---|
| 603 | return S_OK;
|
|---|
| 604 | }
|
|---|
| 605 |
|
|---|
| 606 | /************************************************************************
|
|---|
| 607 | * OLEPictureImpl_put_KeepOriginalFormat
|
|---|
| 608 | */
|
|---|
| 609 | static HRESULT WINAPI OLEPictureImpl_put_KeepOriginalFormat(IPicture *iface,
|
|---|
| 610 | BOOL keep)
|
|---|
| 611 | {
|
|---|
| 612 | ICOM_THIS(OLEPictureImpl, iface);
|
|---|
| 613 | TRACE("(%p)->(%d)\n", This, keep);
|
|---|
| 614 | This->keepOrigFormat = keep;
|
|---|
| 615 | /* FIXME: what DISPID notification here? */
|
|---|
| 616 | return S_OK;
|
|---|
| 617 | }
|
|---|
| 618 |
|
|---|
| 619 | /************************************************************************
|
|---|
| 620 | * OLEPictureImpl_PictureChanged
|
|---|
| 621 | */
|
|---|
| 622 | static HRESULT WINAPI OLEPictureImpl_PictureChanged(IPicture *iface)
|
|---|
| 623 | {
|
|---|
| 624 | ICOM_THIS(OLEPictureImpl, iface);
|
|---|
| 625 | TRACE("(%p)->()\n", This);
|
|---|
| 626 | OLEPicture_SendNotify(This,DISPID_PICT_HANDLE);
|
|---|
| 627 | return S_OK;
|
|---|
| 628 | }
|
|---|
| 629 |
|
|---|
| 630 | /************************************************************************
|
|---|
| 631 | * OLEPictureImpl_SaveAsFile
|
|---|
| 632 | */
|
|---|
| 633 | static HRESULT WINAPI OLEPictureImpl_SaveAsFile(IPicture *iface,
|
|---|
| 634 | IStream *pstream,
|
|---|
| 635 | BOOL SaveMemCopy,
|
|---|
| 636 | LONG *pcbSize)
|
|---|
| 637 | {
|
|---|
| 638 | ICOM_THIS(OLEPictureImpl, iface);
|
|---|
| 639 | FIXME("(%p)->(%p, %d, %p): stub\n", This, pstream, SaveMemCopy, pcbSize);
|
|---|
| 640 | return E_NOTIMPL;
|
|---|
| 641 | }
|
|---|
| 642 |
|
|---|
| 643 | /************************************************************************
|
|---|
| 644 | * OLEPictureImpl_get_Attributes
|
|---|
| 645 | */
|
|---|
| 646 | static HRESULT WINAPI OLEPictureImpl_get_Attributes(IPicture *iface,
|
|---|
| 647 | DWORD *pdwAttr)
|
|---|
| 648 | {
|
|---|
| 649 | ICOM_THIS(OLEPictureImpl, iface);
|
|---|
| 650 | TRACE("(%p)->(%p).\n", This, pdwAttr);
|
|---|
| 651 | *pdwAttr = 0;
|
|---|
| 652 | switch (This->desc.picType) {
|
|---|
| 653 | case PICTYPE_BITMAP: break; /* not 'truely' scalable, see MSDN. */
|
|---|
| 654 | case PICTYPE_ICON: *pdwAttr = PICTURE_TRANSPARENT;break;
|
|---|
| 655 | case PICTYPE_METAFILE: *pdwAttr = PICTURE_TRANSPARENT|PICTURE_SCALABLE;break;
|
|---|
| 656 | default:FIXME("Unknown pictype %d\n",This->desc.picType);break;
|
|---|
| 657 | }
|
|---|
| 658 | return S_OK;
|
|---|
| 659 | }
|
|---|
| 660 |
|
|---|
| 661 |
|
|---|
| 662 | /************************************************************************
|
|---|
| 663 | * IConnectionPointContainer
|
|---|
| 664 | */
|
|---|
| 665 |
|
|---|
| 666 | static HRESULT WINAPI OLEPictureImpl_IConnectionPointContainer_QueryInterface(
|
|---|
| 667 | IConnectionPointContainer* iface,
|
|---|
| 668 | REFIID riid,
|
|---|
| 669 | VOID** ppvoid
|
|---|
| 670 | ) {
|
|---|
| 671 | ICOM_THIS_From_IConnectionPointContainer(IPicture,iface);
|
|---|
| 672 |
|
|---|
| 673 | return IPicture_QueryInterface(This,riid,ppvoid);
|
|---|
| 674 | }
|
|---|
| 675 |
|
|---|
| 676 | static ULONG WINAPI OLEPictureImpl_IConnectionPointContainer_AddRef(
|
|---|
| 677 | IConnectionPointContainer* iface)
|
|---|
| 678 | {
|
|---|
| 679 | ICOM_THIS_From_IConnectionPointContainer(IPicture, iface);
|
|---|
| 680 |
|
|---|
| 681 | return IPicture_AddRef(This);
|
|---|
| 682 | }
|
|---|
| 683 |
|
|---|
| 684 | static ULONG WINAPI OLEPictureImpl_IConnectionPointContainer_Release(
|
|---|
| 685 | IConnectionPointContainer* iface)
|
|---|
| 686 | {
|
|---|
| 687 | ICOM_THIS_From_IConnectionPointContainer(IPicture, iface);
|
|---|
| 688 |
|
|---|
| 689 | return IPicture_Release(This);
|
|---|
| 690 | }
|
|---|
| 691 |
|
|---|
| 692 | static HRESULT WINAPI OLEPictureImpl_EnumConnectionPoints(
|
|---|
| 693 | IConnectionPointContainer* iface,
|
|---|
| 694 | IEnumConnectionPoints** ppEnum
|
|---|
| 695 | ) {
|
|---|
| 696 | ICOM_THIS_From_IConnectionPointContainer(IPicture, iface);
|
|---|
| 697 |
|
|---|
| 698 | FIXME("(%p,%p), stub!\n",This,ppEnum);
|
|---|
| 699 | return E_NOTIMPL;
|
|---|
| 700 | }
|
|---|
| 701 |
|
|---|
| 702 | static HRESULT WINAPI OLEPictureImpl_FindConnectionPoint(
|
|---|
| 703 | IConnectionPointContainer* iface,
|
|---|
| 704 | REFIID riid,
|
|---|
| 705 | IConnectionPoint **ppCP
|
|---|
| 706 | ) {
|
|---|
| 707 | ICOM_THIS_From_IConnectionPointContainer(OLEPictureImpl, iface);
|
|---|
| 708 | TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppCP);
|
|---|
| 709 | if (!ppCP)
|
|---|
| 710 | return E_POINTER;
|
|---|
| 711 | *ppCP = NULL;
|
|---|
| 712 | if (IsEqualGUID(riid,&IID_IPropertyNotifySink))
|
|---|
| 713 | return IConnectionPoint_QueryInterface(This->pCP,&IID_IConnectionPoint,(LPVOID)ppCP);
|
|---|
| 714 | FIXME("tried to find connection point on %s?\n",debugstr_guid(riid));
|
|---|
| 715 | return 0x80040200;
|
|---|
| 716 | }
|
|---|
| 717 | /************************************************************************
|
|---|
| 718 | * IPersistStream
|
|---|
| 719 | */
|
|---|
| 720 | /************************************************************************
|
|---|
| 721 | * OLEPictureImpl_IPersistStream_QueryInterface (IUnknown)
|
|---|
| 722 | *
|
|---|
| 723 | * See Windows documentation for more details on IUnknown methods.
|
|---|
| 724 | */
|
|---|
| 725 | static HRESULT WINAPI OLEPictureImpl_IPersistStream_QueryInterface(
|
|---|
| 726 | IPersistStream* iface,
|
|---|
| 727 | REFIID riid,
|
|---|
| 728 | VOID** ppvoid)
|
|---|
| 729 | {
|
|---|
| 730 | ICOM_THIS_From_IPersistStream(IPicture, iface);
|
|---|
| 731 |
|
|---|
| 732 | return IPicture_QueryInterface(This, riid, ppvoid);
|
|---|
| 733 | }
|
|---|
| 734 |
|
|---|
| 735 | /************************************************************************
|
|---|
| 736 | * OLEPictureImpl_IPersistStream_AddRef (IUnknown)
|
|---|
| 737 | *
|
|---|
| 738 | * See Windows documentation for more details on IUnknown methods.
|
|---|
| 739 | */
|
|---|
| 740 | static ULONG WINAPI OLEPictureImpl_IPersistStream_AddRef(
|
|---|
| 741 | IPersistStream* iface)
|
|---|
| 742 | {
|
|---|
| 743 | ICOM_THIS_From_IPersistStream(IPicture, iface);
|
|---|
| 744 |
|
|---|
| 745 | return IPicture_AddRef(This);
|
|---|
| 746 | }
|
|---|
| 747 |
|
|---|
| 748 | /************************************************************************
|
|---|
| 749 | * OLEPictureImpl_IPersistStream_Release (IUnknown)
|
|---|
| 750 | *
|
|---|
| 751 | * See Windows documentation for more details on IUnknown methods.
|
|---|
| 752 | */
|
|---|
| 753 | static ULONG WINAPI OLEPictureImpl_IPersistStream_Release(
|
|---|
| 754 | IPersistStream* iface)
|
|---|
| 755 | {
|
|---|
| 756 | ICOM_THIS_From_IPersistStream(IPicture, iface);
|
|---|
| 757 |
|
|---|
| 758 | return IPicture_Release(This);
|
|---|
| 759 | }
|
|---|
| 760 |
|
|---|
| 761 | /************************************************************************
|
|---|
| 762 | * OLEPictureImpl_IPersistStream_GetClassID
|
|---|
| 763 | */
|
|---|
| 764 | static HRESULT WINAPI OLEPictureImpl_GetClassID(
|
|---|
| 765 | IPersistStream* iface,CLSID* pClassID)
|
|---|
| 766 | {
|
|---|
| 767 | ICOM_THIS_From_IPersistStream(IPicture, iface);
|
|---|
| 768 | FIXME("(%p),stub!\n",This);
|
|---|
| 769 | return E_NOTIMPL;
|
|---|
| 770 | }
|
|---|
| 771 |
|
|---|
| 772 | /************************************************************************
|
|---|
| 773 | * OLEPictureImpl_IPersistStream_IsDirty
|
|---|
| 774 | */
|
|---|
| 775 | static HRESULT WINAPI OLEPictureImpl_IsDirty(
|
|---|
| 776 | IPersistStream* iface)
|
|---|
| 777 | {
|
|---|
| 778 | ICOM_THIS_From_IPersistStream(IPicture, iface);
|
|---|
| 779 | FIXME("(%p),stub!\n",This);
|
|---|
| 780 | return E_NOTIMPL;
|
|---|
| 781 | }
|
|---|
| 782 |
|
|---|
| 783 | #ifdef HAVE_LIBJPEG
|
|---|
| 784 | /* for the jpeg decompressor source manager. */
|
|---|
| 785 | static void _jpeg_init_source(j_decompress_ptr cinfo) { }
|
|---|
| 786 |
|
|---|
| 787 | static boolean _jpeg_fill_input_buffer(j_decompress_ptr cinfo) {
|
|---|
| 788 | ERR("(), should not get here.\n");
|
|---|
| 789 | return FALSE;
|
|---|
| 790 | }
|
|---|
| 791 |
|
|---|
| 792 | static void _jpeg_skip_input_data(j_decompress_ptr cinfo,long num_bytes) {
|
|---|
| 793 | ERR("(%ld), should not get here.\n",num_bytes);
|
|---|
| 794 | }
|
|---|
| 795 |
|
|---|
| 796 | static boolean _jpeg_resync_to_restart(j_decompress_ptr cinfo, int desired) {
|
|---|
| 797 | ERR("(desired=%d), should not get here.\n",desired);
|
|---|
| 798 | return FALSE;
|
|---|
| 799 | }
|
|---|
| 800 | static void _jpeg_term_source(j_decompress_ptr cinfo) { }
|
|---|
| 801 | #endif /* HAVE_LIBJPEG */
|
|---|
| 802 |
|
|---|
| 803 | /************************************************************************
|
|---|
| 804 | * OLEPictureImpl_IPersistStream_Load (IUnknown)
|
|---|
| 805 | *
|
|---|
| 806 | * Loads the binary data from the IStream. Starts at current position.
|
|---|
| 807 | * There appears to be an 2 DWORD header:
|
|---|
| 808 | * DWORD magic;
|
|---|
| 809 | * DWORD len;
|
|---|
| 810 | *
|
|---|
| 811 | * Currently implemented: BITMAP, ICON, JPEG.
|
|---|
| 812 | */
|
|---|
| 813 | static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
|
|---|
| 814 | HRESULT hr = E_FAIL;
|
|---|
| 815 | ULONG xread;
|
|---|
| 816 | BYTE *xbuf;
|
|---|
| 817 | DWORD header[2];
|
|---|
| 818 | WORD magic;
|
|---|
| 819 | ICOM_THIS_From_IPersistStream(OLEPictureImpl, iface);
|
|---|
| 820 |
|
|---|
| 821 | TRACE("(%p,%p)\n",This,pStm);
|
|---|
| 822 |
|
|---|
| 823 | hr=IStream_Read(pStm,header,8,&xread);
|
|---|
| 824 | if (hr || xread!=8) {
|
|---|
| 825 | FIXME("Failure while reading picture header (hr is %lx, nread is %ld).\n",hr,xread);
|
|---|
| 826 | return hr;
|
|---|
| 827 | }
|
|---|
| 828 | xread = 0;
|
|---|
| 829 | xbuf = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,header[1]);
|
|---|
| 830 | while (xread < header[1]) {
|
|---|
| 831 | ULONG nread;
|
|---|
| 832 | hr = IStream_Read(pStm,xbuf+xread,header[1]-xread,&nread);
|
|---|
| 833 | xread+=nread;
|
|---|
| 834 | if (hr || !nread)
|
|---|
| 835 | break;
|
|---|
| 836 | }
|
|---|
| 837 | if (xread != header[1])
|
|---|
| 838 | FIXME("Could only read %ld of %ld bytes?\n",xread,header[1]);
|
|---|
| 839 |
|
|---|
| 840 | magic = xbuf[0] + (xbuf[1]<<8);
|
|---|
| 841 | switch (magic) {
|
|---|
| 842 | case 0xd8ff: { /* JPEG */
|
|---|
| 843 | #ifdef HAVE_LIBJPEG
|
|---|
| 844 | struct jpeg_decompress_struct jd;
|
|---|
| 845 | struct jpeg_error_mgr jerr;
|
|---|
| 846 | int ret;
|
|---|
| 847 | JDIMENSION x;
|
|---|
| 848 | JSAMPROW samprow;
|
|---|
| 849 | BITMAPINFOHEADER bmi;
|
|---|
| 850 | LPBYTE bits;
|
|---|
| 851 | HDC hdcref;
|
|---|
| 852 | struct jpeg_source_mgr xjsm;
|
|---|
| 853 |
|
|---|
| 854 | /* This is basically so we can use in-memory data for jpeg decompression.
|
|---|
| 855 | * We need to have all the functions.
|
|---|
| 856 | */
|
|---|
| 857 | xjsm.next_input_byte = xbuf;
|
|---|
| 858 | xjsm.bytes_in_buffer = xread;
|
|---|
| 859 | xjsm.init_source = _jpeg_init_source;
|
|---|
| 860 | xjsm.fill_input_buffer = _jpeg_fill_input_buffer;
|
|---|
| 861 | xjsm.skip_input_data = _jpeg_skip_input_data;
|
|---|
| 862 | xjsm.resync_to_restart = _jpeg_resync_to_restart;
|
|---|
| 863 | xjsm.term_source = _jpeg_term_source;
|
|---|
| 864 |
|
|---|
| 865 | jd.err = jpeg_std_error(&jerr);
|
|---|
| 866 | jpeg_create_decompress(&jd);
|
|---|
| 867 | jd.src = &xjsm;
|
|---|
| 868 | ret=jpeg_read_header(&jd,TRUE);
|
|---|
| 869 | jpeg_start_decompress(&jd);
|
|---|
| 870 | if (ret != JPEG_HEADER_OK) {
|
|---|
| 871 | ERR("Jpeg image in stream has bad format, read header returned %d.\n",ret);
|
|---|
| 872 | HeapFree(GetProcessHeap(),0,xbuf);
|
|---|
| 873 | return E_FAIL;
|
|---|
| 874 | }
|
|---|
| 875 | bits = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,(jd.output_height+1)*jd.output_width*jd.output_components);
|
|---|
| 876 | samprow=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,jd.output_width*jd.output_components);
|
|---|
| 877 | while ( jd.output_scanline<jd.output_height ) {
|
|---|
| 878 | x = jpeg_read_scanlines(&jd,&samprow,1);
|
|---|
| 879 | if (x != 1) {
|
|---|
| 880 | FIXME("failed to read current scanline?\n");
|
|---|
| 881 | break;
|
|---|
| 882 | }
|
|---|
| 883 | memcpy( bits+jd.output_scanline*jd.output_width*jd.output_components,
|
|---|
| 884 | samprow,
|
|---|
| 885 | jd.output_width*jd.output_components
|
|---|
| 886 | );
|
|---|
| 887 | }
|
|---|
| 888 | bmi.biSize = sizeof(bmi);
|
|---|
| 889 | bmi.biWidth = jd.output_width;
|
|---|
| 890 | bmi.biHeight = -jd.output_height;
|
|---|
| 891 | bmi.biPlanes = 1;
|
|---|
| 892 | bmi.biBitCount = jd.output_components<<3;
|
|---|
| 893 | bmi.biCompression = BI_RGB;
|
|---|
| 894 | bmi.biSizeImage = jd.output_height*jd.output_width*jd.output_components;
|
|---|
| 895 | bmi.biXPelsPerMeter = 0;
|
|---|
| 896 | bmi.biYPelsPerMeter = 0;
|
|---|
| 897 | bmi.biClrUsed = 0;
|
|---|
| 898 | bmi.biClrImportant = 0;
|
|---|
| 899 |
|
|---|
| 900 | HeapFree(GetProcessHeap(),0,samprow);
|
|---|
| 901 | jpeg_finish_decompress(&jd);
|
|---|
| 902 | jpeg_destroy_decompress(&jd);
|
|---|
| 903 | hdcref = GetDC(0);
|
|---|
| 904 | This->desc.u.bmp.hbitmap=CreateDIBitmap(
|
|---|
| 905 | hdcref,
|
|---|
| 906 | &bmi,
|
|---|
| 907 | CBM_INIT,
|
|---|
| 908 | bits,
|
|---|
| 909 | (BITMAPINFO*)&bmi,
|
|---|
| 910 | DIB_RGB_COLORS
|
|---|
| 911 | );
|
|---|
| 912 | DeleteDC(hdcref);
|
|---|
| 913 | This->desc.picType = PICTYPE_BITMAP;
|
|---|
| 914 | OLEPictureImpl_SetBitmap(This);
|
|---|
| 915 | hr = S_OK;
|
|---|
| 916 | HeapFree(GetProcessHeap(),0,bits);
|
|---|
| 917 | #else
|
|---|
| 918 | ERR("Trying to load JPEG picture, but JPEG supported not compiled in.\n");
|
|---|
| 919 | hr = E_FAIL;
|
|---|
| 920 | #endif
|
|---|
| 921 | break;
|
|---|
| 922 | }
|
|---|
| 923 | case 0x4d42: { /* Bitmap */
|
|---|
| 924 | BITMAPFILEHEADER *bfh = (BITMAPFILEHEADER*)xbuf;
|
|---|
| 925 | BITMAPINFO *bi = (BITMAPINFO*)(bfh+1);
|
|---|
| 926 | HDC hdcref;
|
|---|
| 927 |
|
|---|
| 928 | /* Does not matter whether this is a coreheader or not, we only use
|
|---|
| 929 | * components which are in both
|
|---|
| 930 | */
|
|---|
| 931 | hdcref = GetDC(0);
|
|---|
| 932 | This->desc.u.bmp.hbitmap = CreateDIBitmap(
|
|---|
| 933 | hdcref,
|
|---|
| 934 | &(bi->bmiHeader),
|
|---|
| 935 | CBM_INIT,
|
|---|
| 936 | xbuf+bfh->bfOffBits,
|
|---|
| 937 | bi,
|
|---|
| 938 | (bi->bmiHeader.biBitCount<=8)?DIB_PAL_COLORS:DIB_RGB_COLORS
|
|---|
| 939 | );
|
|---|
| 940 | DeleteDC(hdcref);
|
|---|
| 941 | This->desc.picType = PICTYPE_BITMAP;
|
|---|
| 942 | OLEPictureImpl_SetBitmap(This);
|
|---|
| 943 | hr = S_OK;
|
|---|
| 944 | break;
|
|---|
| 945 | }
|
|---|
| 946 | case 0x0000: { /* ICON , first word is dwReserved */
|
|---|
| 947 | HICON hicon;
|
|---|
| 948 | CURSORICONFILEDIR *cifd = (CURSORICONFILEDIR*)xbuf;
|
|---|
| 949 | int i;
|
|---|
| 950 |
|
|---|
| 951 | /*
|
|---|
| 952 | FIXME("icon.idReserved=%d\n",cifd->idReserved);
|
|---|
| 953 | FIXME("icon.idType=%d\n",cifd->idType);
|
|---|
| 954 | FIXME("icon.idCount=%d\n",cifd->idCount);
|
|---|
| 955 |
|
|---|
| 956 | for (i=0;i<cifd->idCount;i++) {
|
|---|
| 957 | FIXME("[%d] width %d\n",i,cifd->idEntries[i].bWidth);
|
|---|
| 958 | FIXME("[%d] height %d\n",i,cifd->idEntries[i].bHeight);
|
|---|
| 959 | FIXME("[%d] bColorCount %d\n",i,cifd->idEntries[i].bColorCount);
|
|---|
| 960 | FIXME("[%d] bReserved %d\n",i,cifd->idEntries[i].bReserved);
|
|---|
| 961 | FIXME("[%d] xHotspot %d\n",i,cifd->idEntries[i].xHotspot);
|
|---|
| 962 | FIXME("[%d] yHotspot %d\n",i,cifd->idEntries[i].yHotspot);
|
|---|
| 963 | FIXME("[%d] dwDIBSize %d\n",i,cifd->idEntries[i].dwDIBSize);
|
|---|
| 964 | FIXME("[%d] dwDIBOffset %d\n",i,cifd->idEntries[i].dwDIBOffset);
|
|---|
| 965 | }
|
|---|
| 966 | */
|
|---|
| 967 | i=0;
|
|---|
| 968 | /* If we have more than one icon, try to find the best.
|
|---|
| 969 | * this currently means '32 pixel wide'.
|
|---|
| 970 | */
|
|---|
| 971 | if (cifd->idCount!=1) {
|
|---|
| 972 | for (i=0;i<cifd->idCount;i++) {
|
|---|
| 973 | if (cifd->idEntries[i].bWidth == 32)
|
|---|
| 974 | break;
|
|---|
| 975 | }
|
|---|
| 976 | if (i==cifd->idCount) i=0;
|
|---|
| 977 | }
|
|---|
| 978 |
|
|---|
| 979 | hicon = CreateIconFromResourceEx(
|
|---|
| 980 | xbuf+cifd->idEntries[i].dwDIBOffset,
|
|---|
| 981 | cifd->idEntries[i].dwDIBSize,
|
|---|
| 982 | TRUE, /* is icon */
|
|---|
| 983 | 0x00030000,
|
|---|
| 984 | cifd->idEntries[i].bWidth,
|
|---|
| 985 | cifd->idEntries[i].bHeight,
|
|---|
| 986 | 0
|
|---|
| 987 | );
|
|---|
| 988 | if (!hicon) {
|
|---|
| 989 | FIXME("CreateIcon failed.\n");
|
|---|
| 990 | hr = E_FAIL;
|
|---|
| 991 | } else {
|
|---|
| 992 | This->desc.picType = PICTYPE_ICON;
|
|---|
| 993 | This->desc.u.icon.hicon = hicon;
|
|---|
| 994 | hr = S_OK;
|
|---|
| 995 | }
|
|---|
| 996 | break;
|
|---|
| 997 | }
|
|---|
| 998 | default:
|
|---|
| 999 | FIXME("Unknown magic %04x\n",magic);
|
|---|
| 1000 | hr=E_FAIL;
|
|---|
| 1001 | break;
|
|---|
| 1002 | }
|
|---|
| 1003 | HeapFree(GetProcessHeap(),0,xbuf);
|
|---|
| 1004 |
|
|---|
| 1005 | /* FIXME: this notify is not really documented */
|
|---|
| 1006 | if (hr==S_OK)
|
|---|
| 1007 | OLEPicture_SendNotify(This,DISPID_PICT_TYPE);
|
|---|
| 1008 | return hr;
|
|---|
| 1009 | }
|
|---|
| 1010 |
|
|---|
| 1011 | static HRESULT WINAPI OLEPictureImpl_Save(
|
|---|
| 1012 | IPersistStream* iface,IStream*pStm,BOOL fClearDirty)
|
|---|
| 1013 | {
|
|---|
| 1014 | ICOM_THIS_From_IPersistStream(IPicture, iface);
|
|---|
| 1015 | FIXME("(%p,%p,%d),stub!\n",This,pStm,fClearDirty);
|
|---|
| 1016 | return E_NOTIMPL;
|
|---|
| 1017 | }
|
|---|
| 1018 |
|
|---|
| 1019 | static HRESULT WINAPI OLEPictureImpl_GetSizeMax(
|
|---|
| 1020 | IPersistStream* iface,ULARGE_INTEGER*pcbSize)
|
|---|
| 1021 | {
|
|---|
| 1022 | ICOM_THIS_From_IPersistStream(IPicture, iface);
|
|---|
| 1023 | FIXME("(%p,%p),stub!\n",This,pcbSize);
|
|---|
| 1024 | return E_NOTIMPL;
|
|---|
| 1025 | }
|
|---|
| 1026 |
|
|---|
| 1027 | /************************************************************************
|
|---|
| 1028 | * IDispatch
|
|---|
| 1029 | */
|
|---|
| 1030 | /************************************************************************
|
|---|
| 1031 | * OLEPictureImpl_IDispatch_QueryInterface (IUnknown)
|
|---|
| 1032 | *
|
|---|
| 1033 | * See Windows documentation for more details on IUnknown methods.
|
|---|
| 1034 | */
|
|---|
| 1035 | static HRESULT WINAPI OLEPictureImpl_IDispatch_QueryInterface(
|
|---|
| 1036 | IDispatch* iface,
|
|---|
| 1037 | REFIID riid,
|
|---|
| 1038 | VOID** ppvoid)
|
|---|
| 1039 | {
|
|---|
| 1040 | ICOM_THIS_From_IDispatch(IPicture, iface);
|
|---|
| 1041 |
|
|---|
| 1042 | return IPicture_QueryInterface(This, riid, ppvoid);
|
|---|
| 1043 | }
|
|---|
| 1044 |
|
|---|
| 1045 | /************************************************************************
|
|---|
| 1046 | * OLEPictureImpl_IDispatch_AddRef (IUnknown)
|
|---|
| 1047 | *
|
|---|
| 1048 | * See Windows documentation for more details on IUnknown methods.
|
|---|
| 1049 | */
|
|---|
| 1050 | static ULONG WINAPI OLEPictureImpl_IDispatch_AddRef(
|
|---|
| 1051 | IDispatch* iface)
|
|---|
| 1052 | {
|
|---|
| 1053 | ICOM_THIS_From_IDispatch(IPicture, iface);
|
|---|
| 1054 |
|
|---|
| 1055 | return IPicture_AddRef(This);
|
|---|
| 1056 | }
|
|---|
| 1057 |
|
|---|
| 1058 | /************************************************************************
|
|---|
| 1059 | * OLEPictureImpl_IDispatch_Release (IUnknown)
|
|---|
| 1060 | *
|
|---|
| 1061 | * See Windows documentation for more details on IUnknown methods.
|
|---|
| 1062 | */
|
|---|
| 1063 | static ULONG WINAPI OLEPictureImpl_IDispatch_Release(
|
|---|
| 1064 | IDispatch* iface)
|
|---|
| 1065 | {
|
|---|
| 1066 | ICOM_THIS_From_IDispatch(IPicture, iface);
|
|---|
| 1067 |
|
|---|
| 1068 | return IPicture_Release(This);
|
|---|
| 1069 | }
|
|---|
| 1070 |
|
|---|
| 1071 | /************************************************************************
|
|---|
| 1072 | * OLEPictureImpl_GetTypeInfoCount (IDispatch)
|
|---|
| 1073 | *
|
|---|
| 1074 | * See Windows documentation for more details on IDispatch methods.
|
|---|
| 1075 | */
|
|---|
| 1076 | static HRESULT WINAPI OLEPictureImpl_GetTypeInfoCount(
|
|---|
| 1077 | IDispatch* iface,
|
|---|
| 1078 | unsigned int* pctinfo)
|
|---|
| 1079 | {
|
|---|
| 1080 | FIXME("():Stub\n");
|
|---|
| 1081 |
|
|---|
| 1082 | return E_NOTIMPL;
|
|---|
| 1083 | }
|
|---|
| 1084 |
|
|---|
| 1085 | /************************************************************************
|
|---|
| 1086 | * OLEPictureImpl_GetTypeInfo (IDispatch)
|
|---|
| 1087 | *
|
|---|
| 1088 | * See Windows documentation for more details on IDispatch methods.
|
|---|
| 1089 | */
|
|---|
| 1090 | static HRESULT WINAPI OLEPictureImpl_GetTypeInfo(
|
|---|
| 1091 | IDispatch* iface,
|
|---|
| 1092 | UINT iTInfo,
|
|---|
| 1093 | LCID lcid,
|
|---|
| 1094 | ITypeInfo** ppTInfo)
|
|---|
| 1095 | {
|
|---|
| 1096 | FIXME("():Stub\n");
|
|---|
| 1097 |
|
|---|
| 1098 | return E_NOTIMPL;
|
|---|
| 1099 | }
|
|---|
| 1100 |
|
|---|
| 1101 | /************************************************************************
|
|---|
| 1102 | * OLEPictureImpl_GetIDsOfNames (IDispatch)
|
|---|
| 1103 | *
|
|---|
| 1104 | * See Windows documentation for more details on IDispatch methods.
|
|---|
| 1105 | */
|
|---|
| 1106 | static HRESULT WINAPI OLEPictureImpl_GetIDsOfNames(
|
|---|
| 1107 | IDispatch* iface,
|
|---|
| 1108 | REFIID riid,
|
|---|
| 1109 | LPOLESTR* rgszNames,
|
|---|
| 1110 | UINT cNames,
|
|---|
| 1111 | LCID lcid,
|
|---|
| 1112 | DISPID* rgDispId)
|
|---|
| 1113 | {
|
|---|
| 1114 | FIXME("():Stub\n");
|
|---|
| 1115 |
|
|---|
| 1116 | return E_NOTIMPL;
|
|---|
| 1117 | }
|
|---|
| 1118 |
|
|---|
| 1119 | /************************************************************************
|
|---|
| 1120 | * OLEPictureImpl_Invoke (IDispatch)
|
|---|
| 1121 | *
|
|---|
| 1122 | * See Windows documentation for more details on IDispatch methods.
|
|---|
| 1123 | */
|
|---|
| 1124 | static HRESULT WINAPI OLEPictureImpl_Invoke(
|
|---|
| 1125 | IDispatch* iface,
|
|---|
| 1126 | DISPID dispIdMember,
|
|---|
| 1127 | REFIID riid,
|
|---|
| 1128 | LCID lcid,
|
|---|
| 1129 | WORD wFlags,
|
|---|
| 1130 | DISPPARAMS* pDispParams,
|
|---|
| 1131 | VARIANT* pVarResult,
|
|---|
| 1132 | EXCEPINFO* pExepInfo,
|
|---|
| 1133 | UINT* puArgErr)
|
|---|
| 1134 | {
|
|---|
| 1135 | FIXME("(dispid: %ld):Stub\n",dispIdMember);
|
|---|
| 1136 |
|
|---|
| 1137 | VariantInit(pVarResult);
|
|---|
| 1138 | V_VT(pVarResult) = VT_BOOL;
|
|---|
| 1139 | V_UNION(pVarResult,boolVal) = FALSE;
|
|---|
| 1140 | return S_OK;
|
|---|
| 1141 | }
|
|---|
| 1142 |
|
|---|
| 1143 |
|
|---|
| 1144 | static ICOM_VTABLE(IPicture) OLEPictureImpl_VTable =
|
|---|
| 1145 | {
|
|---|
| 1146 | ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
|---|
| 1147 | OLEPictureImpl_QueryInterface,
|
|---|
| 1148 | OLEPictureImpl_AddRef,
|
|---|
| 1149 | OLEPictureImpl_Release,
|
|---|
| 1150 | OLEPictureImpl_get_Handle,
|
|---|
| 1151 | OLEPictureImpl_get_hPal,
|
|---|
| 1152 | OLEPictureImpl_get_Type,
|
|---|
| 1153 | OLEPictureImpl_get_Width,
|
|---|
| 1154 | OLEPictureImpl_get_Height,
|
|---|
| 1155 | OLEPictureImpl_Render,
|
|---|
| 1156 | OLEPictureImpl_set_hPal,
|
|---|
| 1157 | OLEPictureImpl_get_CurDC,
|
|---|
| 1158 | OLEPictureImpl_SelectPicture,
|
|---|
| 1159 | OLEPictureImpl_get_KeepOriginalFormat,
|
|---|
| 1160 | OLEPictureImpl_put_KeepOriginalFormat,
|
|---|
| 1161 | OLEPictureImpl_PictureChanged,
|
|---|
| 1162 | OLEPictureImpl_SaveAsFile,
|
|---|
| 1163 | OLEPictureImpl_get_Attributes
|
|---|
| 1164 | };
|
|---|
| 1165 |
|
|---|
| 1166 | static ICOM_VTABLE(IDispatch) OLEPictureImpl_IDispatch_VTable =
|
|---|
| 1167 | {
|
|---|
| 1168 | ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
|---|
| 1169 | OLEPictureImpl_IDispatch_QueryInterface,
|
|---|
| 1170 | OLEPictureImpl_IDispatch_AddRef,
|
|---|
| 1171 | OLEPictureImpl_IDispatch_Release,
|
|---|
| 1172 | OLEPictureImpl_GetTypeInfoCount,
|
|---|
| 1173 | OLEPictureImpl_GetTypeInfo,
|
|---|
| 1174 | OLEPictureImpl_GetIDsOfNames,
|
|---|
| 1175 | OLEPictureImpl_Invoke
|
|---|
| 1176 | };
|
|---|
| 1177 |
|
|---|
| 1178 | static ICOM_VTABLE(IPersistStream) OLEPictureImpl_IPersistStream_VTable =
|
|---|
| 1179 | {
|
|---|
| 1180 | ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
|---|
| 1181 | OLEPictureImpl_IPersistStream_QueryInterface,
|
|---|
| 1182 | OLEPictureImpl_IPersistStream_AddRef,
|
|---|
| 1183 | OLEPictureImpl_IPersistStream_Release,
|
|---|
| 1184 | OLEPictureImpl_GetClassID,
|
|---|
| 1185 | OLEPictureImpl_IsDirty,
|
|---|
| 1186 | OLEPictureImpl_Load,
|
|---|
| 1187 | OLEPictureImpl_Save,
|
|---|
| 1188 | OLEPictureImpl_GetSizeMax
|
|---|
| 1189 | };
|
|---|
| 1190 |
|
|---|
| 1191 | static ICOM_VTABLE(IConnectionPointContainer) OLEPictureImpl_IConnectionPointContainer_VTable =
|
|---|
| 1192 | {
|
|---|
| 1193 | ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
|---|
| 1194 | OLEPictureImpl_IConnectionPointContainer_QueryInterface,
|
|---|
| 1195 | OLEPictureImpl_IConnectionPointContainer_AddRef,
|
|---|
| 1196 | OLEPictureImpl_IConnectionPointContainer_Release,
|
|---|
| 1197 | OLEPictureImpl_EnumConnectionPoints,
|
|---|
| 1198 | OLEPictureImpl_FindConnectionPoint
|
|---|
| 1199 | };
|
|---|
| 1200 |
|
|---|
| 1201 | /***********************************************************************
|
|---|
| 1202 | * OleCreatePictureIndirect (OLEAUT32.419)
|
|---|
| 1203 | */
|
|---|
| 1204 | HRESULT WINAPI OleCreatePictureIndirect(LPPICTDESC lpPictDesc, REFIID riid,
|
|---|
| 1205 | BOOL fOwn, LPVOID *ppvObj )
|
|---|
| 1206 | {
|
|---|
| 1207 | OLEPictureImpl* newPict = NULL;
|
|---|
| 1208 | HRESULT hr = S_OK;
|
|---|
| 1209 |
|
|---|
| 1210 | TRACE("(%p,%p,%d,%p)\n", lpPictDesc, riid, fOwn, ppvObj);
|
|---|
| 1211 |
|
|---|
| 1212 | /*
|
|---|
| 1213 | * Sanity check
|
|---|
| 1214 | */
|
|---|
| 1215 | if (ppvObj==0)
|
|---|
| 1216 | return E_POINTER;
|
|---|
| 1217 |
|
|---|
| 1218 | *ppvObj = NULL;
|
|---|
| 1219 |
|
|---|
| 1220 | /*
|
|---|
| 1221 | * Try to construct a new instance of the class.
|
|---|
| 1222 | */
|
|---|
| 1223 | newPict = OLEPictureImpl_Construct(lpPictDesc, fOwn);
|
|---|
| 1224 |
|
|---|
| 1225 | if (newPict == NULL)
|
|---|
| 1226 | return E_OUTOFMEMORY;
|
|---|
| 1227 |
|
|---|
| 1228 | /*
|
|---|
| 1229 | * Make sure it supports the interface required by the caller.
|
|---|
| 1230 | */
|
|---|
| 1231 | hr = IPicture_QueryInterface((IPicture*)newPict, riid, ppvObj);
|
|---|
| 1232 |
|
|---|
| 1233 | /*
|
|---|
| 1234 | * Release the reference obtained in the constructor. If
|
|---|
| 1235 | * the QueryInterface was unsuccessful, it will free the class.
|
|---|
| 1236 | */
|
|---|
| 1237 | IPicture_Release((IPicture*)newPict);
|
|---|
| 1238 |
|
|---|
| 1239 | return hr;
|
|---|
| 1240 | }
|
|---|
| 1241 |
|
|---|
| 1242 |
|
|---|
| 1243 | /***********************************************************************
|
|---|
| 1244 | * OleLoadPicture (OLEAUT32.418)
|
|---|
| 1245 | */
|
|---|
| 1246 | HRESULT WINAPI OleLoadPicture( LPSTREAM lpstream, LONG lSize, BOOL fRunmode,
|
|---|
| 1247 | REFIID riid, LPVOID *ppvObj )
|
|---|
| 1248 | {
|
|---|
| 1249 | LPPERSISTSTREAM ps;
|
|---|
| 1250 | IPicture *newpic;
|
|---|
| 1251 | HRESULT hr;
|
|---|
| 1252 |
|
|---|
| 1253 | TRACE("(%p,%ld,%d,%s,%p), partially implemented.\n",
|
|---|
| 1254 | lpstream, lSize, fRunmode, debugstr_guid(riid), ppvObj);
|
|---|
| 1255 |
|
|---|
| 1256 | hr = OleCreatePictureIndirect(NULL,riid,!fRunmode,(LPVOID*)&newpic);
|
|---|
| 1257 | if (hr)
|
|---|
| 1258 | return hr;
|
|---|
| 1259 | hr = IPicture_QueryInterface(newpic,&IID_IPersistStream, (LPVOID*)&ps);
|
|---|
| 1260 | if (hr) {
|
|---|
| 1261 | FIXME("Could not get IPersistStream iface from Ole Picture?\n");
|
|---|
| 1262 | IPicture_Release(newpic);
|
|---|
| 1263 | *ppvObj = NULL;
|
|---|
| 1264 | return hr;
|
|---|
| 1265 | }
|
|---|
| 1266 | IPersistStream_Load(ps,lpstream);
|
|---|
| 1267 | IPersistStream_Release(ps);
|
|---|
| 1268 | hr = IPicture_QueryInterface(newpic,riid,ppvObj);
|
|---|
| 1269 | if (hr)
|
|---|
| 1270 | FIXME("Failed to get interface %s from IPicture.\n",debugstr_guid(riid));
|
|---|
| 1271 | IPicture_Release(newpic);
|
|---|
| 1272 | return hr;
|
|---|
| 1273 | }
|
|---|
| 1274 |
|
|---|
| 1275 | /***********************************************************************
|
|---|
| 1276 | * OleLoadPictureEx (OLEAUT32.425)
|
|---|
| 1277 | */
|
|---|
| 1278 | HRESULT WINAPI OleLoadPictureEx( LPSTREAM lpstream, LONG lSize, BOOL fRunmode,
|
|---|
| 1279 | REFIID reed, DWORD xsiz, DWORD ysiz, DWORD flags, LPVOID *ppvObj )
|
|---|
| 1280 | {
|
|---|
| 1281 | FIXME("(%p,%ld,%d,%p,%lx,%lx,%lx,%p), not implemented\n",
|
|---|
| 1282 | lpstream, lSize, fRunmode, reed, xsiz, ysiz, flags, ppvObj);
|
|---|
| 1283 | return S_OK;
|
|---|
| 1284 | }
|
|---|
| 1285 |
|
|---|
| 1286 | #ifdef __WIN32OS2__
|
|---|
| 1287 |
|
|---|
| 1288 | // ----------------------------------------------------------------------
|
|---|
| 1289 | // OleLoadPictureFile
|
|---|
| 1290 | // ----------------------------------------------------------------------
|
|---|
| 1291 | HRESULT WIN32API OleLoadPictureFile(VARIANT varFileName, LPDISPATCH* lplpdispPicture)
|
|---|
| 1292 | {
|
|---|
| 1293 | dprintf(("OLEAUT32: OleLoadPictureFile - stub"));
|
|---|
| 1294 | return S_OK;
|
|---|
| 1295 | }
|
|---|
| 1296 |
|
|---|
| 1297 | // ----------------------------------------------------------------------
|
|---|
| 1298 | // OleSavePictureFile
|
|---|
| 1299 | // ----------------------------------------------------------------------
|
|---|
| 1300 | HRESULT WIN32API OleSavePictureFile(LPDISPATCH lpdispPicture,
|
|---|
| 1301 | BSTR bstrFileName)
|
|---|
| 1302 | {
|
|---|
| 1303 | dprintf(("OLEAUT32: OleSavePictureFile - stub"));
|
|---|
| 1304 | return S_OK;
|
|---|
| 1305 | }
|
|---|
| 1306 |
|
|---|
| 1307 | // ----------------------------------------------------------------------
|
|---|
| 1308 | // OleLoadPicturePath
|
|---|
| 1309 | // ----------------------------------------------------------------------
|
|---|
| 1310 | HRESULT WIN32API OleLoadPicturePath
|
|---|
| 1311 | (LPOLESTR szURLorPath,
|
|---|
| 1312 | LPUNKNOWN punkCaller,
|
|---|
| 1313 | DWORD dwReserved,
|
|---|
| 1314 | OLE_COLOR clrReserved,
|
|---|
| 1315 | REFIID riid,
|
|---|
| 1316 | LPVOID * ppvRet )
|
|---|
| 1317 | {
|
|---|
| 1318 | dprintf(("OLEAUT32: OleLoadPicturePath - stub"));
|
|---|
| 1319 | return S_OK;
|
|---|
| 1320 | }
|
|---|
| 1321 | #endif
|
|---|