~ubuntu-branches/ubuntu/karmic/classpath/karmic

« back to all changes in this revision

Viewing changes to gnu/java/awt/peer/x/XGraphics2D.java

  • Committer: Bazaar Package Importer
  • Author(s): Manny Vindiola, Manny Vindiola, James Westby
  • Date: 2008-12-18 21:24:48 UTC
  • mfrom: (1.1.6 upstream) (8.2.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20081218212448-ax2jaxx9r5175dkl
Tags: 2:0.97.2-1.1ubuntu1
[ Manny Vindiola ]
* Merge from debian unstable (LP: #309549)(LP: #237668), remaining changes:
  * debian/control:
    - Recommend firefox instead of mozilla-firefox.
  * Fix FTBFS caused by -Werror where return value of 'chdir' was ignored
    - add debian/patches/20_fix_ftbfs_warn_unused_result.dpatch
    - update debian/patches/00list
  * fix LP: #272772: packages that Depend/Recommend/Suggest firefox
     (meta-package) must alternatively Depend/Recommend/Suggest abrowser
* Fix FTBFS due to missing mozilla-plugin build dependency 
  - changed to build-depends on libxul-dev instead of iceape-dev

[ James Westby ]
* Add libsamplerate0-dev to Build-Depends to fix build error by not being
  able to find the .a file from it. This is a dependency of jack, but not
  specified in it's depends. This is probably due to bug 258491, and so if
  that is fixed try building without the extra Build-Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
import java.util.HashMap;
58
58
import java.util.WeakHashMap;
59
59
 
 
60
import gnu.java.awt.image.AsyncImage;
60
61
import gnu.java.awt.java2d.AbstractGraphics2D;
61
62
import gnu.java.awt.java2d.ScanlineCoverage;
62
63
import gnu.x11.Colormap;
69
70
{
70
71
 
71
72
  /**
 
73
   * When this property is set to true, then images are always rendered as
 
74
   * opaque images, ignoring their translucence. This is intended for
 
75
   * debugging and demonstration purposes.
 
76
   */
 
77
  private static final boolean RENDER_OPAQUE =
 
78
    Boolean.getBoolean("escherpeer.renderopaque");
 
79
 
 
80
  /**
72
81
   * The X Drawable to draw on.
73
82
   */
74
83
  private Drawable xdrawable;
331
340
 
332
341
  protected boolean rawDrawImage(Image image, int x, int y, ImageObserver obs)
333
342
  {
 
343
    image = unwrap(image);
334
344
    boolean ret;
335
345
    if (image instanceof XImage)
336
346
      {
367
377
                ZPixmap zpixmap = imageCache.get(image);
368
378
                xdrawable.put_image(xgc, zpixmap, x, y);
369
379
              }
370
 
            else if (transparency == Transparency.OPAQUE)
 
380
            else if (transparency == Transparency.OPAQUE || RENDER_OPAQUE)
371
381
              {
372
382
                XGraphicsDevice gd = XToolkit.getDefaultDevice();
373
383
                ZPixmap zpixmap = new ZPixmap(gd.getDisplay(), w, h);
413
423
                            blue = blue * alpha
414
424
                                    + (255 - alpha) * zpixmap.get_blue(xx, yy);
415
425
                            blue = blue / 255;
 
426
                            rgb = red << 16 | green << 8 | blue;
416
427
                          }
417
428
                        // else keep rgb value from source image.
418
429
 
420
431
                      }
421
432
                  }
422
433
                xdrawable.put_image(xgc, zpixmap, x, y);
423
 
                imageCache.put(image, zpixmap);
 
434
                // We can't cache prerendered translucent images, because
 
435
                // we never know how the background changes.
424
436
              }
425
437
            ret = true;
426
438
          }
457
469
        super.drawString(s, x, y);
458
470
      }
459
471
  }
 
472
 
 
473
  /**
 
474
   * Extracts an image instance out of an AsyncImage. If the image isn't
 
475
   * an AsyncImage, then the original instance is returned.
 
476
   *
 
477
   * @param im the image
 
478
   *
 
479
   * @return the image to render
 
480
   */
 
481
  private Image unwrap(Image im)
 
482
  {
 
483
    Image image = im;
 
484
    if (image instanceof AsyncImage)
 
485
      {
 
486
        AsyncImage aIm = (AsyncImage) image;
 
487
        image = aIm.getRealImage();
 
488
      }
 
489
    return image;
 
490
  }
 
491
 
460
492
}
461
493