src/java.desktop/share/classes/java/awt/image/PixelGrabber.java
changeset 52248 2e330da7cbf4
parent 47216 71c04702a3d5
equal deleted inserted replaced
52247:f775f83d6b60 52248:2e330da7cbf4
     1 /*
     1 /*
     2  * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   427         return;
   427         return;
   428     }
   428     }
   429 
   429 
   430     private void convertToRGB() {
   430     private void convertToRGB() {
   431         int size = dstW * dstH;
   431         int size = dstW * dstH;
   432         int newpixels[] = new int[size];
   432         int[] newpixels = new int[size];
   433         if (bytePixels != null) {
   433         if (bytePixels != null) {
   434             for (int i = 0; i < size; i++) {
   434             for (int i = 0; i < size; i++) {
   435                 newpixels[i] = imageModel.getRGB(bytePixels[i] & 0xff);
   435                 newpixels[i] = imageModel.getRGB(bytePixels[i] & 0xff);
   436             }
   436             }
   437         } else if (intPixels != null) {
   437         } else if (intPixels != null) {
   468      *        in the pixels array
   468      *        in the pixels array
   469      * @see #getPixels
   469      * @see #getPixels
   470      */
   470      */
   471     public void setPixels(int srcX, int srcY, int srcW, int srcH,
   471     public void setPixels(int srcX, int srcY, int srcW, int srcH,
   472                           ColorModel model,
   472                           ColorModel model,
   473                           byte pixels[], int srcOff, int srcScan) {
   473                           byte[] pixels, int srcOff, int srcScan) {
   474         if (srcY < dstY) {
   474         if (srcY < dstY) {
   475             int diff = dstY - srcY;
   475             int diff = dstY - srcY;
   476             if (diff >= srcH) {
   476             if (diff >= srcH) {
   477                 return;
   477                 return;
   478             }
   478             }
   555      *        in the pixels array
   555      *        in the pixels array
   556      * @see #getPixels
   556      * @see #getPixels
   557      */
   557      */
   558     public void setPixels(int srcX, int srcY, int srcW, int srcH,
   558     public void setPixels(int srcX, int srcY, int srcW, int srcH,
   559                           ColorModel model,
   559                           ColorModel model,
   560                           int pixels[], int srcOff, int srcScan) {
   560                           int[] pixels, int srcOff, int srcScan) {
   561         if (srcY < dstY) {
   561         if (srcY < dstY) {
   562             int diff = dstY - srcY;
   562             int diff = dstY - srcY;
   563             if (diff >= srcH) {
   563             if (diff >= srcH) {
   564                 return;
   564                 return;
   565             }
   565             }