Ejemplo n.º 1
0
  protected boolean scaleSurfaceData(
      SunGraphics2D sg,
      Region clipRegion,
      SurfaceData srcData,
      SurfaceData dstData,
      SurfaceType srcType,
      SurfaceType dstType,
      int sx1,
      int sy1,
      int sx2,
      int sy2,
      double dx1,
      double dy1,
      double dx2,
      double dy2) {
    CompositeType comp = sg.imageComp;
    if (CompositeType.SrcOverNoEa.equals(comp)
        && (srcData.getTransparency() == Transparency.OPAQUE)) {
      comp = CompositeType.SrcNoEa;
    }

    ScaledBlit blit = ScaledBlit.getFromCache(srcType, comp, dstType);
    if (blit != null) {
      blit.Scale(
          srcData, dstData, sg.composite, clipRegion, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2);
      return true;
    }
    return false;
  }
Ejemplo n.º 2
0
 protected void blitSurfaceData(
     SunGraphics2D sg,
     Region clipRegion,
     SurfaceData srcData,
     SurfaceData dstData,
     SurfaceType srcType,
     SurfaceType dstType,
     int sx,
     int sy,
     int dx,
     int dy,
     int w,
     int h,
     Color bgColor) {
   if (w <= 0 || h <= 0) {
     /*
      * Fix for bugid 4783274 - BlitBg throws an exception for
      * a particular set of anomalous parameters.
      * REMIND: The native loops do proper clipping and would
      * detect this situation themselves, but the Java loops
      * all seem to trust their parameters a little too well
      * to the point where they will try to process a negative
      * area of pixels and throw exceptions.  The real fix is
      * to modify the Java loops to do proper clipping so that
      * they can deal with negative dimensions as well as
      * improperly large dimensions, but that fix is too risky
      * to integrate for Mantis at this point.  In the meantime
      * eliminating the negative or zero dimensions here is
      * "correct" and saves them from some nasty exceptional
      * conditions, one of which is the test case of 4783274.
      */
     return;
   }
   CompositeType comp = sg.imageComp;
   if (CompositeType.SrcOverNoEa.equals(comp)
       && (srcData.getTransparency() == Transparency.OPAQUE
           || (bgColor != null && bgColor.getTransparency() == Transparency.OPAQUE))) {
     comp = CompositeType.SrcNoEa;
   }
   if (!isBgOperation(srcData, bgColor)) {
     Blit blit = Blit.getFromCache(srcType, comp, dstType);
     blit.Blit(srcData, dstData, sg.composite, clipRegion, sx, sy, dx, dy, w, h);
   } else {
     BlitBg blit = BlitBg.getFromCache(srcType, comp, dstType);
     blit.BlitBg(
         srcData, dstData, sg.composite, clipRegion, bgColor.getRGB(), sx, sy, dx, dy, w, h);
   }
 }
Ejemplo n.º 3
0
 public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h, int dx, int dy) {
   CompositeType comptype = sg2d.imageComp;
   if (sg2d.clipState != SunGraphics2D.CLIP_SHAPE
       && (CompositeType.SrcOverNoEa.equals(comptype) || CompositeType.SrcNoEa.equals(comptype))) {
     int dstx1 = x + dx;
     int dsty1 = y + dy;
     int dstx2 = dstx1 + w;
     int dsty2 = dsty1 + h;
     Region clip = sg2d.getCompClip();
     if (dstx1 < clip.getLoX()) dstx1 = clip.getLoX();
     if (dsty1 < clip.getLoY()) dsty1 = clip.getLoY();
     if (dstx2 > clip.getHiX()) dstx2 = clip.getHiX();
     if (dsty2 > clip.getHiY()) dsty2 = clip.getHiY();
     if (dstx1 < dstx2 && dsty1 < dsty2) {
       gdiPipe.devCopyArea(this, dstx1 - dx, dsty1 - dy, dx, dy, dstx2 - dstx1, dsty2 - dsty1);
     }
     return true;
   }
   return false;
 }