Esempio n. 1
0
  private XRCompositeManager(XRSurfaceData surface) {
    con = new XRBackendNative();
    // con = XRBackendJava.getInstance();

    String gradProp = System.getProperty("sun.java2d.xrgradcache");
    enableGradCache =
        gradProp == null || !(gradProp.equalsIgnoreCase("false") || gradProp.equalsIgnoreCase("f"));

    XRPaints.register(this);

    initResources(surface);

    maskBuffer = new MaskTileManager(this, surface.getXid());
    textRenderer = new XRTextRenderer(this);
    maskImage = new XRMaskImage(this, surface.getXid());
  }
Esempio n. 2
0
  public void validateCompositeState(
      Composite comp, AffineTransform xform, Paint paint, SunGraphics2D sg2d) {
    boolean updatePaint = (paint != validatedPaint) || paint == null;

    // validate composite
    if ((comp != validatedComp)) {
      if (comp != null) {
        setComposite(comp);
      } else {
        comp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER);
        setComposite(comp);
      }
      // the paint state is dependent on the composite state, so make
      // sure we update the color below
      updatePaint = true;
      validatedComp = comp;
    }

    if (sg2d != null && validatedPixel != sg2d.pixel) {
      validatedPixel = sg2d.pixel;
      setForeground(validatedPixel);
    }

    // validate paint
    if (updatePaint) {
      if (paint != null && sg2d != null && sg2d.paintState >= SunGraphics2D.PAINT_GRADIENT) {
        XRPaints.setPaint(sg2d, paint);
      } else {
        XRResetPaint();
      }
      validatedPaint = paint;
    }

    if (src != solidSrcPict) {
      AffineTransform at = (AffineTransform) xform.clone();
      try {
        at.invert();
      } catch (NoninvertibleTransformException e) {
        at.setToIdentity();
      }
      src.validateAsSource(at, -1, -1);
    }
  }