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