}
else
{
- *ppvObject = NULL;
+ *ppvObject = nullptr;
return E_NOINTERFACE;
}
}
/* fill in filename, if needed */
if (grfStatFlag != STATFLAG_NONAME)
{
- int wide_count = MultiByteToWideChar(CP_UTF8, 0, _name, -1, NULL, 0);
+ int wide_count = MultiByteToWideChar(CP_UTF8, 0, _name, -1, nullptr, 0);
if (wide_count > 0)
{
pstatstg->pwcsName = (LPOLESTR)CoTaskMemAlloc(wide_count * 2);
MultiByteToWideChar(CP_UTF8, 0, _name, -1, pstatstg->pwcsName, wide_count);
}
else
- pstatstg->pwcsName = NULL;
+ pstatstg->pwcsName = nullptr;
}
/* fill out rest of STATSTG */
/* allocate memory and attach stream to it */
HGLOBAL buffer = GlobalAlloc(GMEM_MOVEABLE, 0);
- IStream *stream = NULL;
+ IStream *stream = nullptr;
CreateStreamOnHGlobal(buffer, FALSE, &stream); /* FALSE means don't deallocate buffer when releasing stream */
Bitmap bitmap(
}
static gvdevice_engine_t gdiplus_engine = {
- NULL, /* gdiplus_initialize */
+ nullptr, /* gdiplus_initialize */
gdiplus_format,
- NULL, /* gdiplus_finalize */
+ nullptr, /* gdiplus_finalize */
};
static gvdevice_features_t device_features_gdiplus = {
{FORMAT_PNG, "png:cairo", 8, &gdiplus_engine, &device_features_gdiplus},
{FORMAT_TIFF, "tif:cairo", 8, &gdiplus_engine, &device_features_gdiplus},
{FORMAT_TIFF, "tiff:cairo", 8, &gdiplus_engine, &device_features_gdiplus},
- {0, NULL, 0, NULL, NULL}
+ {0, nullptr, 0, nullptr, nullptr}
};
if (us->data && us->datafree != gdiplus_freeimage) {
us->datafree(us); /* free incompatible cache data */
- us->data = NULL;
- us->datafree = NULL;
+ us->data = nullptr;
+ us->datafree = nullptr;
}
if (!us->data) { /* read file into cache */
if (!gvusershape_file_access(us))
- return NULL;
+ return nullptr;
/* create image from the usershape file */
/* NOTE: since Image::FromStream consumes the stream, we assume FileStream's lifetime should be shorter than us->name and us->f... */
};
gvplugin_installed_t gvloadimage_gdiplus_types[] = {
- {FORMAT_BMP, "bmp:gdiplus", 8, &engine, NULL},
- {FORMAT_GIF, "gif:gdiplus", 8, &engine, NULL},
- {FORMAT_JPEG, "jpe:gdiplus", 8, &engine, NULL},
- {FORMAT_JPEG, "jpeg:gdiplus", 8, &engine, NULL},
- {FORMAT_JPEG, "jpg:gdiplus", 8, &engine, NULL},
- {FORMAT_PNG, "png:gdiplus", 8, &engine, NULL},
- {0, NULL, 0, NULL, NULL}
+ {FORMAT_BMP, "bmp:gdiplus", 8, &engine, nullptr},
+ {FORMAT_GIF, "gif:gdiplus", 8, &engine, nullptr},
+ {FORMAT_JPEG, "jpe:gdiplus", 8, &engine, nullptr},
+ {FORMAT_JPEG, "jpeg:gdiplus", 8, &engine, nullptr},
+ {FORMAT_JPEG, "jpg:gdiplus", 8, &engine, nullptr},
+ {FORMAT_PNG, "png:gdiplus", 8, &engine, nullptr},
+ {0, nullptr, 0, nullptr, nullptr}
};
ImageFormatTIFF
};
-static ULONG_PTR _gdiplusToken = NULL;
+static ULONG_PTR _gdiplusToken = 0;
static void UnuseGdiplus()
{
if (!_gdiplusToken)
{
GdiplusStartupInput input;
- GdiplusStartup(&_gdiplusToken, &input, NULL);
+ GdiplusStartup(&_gdiplusToken, &input, nullptr);
atexit(&UnuseGdiplus);
}
}
/* search the encoders for one that matches our device id, then save the bitmap there */
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
- GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+ GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, nullptr);
UINT encoderNum;
UINT encoderSize;
GetImageEncodersSize(&encoderNum, &encoderSize);
GetImageEncoders(encoderNum, encoderSize, codecs);
for (UINT i = 0; i < encoderNum; ++i)
if (memcmp(&(format_id[format]), &codecs[i].FormatID, sizeof(GUID)) == 0) {
- bitmap.Save(stream, &codecs[i].Clsid, NULL);
+ bitmap.Save(stream, &codecs[i].Clsid, nullptr);
break;
}
}
HWND hwnd;
HDC hdc;
- DeviceContext(HWND wnd = NULL): hwnd(wnd), hdc(GetDC(wnd))
+ DeviceContext(HWND wnd = nullptr): hwnd(wnd), hdc(GetDC(wnd))
{
}
{
UseGdiplus();
if (!job->external_context)
- job->context = NULL;
+ job->context = nullptr;
else if (job->device.id == FORMAT_METAFILE)
{
/* save the passed-in context in the window field, so we can create a Metafile in the context field later on */
job->window = job->context;
auto m = reinterpret_cast<Metafile**>(job->window);
- *m = NULL;
- job->context = NULL;
+ *m = nullptr;
+ job->context = nullptr;
}
}
/* blast the streamed buffer back to the gvdevice */
/* NOTE: this is somewhat inefficient since we should be streaming directly to gvdevice rather than buffering first */
/* ... however, GDI+ requires any such direct IStream to implement Seek Read, Write, Stat methods and gvdevice really only offers a write-once model */
- HGLOBAL buffer = NULL;
+ HGLOBAL buffer = nullptr;
GetHGlobalFromStream(stream, &buffer);
stream->Release();
gvwrite(job, (unsigned char*)GlobalLock(buffer), GlobalSize(buffer));
if (!job->external_context) {
/* allocate memory and attach stream to it */
HGLOBAL buffer = GlobalAlloc(GMEM_MOVEABLE, 0);
- IStream *stream = NULL;
+ IStream *stream = nullptr;
CreateStreamOnHGlobal(buffer, FALSE, &stream); /* FALSE means don't deallocate buffer when releasing stream */
Image *image;
static gvrender_features_t render_features_gdiplus = {
GVRENDER_Y_GOES_DOWN | GVRENDER_DOES_TRANSFORM, /* flags */
4., /* default pad - graph units */
- NULL, /* knowncolors */
+ nullptr, /* knowncolors */
0, /* sizeof knowncolors */
RGBA_BYTE /* color_type */
};
gvplugin_installed_t gvrender_gdiplus_types[] = {
{0, "gdiplus", 1, &gdiplusgen_engine, &render_features_gdiplus},
- {0, NULL, 0, NULL, NULL}
+ {0, nullptr, 0, nullptr, nullptr}
};
gvplugin_installed_t gvdevice_gdiplus_types[] = {
- {FORMAT_METAFILE, "metafile:gdiplus", 8, NULL, &device_features_gdiplus_emf},
- {FORMAT_BMP, "bmp:gdiplus", 8, NULL, &device_features_gdiplus},
- {FORMAT_EMF, "emf:gdiplus", 8, NULL, &device_features_gdiplus_emf},
- {FORMAT_EMFPLUS, "emfplus:gdiplus", 8, NULL, &device_features_gdiplus_emf},
- {FORMAT_GIF, "gif:gdiplus", 8, NULL, &device_features_gdiplus},
- {FORMAT_JPEG, "jpe:gdiplus", 8, NULL, &device_features_gdiplus},
- {FORMAT_JPEG, "jpeg:gdiplus", 8, NULL, &device_features_gdiplus},
- {FORMAT_JPEG, "jpg:gdiplus", 8, NULL, &device_features_gdiplus},
- {FORMAT_PNG, "png:gdiplus", 8, NULL, &device_features_gdiplus},
- {FORMAT_TIFF, "tif:gdiplus", 8, NULL, &device_features_gdiplus},
- {FORMAT_TIFF, "tiff:gdiplus", 8, NULL, &device_features_gdiplus},
- {0, NULL, 0, NULL, NULL}
+ {FORMAT_METAFILE, "metafile:gdiplus", 8, nullptr, &device_features_gdiplus_emf},
+ {FORMAT_BMP, "bmp:gdiplus", 8, nullptr, &device_features_gdiplus},
+ {FORMAT_EMF, "emf:gdiplus", 8, nullptr, &device_features_gdiplus_emf},
+ {FORMAT_EMFPLUS, "emfplus:gdiplus", 8, nullptr, &device_features_gdiplus_emf},
+ {FORMAT_GIF, "gif:gdiplus", 8, nullptr, &device_features_gdiplus},
+ {FORMAT_JPEG, "jpe:gdiplus", 8, nullptr, &device_features_gdiplus},
+ {FORMAT_JPEG, "jpeg:gdiplus", 8, nullptr, &device_features_gdiplus},
+ {FORMAT_JPEG, "jpg:gdiplus", 8, nullptr, &device_features_gdiplus},
+ {FORMAT_PNG, "png:gdiplus", 8, nullptr, &device_features_gdiplus},
+ {FORMAT_TIFF, "tif:gdiplus", 8, nullptr, &device_features_gdiplus},
+ {FORMAT_TIFF, "tiff:gdiplus", 8, nullptr, &device_features_gdiplus},
+ {0, nullptr, 0, nullptr, nullptr}
};
};
gvplugin_installed_t gvtextlayout_gdiplus_types[] = {
- {0, "textlayout", 8, &gdiplus_textlayout_engine, NULL},
- {0, NULL, 0, NULL, NULL}
+ {0, "textlayout", 8, &gdiplus_textlayout_engine, nullptr},
+ {0, nullptr, 0, nullptr, nullptr}
};