jdk/src/windows/native/sun/java2d/windows/GDIBlitLoops.cpp
author ohair
Wed, 06 Apr 2011 22:06:11 -0700
changeset 9035 1255eb81cc2f
parent 8359 b2e3eb2cc841
child 18232 b538b71fb429
permissions -rw-r--r--
7033660: Update copyright year to 2011 on any files changed in 2011 Reviewed-by: dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
9035
1255eb81cc2f 7033660: Update copyright year to 2011 on any files changed in 2011
ohair
parents: 8359
diff changeset
     2
 * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1954
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1954
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1954
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1954
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1954
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
1954
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 888
diff changeset
    26
#include "awt.h"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#include <sun_java2d_windows_GDIBlitLoops.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#include "gdefs.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include "Trace.h"
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    30
#include "GDIWindowSurfaceData.h"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
static RGBQUAD *byteGrayPalette = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
extern "C" {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
typedef struct tagBitmapheader  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
    BITMAPINFOHEADER bmiHeader;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
    union {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
        DWORD           dwMasks[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
        RGBQUAD         palette[256];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
    } colors;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
} BmiType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * Class:     sun_java2d_windows_GDIBlitLoops
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * Method:    nativeBlit
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * Signature: (Lsun/java2d/SurfaceData;Lsun/java2d/SurfaceData;IIIIIIZ)V
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
Java_sun_java2d_windows_GDIBlitLoops_nativeBlit
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    (JNIEnv *env, jobject joSelf,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     jobject srcData, jobject dstData,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     jobject clip,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     jint srcx, jint srcy,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     jint dstx, jint dsty,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     jint width, jint height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     jint rmask, jint gmask, jint bmask,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     jboolean needLut)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    J2dTraceLn(J2D_TRACE_INFO, "GDIBlitLoops_nativeBlit");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    SurfaceDataRasInfo srcInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    SurfaceDataOps *srcOps = SurfaceData_GetOps(env, srcData);
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    64
    GDIWinSDOps *dstOps = GDIWindowSurfaceData_GetOps(env, dstData);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    jint lockFlags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    srcInfo.bounds.x1 = srcx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    srcInfo.bounds.y1 = srcy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    srcInfo.bounds.x2 = srcx + width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    srcInfo.bounds.y2 = srcy + height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    if (needLut) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        lockFlags = (SD_LOCK_READ | SD_LOCK_LUT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        lockFlags = SD_LOCK_READ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    // This method is used among other things for on-screen copyArea, in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    // case the source and destination surfaces are the same. It is important
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    // to first lock the source and then get the hDC for the destination
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    // surface because the same per-thread hDC will be used for both
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    // and we need to have the correct clip set to the hDC
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    // used with the SetDIBitsToDevice call.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    if (srcOps->Lock(env, srcOps, &srcInfo, lockFlags) != SD_SUCCESS) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    SurfaceDataBounds dstBounds = {dstx, dsty, dstx + width, dsty + height};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    // Intersect the source and dest rects. Note that the source blit bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    // will be adjusted to the surfaces's bounds if needed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    SurfaceData_IntersectBlitBounds(&(srcInfo.bounds), &dstBounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
                                    dstx - srcx, dsty - srcy);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    srcx = srcInfo.bounds.x1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    srcy = srcInfo.bounds.y1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    dstx = dstBounds.x1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    dsty = dstBounds.y1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    width = srcInfo.bounds.x2 - srcInfo.bounds.x1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    height = srcInfo.bounds.y2 - srcInfo.bounds.y1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    if (width > 0 && height > 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        BmiType bmi;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        // REMIND: A performance tweak here would be to make some of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        // data static.  For example, we could have one structure that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        // always used for ByteGray copies and we only change dynamic data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        // in the structure with every new copy.  Also, we could store
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        // structures with Ops or with the Java objects so that surfaces
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        // could retain their own DIB info and we would not need to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        // recreate it every time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
8359
b2e3eb2cc841 6857592: Getting warning while moving or resizing the frame when component.printAll() is called on local JNI
prr
parents: 5506
diff changeset
   110
        // GetRasInfo implicitly calls GetPrimitiveArrayCritical
b2e3eb2cc841 6857592: Getting warning while moving or resizing the frame when component.printAll() is called on local JNI
prr
parents: 5506
diff changeset
   111
        // and since GetDC uses JNI it needs to be called first.
b2e3eb2cc841 6857592: Getting warning while moving or resizing the frame when component.printAll() is called on local JNI
prr
parents: 5506
diff changeset
   112
        HDC hDC = dstOps->GetDC(env, dstOps, 0, NULL, clip, NULL, 0);
b2e3eb2cc841 6857592: Getting warning while moving or resizing the frame when component.printAll() is called on local JNI
prr
parents: 5506
diff changeset
   113
        if (hDC == NULL) {
b2e3eb2cc841 6857592: Getting warning while moving or resizing the frame when component.printAll() is called on local JNI
prr
parents: 5506
diff changeset
   114
            SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
b2e3eb2cc841 6857592: Getting warning while moving or resizing the frame when component.printAll() is called on local JNI
prr
parents: 5506
diff changeset
   115
            return;
b2e3eb2cc841 6857592: Getting warning while moving or resizing the frame when component.printAll() is called on local JNI
prr
parents: 5506
diff changeset
   116
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        srcOps->GetRasInfo(env, srcOps, &srcInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        if (srcInfo.rasBase == NULL) {
8359
b2e3eb2cc841 6857592: Getting warning while moving or resizing the frame when component.printAll() is called on local JNI
prr
parents: 5506
diff changeset
   119
            dstOps->ReleaseDC(env, dstOps, hDC);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
            SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        void *rasBase = ((char *)srcInfo.rasBase) + srcInfo.scanStride * srcy +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
                        srcInfo.pixelStride * srcx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        // If scanlines are DWORD-aligned (scanStride is a multiple of 4),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        // then we can do the work much faster.  This is due to a constraint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        // in the way DIBs are structured and parsed by GDI
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        jboolean fastBlt = ((srcInfo.scanStride & 0x03) == 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        bmi.bmiHeader.biWidth = srcInfo.scanStride/srcInfo.pixelStride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        // fastBlt copies whole image in one call; else copy line-by-line
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        LONG dwHeight = srcInfo.bounds.y2 - srcInfo.bounds.y1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        bmi.bmiHeader.biHeight = (fastBlt) ? -dwHeight : -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        bmi.bmiHeader.biPlanes = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        bmi.bmiHeader.biBitCount = (WORD)srcInfo.pixelStride * 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        // 1,3,4 byte use BI_RGB, 2 byte use BI_BITFIELD...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        // 4 byte _can_ use BI_BITFIELD, but this seems to cause a performance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        // penalty.  Since we only ever have one format (xrgb) for 32-bit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        // images that enter this function, just use BI_RGB.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        // Could do BI_RGB for 2-byte 555 format, but no perceived
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        // performance benefit.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        bmi.bmiHeader.biCompression = (srcInfo.pixelStride != 2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                ? BI_RGB : BI_BITFIELDS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        bmi.bmiHeader.biSizeImage = (bmi.bmiHeader.biWidth * dwHeight *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                                     srcInfo.pixelStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        bmi.bmiHeader.biXPelsPerMeter = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        bmi.bmiHeader.biYPelsPerMeter = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        bmi.bmiHeader.biClrUsed = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        bmi.bmiHeader.biClrImportant = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        if (srcInfo.pixelStride == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            // Copy palette info into bitmap for 8-bit image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            if (needLut) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                memcpy(bmi.colors.palette, srcInfo.lutBase, srcInfo.lutSize * sizeof(RGBQUAD));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
                if (srcInfo.lutSize != 256) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                    bmi.bmiHeader.biClrUsed = srcInfo.lutSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                // If no LUT needed, must be ByteGray src.  If we have not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                // yet created the byteGrayPalette, create it now and copy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                // it into our temporary bmi structure.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
                // REMIND: byteGrayPalette is a leak since we do not have
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                // a mechansim to free it up.  This should be fine, since it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
                // is only 256 bytes for any process and only gets malloc'd
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
                // when using ByteGray surfaces.  Eventually, we should use
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                // the new Disposer mechanism to delete this native memory.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
                if (byteGrayPalette == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
                    byteGrayPalette = (RGBQUAD *)safe_Malloc(256 * sizeof(RGBQUAD));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
                    for (int i = 0; i < 256; ++i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
                        byteGrayPalette[i].rgbRed = i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
                        byteGrayPalette[i].rgbGreen = i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                        byteGrayPalette[i].rgbBlue = i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                memcpy(bmi.colors.palette, byteGrayPalette, 256 * sizeof(RGBQUAD));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        } else if (srcInfo.pixelStride == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
            // For 16-bit case, init the masks for the pixel depth
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            bmi.colors.dwMasks[0] = rmask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            bmi.colors.dwMasks[1] = gmask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
            bmi.colors.dwMasks[2] = bmask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        if (fastBlt) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
            // Window could go away at any time, leaving bits on the screen
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
            // from this GDI call, so make sure window still exists
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
            if (::IsWindowVisible(dstOps->window)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                // Could also call StretchDIBits.  Testing showed slight
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
                // performance advantage of SetDIBits instead, so since we
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
                // have no need of scaling, might as well use SetDIBits.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
                SetDIBitsToDevice(hDC, dstx, dsty, width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
                    0, 0, 0, height, rasBase,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
                    (BITMAPINFO*)&bmi, DIB_RGB_COLORS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            // Source scanlines not DWORD-aligned - copy each scanline individually
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
            for (int i = 0; i < height; i += 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
                if (::IsWindowVisible(dstOps->window)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
                    SetDIBitsToDevice(hDC, dstx, dsty+i, width, 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                        0, 0, 0, 1, rasBase,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                        (BITMAPINFO*)&bmi, DIB_RGB_COLORS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
                    rasBase = (void*)((char*)rasBase + srcInfo.scanStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        dstOps->ReleaseDC(env, dstOps, hDC);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        SurfaceData_InvokeRelease(env, srcOps, &srcInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
} // extern "C"