< prev index next >

src/java.desktop/share/native/common/awt/utility/rect.c

Print this page




  59             // pSrc[0,1,2] == B,G,R; pSrc[3] == Alpha
  60             while (i < width && !pSrc[3]) {
  61                 pSrc += 4;
  62                 ++i;
  63             }
  64             if (i >= width)
  65                 break;
  66             i0 = i;
  67             while (i < width && pSrc[3]) {
  68                 pSrc += 4;
  69                 ++i;
  70             }
  71             RECT_SET(*pThis, i0, j, i - i0, 1);
  72             ++pThis;
  73         } while (i < width);
  74 
  75         /*  check if the previous scanline is exactly the same, merge if so
  76             (this is the only optimization we can use for YXBanded rectangles,
  77             and win32 supports YXBanded only */
  78 
  79         length = pThis - pLine;
  80         if (pPrevLine && pLine - pPrevLine == length) {
  81             for (i = 0; i < length && RECT_EQ_X(pPrevLine[i], pLine[i]); ++i) {
  82             }
  83             if (i == pLine - pPrevLine) {
  84                 // do merge
  85                 for (i = 0; i < length; i++) {
  86                     RECT_INC_HEIGHT(pPrevLine[i]);
  87                 }
  88                 pThis = pLine;
  89                 continue;
  90             }
  91         }
  92         /* or else use the generated scanline */
  93 
  94         pPrevLine = pLine;
  95     }
  96 
  97     return pThis - pFirst;
  98 }
  99 
 100 #if defined(__cplusplus)
 101 }
 102 #endif


  59             // pSrc[0,1,2] == B,G,R; pSrc[3] == Alpha
  60             while (i < width && !pSrc[3]) {
  61                 pSrc += 4;
  62                 ++i;
  63             }
  64             if (i >= width)
  65                 break;
  66             i0 = i;
  67             while (i < width && pSrc[3]) {
  68                 pSrc += 4;
  69                 ++i;
  70             }
  71             RECT_SET(*pThis, i0, j, i - i0, 1);
  72             ++pThis;
  73         } while (i < width);
  74 
  75         /*  check if the previous scanline is exactly the same, merge if so
  76             (this is the only optimization we can use for YXBanded rectangles,
  77             and win32 supports YXBanded only */
  78 
  79         length = (int)(pThis - pLine);
  80         if (pPrevLine && pLine - pPrevLine == length) {
  81             for (i = 0; i < length && RECT_EQ_X(pPrevLine[i], pLine[i]); ++i) {
  82             }
  83             if (i == pLine - pPrevLine) {
  84                 // do merge
  85                 for (i = 0; i < length; i++) {
  86                     RECT_INC_HEIGHT(pPrevLine[i]);
  87                 }
  88                 pThis = pLine;
  89                 continue;
  90             }
  91         }
  92         /* or else use the generated scanline */
  93 
  94         pPrevLine = pLine;
  95     }
  96 
  97     return (int)(pThis - pFirst);
  98 }
  99 
 100 #if defined(__cplusplus)
 101 }
 102 #endif
< prev index next >