Skip to content

Commit d41f751

Browse files
committed
8247370: Clean up unused printing code in awt_PrintJob.cpp
Reviewed-by: serb, psadhukhan
1 parent b49c589 commit d41f751

File tree

1 file changed

+9
-28
lines changed

1 file changed

+9
-28
lines changed

src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,7 @@ static void pageFormatToSetup(JNIEnv *env, jobject job, jobject page,
261261
static WORD getOrientationFromDevMode2(HGLOBAL hDevMode);
262262
static WORD getOrientationFromDevMode(JNIEnv *env, jobject self);
263263
static void setOrientationInDevMode(HGLOBAL hDevMode, jboolean isPortrait);
264-
static void doPrintBand(JNIEnv *env, jboolean browserPrinting,
265-
HDC printDC, jbyteArray imageArray,
264+
static void doPrintBand(JNIEnv *env, HDC printDC, jbyteArray imageArray,
266265
jint x, jint y, jint width, jint height);
267266
static int bitsToDevice(HDC printDC, jbyte *image, long destX, long destY,
268267
long width, long height);
@@ -1803,7 +1802,7 @@ JNIEXPORT void JNICALL Java_sun_awt_windows_WPrinterJob_printBand
18031802
jint width, jint height) {
18041803

18051804
HDC printDC = AwtPrintControl::getPrintDC(env, self);
1806-
doPrintBand(env, JNI_FALSE, printDC, imageArray, x, y, width, height);
1805+
doPrintBand(env, printDC, imageArray, x, y, width, height);
18071806
}
18081807

18091808
/*
@@ -2904,14 +2903,10 @@ JNIEXPORT void JNICALL Java_sun_awt_windows_WPrinterJob_drawDIBImage
29042903
}
29052904

29062905
/*
2907-
* An utility function to print passed image byte array to
2908-
* the printDC.
2909-
* browserPrinting flag controls whether the image array
2910-
* used as top-down (browserPrinting == JNI_TRUE) or
2911-
* bottom-up (browserPrinting == JNI_FALSE) DIB.
2906+
* A utility function to print passed image byte array to the printDC.
2907+
* Prints as a bottom-up DIB.
29122908
*/
2913-
static void doPrintBand(JNIEnv *env, jboolean browserPrinting,
2914-
HDC printDC, jbyteArray imageArray,
2909+
static void doPrintBand(JNIEnv *env, HDC printDC, jbyteArray imageArray,
29152910
jint x, jint y, jint width, jint height) {
29162911

29172912
TRY;
@@ -2926,15 +2921,9 @@ static void doPrintBand(JNIEnv *env, jboolean browserPrinting,
29262921
long startY = 0;
29272922
long numLines = 0;
29282923

2929-
if (browserPrinting) {
2930-
/* for browser printing use top-down approach */
2931-
startImage = image;
2932-
} else {
2933-
/* when printing to a real printer dc, the dib
2934-
should bottom-up */
2935-
startImage = image + (scanLineStride * (height - 1));
2936-
scanLineStride = -scanLineStride;
2937-
}
2924+
/* when printing to a real printer dc, the dib should be bottom-up */
2925+
startImage = image + (scanLineStride * (height - 1));
2926+
scanLineStride = -scanLineStride;
29382927
do {
29392928
startImage = findNonWhite(startImage, startY, width, height,
29402929
scanLineStride, &numLines);
@@ -2943,15 +2932,7 @@ static void doPrintBand(JNIEnv *env, jboolean browserPrinting,
29432932
startY += numLines;
29442933
endImage = findWhite(startImage, startY, width, height,
29452934
scanLineStride, &numLines);
2946-
if (browserPrinting) {
2947-
/* passing -numLines as height to indicate that
2948-
we treat the image as a top-down DIB */
2949-
bitsToDevice(printDC, startImage, x, y + startY, width,
2950-
-numLines);
2951-
} else {
2952-
bitsToDevice(printDC, endImage, x, y + startY, width,
2953-
numLines);
2954-
}
2935+
bitsToDevice(printDC, endImage, x, y + startY, width, numLines);
29552936
startImage = endImage + scanLineStride;
29562937
startY += numLines;
29572938
}

0 commit comments

Comments
 (0)