From d1192bcc5436ea4c57b3317a1951060bdd9d4215 Mon Sep 17 00:00:00 2001 From: "sanjeevr@chromium.org" Date: Thu, 11 Mar 2010 21:38:30 +0000 Subject: Added functions to the Pepper interface to allow plugins to participate in the browser's print workflow. For now, added an interface for raster print output. Also modified vector_platform_device_win.cc to allow the caller to set a bitmap compression mode for use in the internalDrawBitmap method. Supported compression modes are JPEG and PNG. BUG=none TEST=Test printing with new plugins that support this interface. Review URL: http://codereview.chromium.org/669280 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41321 0039d316-1c4b-4281-b951-d872f2087c98 --- third_party/npapi/bindings/npapi_extensions.h | 58 ++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) (limited to 'third_party') diff --git a/third_party/npapi/bindings/npapi_extensions.h b/third_party/npapi/bindings/npapi_extensions.h index 1f18a10..4c22ff0 100644 --- a/third_party/npapi/bindings/npapi_extensions.h +++ b/third_party/npapi/bindings/npapi_extensions.h @@ -11,11 +11,17 @@ #include "npapi.h" /* - * A fake "enum" value for getting Pepper extensions. + * A fake "enum" value for getting browser-implemented Pepper extensions. * The variable returns a pointer to an NPPepperExtensions structure */ #define NPNVPepperExtensions ((NPNVariable) 4000) +/* + * A fake "enum" value for getting plugin-implemented Pepper extensions. + * The variable returns a pointer to an NPPPepperExtensions structure + */ +#define NPPVPepperExtensions ((NPPVariable) 4001) + typedef void NPDeviceConfig; typedef void NPDeviceContext; typedef void NPUserData; @@ -482,4 +488,54 @@ struct _NPDeviceContextAudio { void *reserved; }; +/* Printing related APIs ---------------------------------------------------*/ + +/* Being a print operation. Returns the total number of pages to print at the + * given printableArea size and DPI. printableArea is in points (a point is 1/72 + * of an inch). */ +typedef NPError (*NPPPrintBeginPtr) ( + NPP instance, + NPRect* printableArea, + int32 printerDPI, + int32* numPages); +/* Returns the required raster dimensions for the given printableArea + * size and DPI. printableArea is in points (a point is 1/72 of an inch). */ +typedef NPError (*NPPGetRasterDimensionsPtr) ( + NPP instance, + NPRect* printableArea, + int32 printerDPI, + int32* widthInPixels, + int32* heightInPixels); +/* Prints the specified page on the given printableArea size and DPI. + * printableArea is in points (a point is 1/72 of an inch). This allows the + * plugin to print a raster output*/ +typedef NPError (*NPPPrintPageRasterPtr) ( + NPP instance, + int32 pageNumber, + NPRect* printableArea, + int32 printerDPI, + NPDeviceContext2D* printSurface); + +/* Ends the print operation */ +typedef NPError (*NPPPrintEndPtr) (NPP instance); + +/* TODO(sanjeevr) : Provide a vector interface for printing. We need to decide + * on a vector format that can support embedded fonts. A vector format will + * greatly reduce the size of the required output buffer +*/ + +typedef struct _NPPPrintExtensions { + NPPPrintBeginPtr printBegin; + NPPGetRasterDimensionsPtr getRasterDimensions; + NPPPrintPageRasterPtr printPageRaster; + NPPPrintEndPtr printEnd; +} NPPPrintExtensions; + +/* Returns NULL if the plugin does not support print extensions */ +typedef NPPPrintExtensions* (*NPPGetPrintExtensionsPtr)(NPP instance); + +typedef struct _NPPExtensions { + NPPGetPrintExtensionsPtr getPrintExtensions; +} NPPExtensions; + #endif /* _NP_EXTENSIONS_H_ */ -- cgit v1.1