fix for #84300. print images at printer resolution not screen resolution.

This commit is contained in:
pnunn 1998-05-28 18:53:31 +00:00
Родитель 7382386b4f
Коммит b705de4a3c
14 изменённых файлов: 149 добавлений и 73 удалений

Просмотреть файл

@ -1071,10 +1071,12 @@ BOOL CDCCX::ResolveElement(LTRB& Rect, LO_FormElementStruct *pFormElement) {
BOOL CDCCX::ResolveElement(LTRB& Rect, NI_Pixmap *pImage, int32 lX, int32 lY,
int32 orgx, int32 orgy,
uint32 ulWidth, uint32 ulHeight)
uint32 ulWidth, uint32 ulHeight,
int32 lScaleWidth, int32 lScaleHeight)
{
BOOL bRetval = TRUE;
/* Use the size of the image if size not provided. */
if(ulWidth == 0) {
ulWidth = pImage->header.width;
}
@ -1082,6 +1084,17 @@ BOOL CDCCX::ResolveElement(LTRB& Rect, NI_Pixmap *pImage, int32 lX, int32 lY,
if(ulHeight == 0) {
ulHeight = pImage->header.height;
}
/* Scaled size overrides further if this is a print context.*/
if(IsPrintContext()) {
if(lScaleWidth) {
ulWidth = (uint32)lScaleWidth;
}
if(lScaleHeight) {
ulHeight = (uint32)lScaleHeight;
}
}
Rect.left = orgx + lX - m_lOrgX;
Rect.top = orgy + lY - m_lOrgY;
@ -2175,22 +2188,42 @@ void CDCCX::DisplayIcon(int32 x0, int32 y0, int icon_number)
hBitmap = LOADBITMAP(bitmapID);
if(maskID)
mask = LOADBITMAP(maskID);
HBITMAP hOldBitmap = NULL;
HBITMAP hOldBitmap = NULL;
if(maskID) {
// load the mask out of the resource file
StretchMaskBlt(hdc, hBitmap, mask,
Rect.left, Rect.top, width, height,
0, 0, x, y);
if(maskID) {
if (IsPrintContext()) {
HBITMAP hOldBitmap = (HBITMAP)::SelectObject(m_pImageDC, hBitmap);
// filled in the background color for transparent bitmap.
AlterBackgroundColor(m_pImageDC, x, y, mask,
(HBRUSH)::GetStockObject(WHITE_BRUSH));
::StretchBlt(hdc,
CASTINT(Rect.left),
CASTINT(Rect.top),
CASTINT(width),
CASTINT(height),
m_pImageDC,
CASTINT(0),
CASTINT(0),
CASTINT(x),
CASTINT(y),
SRCCOPY);
::SelectObject(m_pImageDC, hOldBitmap);
}
else {
// load the mask out of the resource file
StretchMaskBlt(hdc, hBitmap, mask,
Rect.left, Rect.top, width, height,
0, 0, x, y);
}
VERIFY(::DeleteObject(mask));
}
}
else {
// load the bitmap into the cached image CDC
hOldBitmap = (HBITMAP) ::SelectObject(m_pImageDC, hBitmap);
::StretchBlt(hdc,
CASTINT(Rect.left),
CASTINT(Rect.left),
CASTINT(Rect.top),
CASTINT(width),
CASTINT(height),

Просмотреть файл

@ -409,7 +409,9 @@ public:
public:
virtual BOOL ResolveElement(LTRB& Rect, NI_Pixmap *pImage, int32 lX, int32 lY,
int32 orgx, int32 orgy,
uint32 ulWidth, uint32 ulHeight);
uint32 ulWidth, uint32 ulHeight,
int32 lScaleWidth, int32 lScaleHeight);
virtual BOOL ResolveElement(LTRB& Rect, int32 x, int32 y, int32 x_offset, int32 y_offset,
int32 width, int32 height);
virtual BOOL ResolveElement(LTRB& Rect, LO_SubDocStruct *pSubDoc, int iLocation);
@ -684,7 +686,7 @@ public:
virtual void DisplayBorder(MWContext *pContext, int iLocation, int x, int y, int width, int height, int bw, LO_Color *color, LO_LineStyle style);
virtual void DisplayHR(MWContext *pContext, int iLocation, LO_HorizRuleStruct *pHorizRule);
virtual BITMAPINFO* NewPixmap(NI_Pixmap* pImage, BOOL mask = FALSE);
virtual int DisplayPixmap(NI_Pixmap* image, NI_Pixmap* mask, int32 x, int32 y, int32 x_offset, int32 y_offset, int32 width, int32 height, LTRB& Rect);
virtual int DisplayPixmap(NI_Pixmap* image, NI_Pixmap* mask, int32 x, int32 y, int32 x_offset, int32 y_offset, int32 width, int32 height, int32 lScaleWidth, int32 lScaleHeight, LTRB& Rect);
virtual void DisplayLineFeed(MWContext *pContext, int iLocation, LO_LinefeedStruct *pLineFeed, XP_Bool clear);
virtual void DisplaySubDoc(MWContext *pContext, int iLocation, LO_SubDocStruct *pSubDoc);
virtual void DisplayCell(MWContext *pContext, int iLocation, LO_CellStruct *pCell);

Просмотреть файл

@ -1297,7 +1297,7 @@ HBITMAP CDCCX::CreateBitmap(HDC hTargetDC, NI_Pixmap *image)
}
int CDCCX::DisplayPixmap(NI_Pixmap* image, NI_Pixmap* mask, int32 x, int32 y, int32 x_offset, int32 y_offset, int32 width, int32 height, LTRB& Rect)
int CDCCX::DisplayPixmap(NI_Pixmap* image, NI_Pixmap* mask, int32 x, int32 y, int32 x_offset, int32 y_offset, int32 width, int32 height, int32 lScaleWidth, int32 lScaleHeight, LTRB& Rect)
{
// If width and height are 0, then we assume the entire width and height.
// x and y are relative coords to the top left of the image.
@ -1318,7 +1318,8 @@ int CDCCX::DisplayPixmap(NI_Pixmap* image, NI_Pixmap* mask, int32 x, int32 y, in
yRepeat = (CASTINT(height) + CASTINT(y_offset) + CASTINT(imageInfo->targetHeight) -1) / CASTINT(imageInfo->targetHeight);
if (!ResolveElement(Rect, image, x_offset * m_lConvertX, y_offset *m_lConvertY,
x * m_lConvertX, y* m_lConvertY,
width* m_lConvertX, height* m_lConvertY))
width* m_lConvertX, height* m_lConvertY,
lScaleWidth * m_lConvertX, lScaleHeight * m_lConvertY))
return FALSE;
SafeSixteen(Rect);

Просмотреть файл

@ -768,10 +768,11 @@ BOOL CPrintCX::ResolveElement(LTRB& Rect, int32 x, int32 y, int32 x_offset, int3
BOOL CPrintCX::ResolveElement(LTRB& Rect, NI_Pixmap *pImage, int32 lX, int32 lY,
int32 orgx, int32 orgy,
uint32 ulWidth, uint32 ulHeight)
uint32 ulWidth, uint32 ulHeight,
int32 lScaleWidth, int32 lScaleHeight)
{
// Call the base first.
CDCCX::ResolveElement(Rect, pImage, lX, lY, orgx, orgy, ulWidth, ulHeight);
CDCCX::ResolveElement(Rect, pImage, lX, lY, orgx, orgy, ulWidth, ulHeight, lScaleWidth,lScaleHeight);
return AdjustRect(Rect);
}
@ -1920,7 +1921,7 @@ BOOL CPrintCX::IsDeviceDC()
}
#ifdef XP_WIN32
void CPrintCX::CopyOffscreenBitmap(NI_Pixmap* image, int32 x, int32 y, int32 x_offset, int32 y_offset, int32 width, int32 height, LTRB& Rect)
void CPrintCX::CopyOffscreenBitmap(NI_Pixmap* image, int32 x, int32 y, int32 x_offset, int32 y_offset, int32 width, int32 height, int32 lScaleWidth, int32 lScaleHeight, LTRB& Rect)
{
LTRB sourceRect(Rect);
ResolveElement(Rect, image,
@ -1928,7 +1929,10 @@ void CPrintCX::CopyOffscreenBitmap(NI_Pixmap* image, int32 x, int32 y, int32 x_o
y_offset* m_lConvertY,
x * m_lConvertX, y* m_lConvertY,
width * m_lConvertX,
height* m_lConvertY);
height* m_lConvertY,
lScaleWidth * m_lConvertX,
lScaleHeight * m_lConvertY);
WORD nBitCount;
nBitCount = GetBitsPerPixel();
int nColorTable;
@ -2012,8 +2016,31 @@ void CPrintCX::CopyOffscreenBitmap(NI_Pixmap* image, int32 x, int32 y, int32 x_o
}
#endif
int CPrintCX::DisplayPixmap(NI_Pixmap* image, NI_Pixmap* mask, int32 x, int32 y, int32 x_offset, int32 y_offset, int32 width, int32 height, LTRB& Rect)
int CPrintCX::DisplayPixmap(NI_Pixmap* image, NI_Pixmap* mask, int32 x, int32 y, int32 x_offset, int32 y_offset, int32 width, int32 height, int32 lScaleWidth, int32 lScaleHeight, LTRB& Rect)
{
// Figure out the width and height we will want to display on the screen.
// This is not a one to one with the width and height of the image,
// especially in scaling cases.
int32 lDisplayWidth;
int32 lDisplayHeight;
if((!lScaleWidth)&&(!lScaleHeight)){
lDisplayWidth = width;
lDisplayHeight = height;
}else{
if(lScaleWidth)
lDisplayWidth = lScaleWidth;
else
lDisplayWidth = (int32) width * (((float) lScaleHeight)/height );
if(lScaleHeight)
lDisplayHeight = lScaleHeight;
else
lDisplayHeight = (int32) height * (((float) lScaleWidth)/width );
}
// LTRB Rect;
if (GetDisplayMode() == BLOCK_DISPLAY)
return FALSE;
@ -2039,12 +2066,14 @@ int CPrintCX::DisplayPixmap(NI_Pixmap* image, NI_Pixmap* mask, int32 x, int32 y
x_offset, y_offset,
(imageInfo->width > width) ? imageInfo->width : width,
(imageInfo->height > height) ? imageInfo->height : height,
lScaleWidth,
lScaleHeight,
Rect);
RestorePrintDC();
}
if (mask && m_printBk && !IsPrintPreview()) {
CopyOffscreenBitmap(image, x, y, x_offset, y_offset, width, height, Rect);
CopyOffscreenBitmap(image, x, y, x_offset, y_offset, width, height, lScaleWidth, lScaleHeight, Rect);
}
else
CDCCX::DisplayPixmap(image, mask,
@ -2052,6 +2081,7 @@ int CPrintCX::DisplayPixmap(NI_Pixmap* image, NI_Pixmap* mask, int32 x, int32 y
x_offset, y_offset,
(imageInfo->width > width) ? imageInfo->width : width,
(imageInfo->height > height) ? imageInfo->height : height,
lDisplayWidth, lDisplayHeight,
Rect);
#else
if (ResolveElement(Rect, image,
@ -2059,10 +2089,13 @@ int CPrintCX::DisplayPixmap(NI_Pixmap* image, NI_Pixmap* mask, int32 x, int32 y
(y_offset * m_lConvertY),
x, y,
(width * m_lConvertX),
(height * m_lConvertY))) {
(height * m_lConvertY),
lScaleWidth * m_lConvertX,
lScaleHeight * m_lConvertY) {
if (IsPrintPreview())
CDCCX::DisplayPixmap(image, mask, x, y, x_offset,
y_offset, width, height, Rect);
y_offset, width, height,
lScaleWidth, lScaleHeight, Rect);
else {
StretchPixmap(GetContextDC(), image,
Rect.left,

Просмотреть файл

@ -201,7 +201,8 @@ public:
int32 width, int32 height);
virtual BOOL ResolveElement(LTRB& Rect, NI_Pixmap *pImage, int32 lX, int32 lY,
int32 orgx, int32 orgy,
uint32 ulWidth, uint32 ulHeight);
uint32 ulWidth, uint32 ulHeight,
int32 lScaleWidth, int32 lScaleHeight);
virtual BOOL ResolveElement(LTRB& Rect, LO_EmbedStruct *pEmbed, int iLocation, Bool bWindowed);
virtual BOOL ResolveElement(LTRB& Rect, LO_FormElementStruct *pFormElement);
virtual COLORREF ResolveTextColor(LO_TextAttr *pAttr);
@ -253,7 +254,7 @@ public:
virtual void DisplayEmbed(MWContext *pContext, int iLocation, LO_EmbedStruct *pEmbed);
virtual void DisplayFormElement(MWContext *pContext, int iLocation, LO_FormElementStruct *pFormElement);
virtual void DisplayHR(MWContext *pContext, int iLocation, LO_HorizRuleStruct *pHorizRule);
virtual int DisplayPixmap(NI_Pixmap* image, NI_Pixmap* mask, int32 x, int32 y, int32 x_offset, int32 y_offset, int32 width, int32 height, LTRB& Rect);
virtual int DisplayPixmap(NI_Pixmap* image, NI_Pixmap* mask, int32 x, int32 y, int32 x_offset, int32 y_offset, int32 width, int32 height, int32 lScaleWidth, int32 lScaleHeight, LTRB& Rect);
virtual void DisplayLineFeed(MWContext *pContext, int iLocation, LO_LinefeedStruct *pLineFeed, XP_Bool clear);
virtual void DisplaySubDoc(MWContext *pContext, int iLocation, LO_SubDocStruct *pSubDoc);
virtual void DisplayCell(MWContext *pContext, int iLocation, LO_CellStruct *pCell);
@ -263,7 +264,7 @@ public:
virtual void DisplayPlugin(MWContext *pContext, LO_EmbedStruct *pEmbed, NPEmbeddedApp* pEmbeddedApp, int iLocation);
virtual void DisplayWindowlessPlugin(MWContext *pContext, LO_EmbedStruct *pEmbed, NPEmbeddedApp *pEmbeddedApp, int iLocation);
#ifdef XP_WIN32
void CopyOffscreenBitmap(NI_Pixmap* image, int32 x, int32 y, int32 x_offset, int32 y_offset, int32 width, int32 height, LTRB& Rect);
void CopyOffscreenBitmap(NI_Pixmap* image, int32 x, int32 y, int32 x_offset, int32 y_offset, int32 width, int32 height, int32 lScaleWidth, int32 lScaleHeight, LTRB& Rect);
#endif
// Layout initialization respecting page size.
virtual void LayoutNewDocument(MWContext *pContext, URL_Struct *pURL, int32 *pWidth, int32 *pHeight, int32 *pmWidth, int32 *pmHeight);

Просмотреть файл

@ -3782,7 +3782,7 @@ CNSToolTip* CWinCX::CreateToolTip(LO_ImageStruct* pImage, CPoint& cpPoint, CL_La
// Layout wants this in pixels, not FE units.
LTRB Rect;
ResolveElement(Rect, IL_GetImagePixmap(pImage->image_req), pImage->x_offset, pImage->y_offset,
pImage->x, pImage->y, pImage->width, pImage->height);
pImage->x, pImage->y, pImage->width, pImage->height, 0, 0);
CPoint cpMap((int) (cpPoint.x - Twips2PixX(Rect.left)),
(int) (cpPoint.y - Twips2PixY(Rect.top)));
char* alt_text;
@ -6772,7 +6772,7 @@ void CWinCX::invalidateElement( LO_Element *pElement )
ResolveElement(Rect, IL_GetImagePixmap(pImage->image_req),
pImage->x_offset + pImage->border_width,
pImage->y_offset + pImage->border_width,
pImage->x, pImage->y, pImage->width, pImage->height);
pImage->x, pImage->y, pImage->width, pImage->height, 0, 0);
rectEmpty = FALSE;
break;

Просмотреть файл

@ -133,12 +133,13 @@ _IMGCB_DestroyPixmap(struct IMGCB* self, jint op, void* displayContext, IL_Pixma
JMC_PUBLIC_API(void)
_IMGCB_DisplayPixmap(struct IMGCB* self, jint op, void* displayContext, IL_Pixmap* image, IL_Pixmap* mask,
jint x, jint y, jint x_offset, jint y_offset, jint width, jint height)
jint x, jint y, jint x_offset, jint y_offset, jint width, jint height,
jint scalewidth, jint scaleheight)
{
MWContext *pContext = (MWContext *)displayContext;
CDCCX *dispCxt = (CDCCX *) pContext->fe.cx;
LTRB Rect;
dispCxt->DisplayPixmap( image, mask, x, y, x_offset, y_offset, width, height, Rect);
dispCxt->DisplayPixmap( image, mask, x, y, x_offset, y_offset, width, height, scalewidth, scaleheight, Rect);
}
JMC_PUBLIC_API(void)

Просмотреть файл

@ -3128,8 +3128,12 @@ void lo_GetImage(MWContext *context, IL_GroupContext *img_cx,
/* Create a dummy Net Context for the Image Library to use for network
operations. This will be replaced by a true Net Context when the
Network Library is modularized. */
reload_method =
net_request_allowed ? requested_reload_method : NET_CACHE_ONLY_RELOAD;
if(context->type != MWContextPrint){
reload_method = net_request_allowed ? requested_reload_method : NET_CACHE_ONLY_RELOAD;
}else{
reload_method = NET_NORMAL_RELOAD;
}
net_cx = IL_NewDummyNetContext(context, reload_method);
/* Determine whether to request a mask if this is a transparent image.

Просмотреть файл

@ -1,21 +1,3 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
package netscape.libimg;
import netscape.jmc.*;
@ -55,7 +37,7 @@ public interface IMGCBIF {
public void
NewPixmap(CType display_context, int width, int height,
ILPix_t image, ILPix_t mask);
ILPix_t image, ILPix_t mask);
/* Inform the front-end that the specified rectangular portion of the
@ -68,7 +50,7 @@ public interface IMGCBIF {
public void
UpdatePixmap(CType display_context, ILPix_t pixmap,
int x_offset, int y_offset, int width, int height);
int x_offset, int y_offset, int width, int height);
/* Informs the callee that the imagelib has acquired or relinquished control
@ -91,7 +73,7 @@ public interface IMGCBIF {
public void
ControlPixmapBits(CType display_context, ILPix_t pixmap,
ILPixCtl message);
ILPixCtl message);
/* Release the memory storage and other resources associated with an image
@ -104,7 +86,7 @@ public interface IMGCBIF {
/* Render a rectangular portion of the given pixmap.
Render the image using transparency if mask is non-NULL.
x and y are measured in pixels and are in document coordinates.
x_offset and y_offset are with respect to the image origin.
@ -121,9 +103,9 @@ public interface IMGCBIF {
public void
DisplayPixmap(CType display_context,
ILPix_t image, ILPix_t mask,
int x, int y, int x_offset, int y_offset,
int width, int height);
ILPix_t image, ILPix_t mask,
int x, int y, int x_offset, int y_offset,
int width, int height, int req_w, int req_h );
/* These are the icon display functions. It's not clear whether or
@ -142,5 +124,5 @@ public interface IMGCBIF {
public void
GetIconDimensions(CType display_context, int_t width, int_t height,
int icon_number);
int icon_number);
}

Просмотреть файл

@ -88,8 +88,8 @@ EXTERN_C const JMCInterfaceID IMGCB_ID = { 0x38775d44, 0x23525963, 0x7f763562, 0
#define IMGCB_DestroyPixmap(self, a, b) \
(((self)->vtable->DestroyPixmap)(self, IMGCB_DestroyPixmap_op, a, b))
#define IMGCB_DisplayPixmap(self, a, b, c, d, e, f, g, h, i) \
(((self)->vtable->DisplayPixmap)(self, IMGCB_DisplayPixmap_op, a, b, c, d, e, f, g, h, i))
#define IMGCB_DisplayPixmap(self, a, b, c, d, e, f, g, h, i, j, k) \
(((self)->vtable->DisplayPixmap)(self, IMGCB_DisplayPixmap_op, a, b, c, d, e, f, g, h, i, j, k))
#define IMGCB_DisplayIcon(self, a, b, c, d) \
(((self)->vtable->DisplayIcon)(self, IMGCB_DisplayIcon_op, a, b, c, d))
@ -121,7 +121,7 @@ struct IMGCBInterface {
void (*UpdatePixmap)(struct IMGCB* self, jint op, void* a, IL_Pixmap* b, jint c, jint d, jint e, jint f);
void (*ControlPixmapBits)(struct IMGCB* self, jint op, void* a, IL_Pixmap* b, IL_PixmapControl c);
void (*DestroyPixmap)(struct IMGCB* self, jint op, void* a, IL_Pixmap* b);
void (*DisplayPixmap)(struct IMGCB* self, jint op, void* a, IL_Pixmap* b, IL_Pixmap* c, jint d, jint e, jint f, jint g, jint h, jint i);
void (*DisplayPixmap)(struct IMGCB* self, jint op, void* a, IL_Pixmap* b, IL_Pixmap* c, jint d, jint e, jint f, jint g, jint h, jint i, jint j, jint k);
void (*DisplayIcon)(struct IMGCB* self, jint op, void* a, jint b, jint c, jint d);
void (*GetIconDimensions)(struct IMGCB* self, jint op, void* a, int* b, int* c, jint d);
};
@ -242,7 +242,7 @@ extern JMC_PUBLIC_API(void)
_IMGCB_DestroyPixmap(struct IMGCB* self, jint op, void* a, IL_Pixmap* b);
extern JMC_PUBLIC_API(void)
_IMGCB_DisplayPixmap(struct IMGCB* self, jint op, void* a, IL_Pixmap* b, IL_Pixmap* c, jint d, jint e, jint f, jint g, jint h, jint i);
_IMGCB_DisplayPixmap(struct IMGCB* self, jint op, void* a, IL_Pixmap* b, IL_Pixmap* c, jint d, jint e, jint f, jint g, jint h, jint i, jint j, jint k);
extern JMC_PUBLIC_API(void)
_IMGCB_DisplayIcon(struct IMGCB* self, jint op, void* a, jint b, jint c, jint d);

Просмотреть файл

@ -88,8 +88,8 @@ EXTERN_C const JMCInterfaceID IMGCBIF_ID = { 0x38775d44, 0x23525963, 0x7f763562,
#define IMGCBIF_DestroyPixmap(self, a, b) \
(((self)->vtable->DestroyPixmap)(self, IMGCBIF_DestroyPixmap_op, a, b))
#define IMGCBIF_DisplayPixmap(self, a, b, c, d, e, f, g, h, i) \
(((self)->vtable->DisplayPixmap)(self, IMGCBIF_DisplayPixmap_op, a, b, c, d, e, f, g, h, i))
#define IMGCBIF_DisplayPixmap(self, a, b, c, d, e, f, g, h, i, j, k) \
(((self)->vtable->DisplayPixmap)(self, IMGCBIF_DisplayPixmap_op, a, b, c, d, e, f, g, h, i, j, k))
#define IMGCBIF_DisplayIcon(self, a, b, c, d) \
(((self)->vtable->DisplayIcon)(self, IMGCBIF_DisplayIcon_op, a, b, c, d))
@ -121,7 +121,7 @@ struct IMGCBIFInterface {
void (*UpdatePixmap)(struct IMGCBIF* self, jint op, void* a, IL_Pixmap* b, jint c, jint d, jint e, jint f);
void (*ControlPixmapBits)(struct IMGCBIF* self, jint op, void* a, IL_Pixmap* b, IL_PixmapControl c);
void (*DestroyPixmap)(struct IMGCBIF* self, jint op, void* a, IL_Pixmap* b);
void (*DisplayPixmap)(struct IMGCBIF* self, jint op, void* a, IL_Pixmap* b, IL_Pixmap* c, jint d, jint e, jint f, jint g, jint h, jint i);
void (*DisplayPixmap)(struct IMGCBIF* self, jint op, void* a, IL_Pixmap* b, IL_Pixmap* c, jint d, jint e, jint f, jint g, jint h, jint i, jint j, jint k);
void (*DisplayIcon)(struct IMGCBIF* self, jint op, void* a, jint b, jint c, jint d);
void (*GetIconDimensions)(struct IMGCBIF* self, jint op, void* a, int* b, int* c, jint d);
};
@ -239,7 +239,7 @@ extern JMC_PUBLIC_API(void)
_IMGCBIF_DestroyPixmap(struct IMGCBIF* self, jint op, void* a, IL_Pixmap* b);
extern JMC_PUBLIC_API(void)
_IMGCBIF_DisplayPixmap(struct IMGCBIF* self, jint op, void* a, IL_Pixmap* b, IL_Pixmap* c, jint d, jint e, jint f, jint g, jint h, jint i);
_IMGCBIF_DisplayPixmap(struct IMGCBIF* self, jint op, void* a, IL_Pixmap* b, IL_Pixmap* c, jint d, jint e, jint f, jint g, jint h, jint i, jint j, jint k);
extern JMC_PUBLIC_API(void)
_IMGCBIF_DisplayIcon(struct IMGCBIF* self, jint op, void* a, jint b, jint c, jint d);

Просмотреть файл

@ -88,8 +88,8 @@ EXTERN_C const JMCInterfaceID PSIMGCB_ID = { 0x38775d44, 0x23525963, 0x7f763562,
#define PSIMGCB_DestroyPixmap(self, a, b) \
(((self)->vtable->DestroyPixmap)(self, PSIMGCB_DestroyPixmap_op, a, b))
#define PSIMGCB_DisplayPixmap(self, a, b, c, d, e, f, g, h, i) \
(((self)->vtable->DisplayPixmap)(self, PSIMGCB_DisplayPixmap_op, a, b, c, d, e, f, g, h, i))
#define PSIMGCB_DisplayPixmap(self, a, b, c, d, e, f, g, h, i, j, k) \
(((self)->vtable->DisplayPixmap)(self, PSIMGCB_DisplayPixmap_op, a, b, c, d, e, f, g, h, i, j, k))
#define PSIMGCB_DisplayIcon(self, a, b, c, d) \
(((self)->vtable->DisplayIcon)(self, PSIMGCB_DisplayIcon_op, a, b, c, d))
@ -121,7 +121,7 @@ struct PSIMGCBInterface {
void (*UpdatePixmap)(struct PSIMGCB* self, jint op, void* a, IL_Pixmap* b, jint c, jint d, jint e, jint f);
void (*ControlPixmapBits)(struct PSIMGCB* self, jint op, void* a, IL_Pixmap* b, IL_PixmapControl c);
void (*DestroyPixmap)(struct PSIMGCB* self, jint op, void* a, IL_Pixmap* b);
void (*DisplayPixmap)(struct PSIMGCB* self, jint op, void* a, IL_Pixmap* b, IL_Pixmap* c, jint d, jint e, jint f, jint g, jint h, jint i);
void (*DisplayPixmap)(struct PSIMGCB* self, jint op, void* a, IL_Pixmap* b, IL_Pixmap* c, jint d, jint e, jint f, jint g, jint h, jint i, jint j, jint k);
void (*DisplayIcon)(struct PSIMGCB* self, jint op, void* a, jint b, jint c, jint d);
void (*GetIconDimensions)(struct PSIMGCB* self, jint op, void* a, int* b, int* c, jint d);
};
@ -242,7 +242,7 @@ extern JMC_PUBLIC_API(void)
_PSIMGCB_DestroyPixmap(struct PSIMGCB* self, jint op, void* a, IL_Pixmap* b);
extern JMC_PUBLIC_API(void)
_PSIMGCB_DisplayPixmap(struct PSIMGCB* self, jint op, void* a, IL_Pixmap* b, IL_Pixmap* c, jint d, jint e, jint f, jint g, jint h, jint i);
_PSIMGCB_DisplayPixmap(struct PSIMGCB* self, jint op, void* a, IL_Pixmap* b, IL_Pixmap* c, jint d, jint e, jint f, jint g, jint h, jint i, jint j, jint k);
extern JMC_PUBLIC_API(void)
_PSIMGCB_DisplayIcon(struct PSIMGCB* self, jint op, void* a, jint b, jint c, jint d);

Просмотреть файл

@ -442,7 +442,8 @@ il_size(il_container *ic)
NI_PixmapHeader *src_header = ic->src_header; /* Source image header. */
NI_PixmapHeader *img_header = &ic->image->header; /* Destination image
header. */
uint32 req_w=0, req_h=0; /* store requested values for printing.*/
/* Get the dimensions of the source image. */
src_width = src_header->width;
src_height = src_header->height;
@ -459,6 +460,13 @@ il_size(il_container *ic)
if (ic->state == IC_MULTI)
return 0;
if(ic->display_type == IL_Printer){
req_w = ic->dest_width;
req_h = ic->dest_height;
ic->dest_width = 0; /*to decode natural size*/
ic->dest_height = 0;
}
/* For now, we don't allow an image to change output size on the
* fly, but we do allow the source image size to change, and thus
* we may need to change the scaling factor to fit it into the
@ -625,6 +633,11 @@ il_size(il_container *ic)
}
}
if((ic->display_type == IL_Printer)&& (req_w || req_h)){
ic->dest_width = req_w;
ic->dest_height = req_h;
}
return 0;
}
@ -2152,7 +2165,7 @@ IL_DisplaySubImage(IL_ImageReq *image_req, int x, int y, int x_offset,
if ((display_width > 0) && (display_height > 0))
IMGCBIF_DisplayPixmap(img_cx->img_cb, dpy_cx, ic->image, ic->mask,
x, y, display_left, display_top,
display_width, display_height);
display_width, display_height, ic->dest_width, ic->dest_height);
}
else {
/* The entire image pixmap is displayable, (although this does not
@ -2162,7 +2175,8 @@ IL_DisplaySubImage(IL_ImageReq *image_req, int x, int y, int x_offset,
be performed. */
if (width && height)
IMGCBIF_DisplayPixmap(img_cx->img_cb, dpy_cx, ic->image, ic->mask,
x, y, x_offset, y_offset, width, height);
x, y, x_offset, y_offset, width, height,
ic->dest_width, ic->dest_height);
}
}

Просмотреть файл

@ -20,7 +20,7 @@
* ilclient.c --- Management of imagelib client data structures,
* including image cache.
*
* $Id: ilclient.c,v 3.1 1998/03/28 03:35:02 ltabb Exp $
* $Id: ilclient.c,v 3.2 1998/05/28 18:48:00 pnunn Exp $
*/
@ -331,6 +331,11 @@ il_image_match(il_container *ic, /* Candidate for match. */
if (display_type != ic->display_type)
return FALSE;
if((ic->display_type==IL_Printer) &&
(ic->dest_width != ic->image->header.width) &&
(ic->dest_height != ic->image->header.height ))
return FALSE;
/* XXX - temporary */
if (ic->rendered_with_custom_palette)
return FALSE;