src/share/classes/java/awt/image/FilteredImageSource.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1995, 2003, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 66,76 ****
public FilteredImageSource(ImageProducer orig, ImageFilter imgf) {
src = orig;
filter = imgf;
}
! private Hashtable proxies;
/**
* Adds the specified <code>ImageConsumer</code>
* to the list of consumers interested in data for the filtered image.
* An instance of the original <code>ImageFilter</code>
--- 66,76 ----
public FilteredImageSource(ImageProducer orig, ImageFilter imgf) {
src = orig;
filter = imgf;
}
! private Hashtable<ImageConsumer, ImageFilter> proxies;
/**
* Adds the specified <code>ImageConsumer</code>
* to the list of consumers interested in data for the filtered image.
* An instance of the original <code>ImageFilter</code>
*** 92,102 ****
* @param ic the consumer for the filtered image
* @see ImageConsumer
*/
public synchronized void addConsumer(ImageConsumer ic) {
if (proxies == null) {
! proxies = new Hashtable();
}
if (!proxies.containsKey(ic)) {
ImageFilter imgf = filter.getFilterInstance(ic);
proxies.put(ic, imgf);
src.addConsumer(imgf);
--- 92,102 ----
* @param ic the consumer for the filtered image
* @see ImageConsumer
*/
public synchronized void addConsumer(ImageConsumer ic) {
if (proxies == null) {
! proxies = new Hashtable<>();
}
if (!proxies.containsKey(ic)) {
ImageFilter imgf = filter.getFilterInstance(ic);
proxies.put(ic, imgf);
src.addConsumer(imgf);
*** 135,145 ****
*
* @see ImageConsumer
*/
public synchronized void removeConsumer(ImageConsumer ic) {
if (proxies != null) {
! ImageFilter imgf = (ImageFilter) proxies.get(ic);
if (imgf != null) {
src.removeConsumer(imgf);
proxies.remove(ic);
if (proxies.isEmpty()) {
proxies = null;
--- 135,145 ----
*
* @see ImageConsumer
*/
public synchronized void removeConsumer(ImageConsumer ic) {
if (proxies != null) {
! ImageFilter imgf = proxies.get(ic);
if (imgf != null) {
src.removeConsumer(imgf);
proxies.remove(ic);
if (proxies.isEmpty()) {
proxies = null;
*** 171,183 ****
* @param ic the consumer for the filtered image
* @see ImageConsumer
*/
public void startProduction(ImageConsumer ic) {
if (proxies == null) {
! proxies = new Hashtable();
}
! ImageFilter imgf = (ImageFilter) proxies.get(ic);
if (imgf == null) {
imgf = filter.getFilterInstance(ic);
proxies.put(ic, imgf);
}
src.startProduction(imgf);
--- 171,183 ----
* @param ic the consumer for the filtered image
* @see ImageConsumer
*/
public void startProduction(ImageConsumer ic) {
if (proxies == null) {
! proxies = new Hashtable<>();
}
! ImageFilter imgf = proxies.get(ic);
if (imgf == null) {
imgf = filter.getFilterInstance(ic);
proxies.put(ic, imgf);
}
src.startProduction(imgf);
*** 198,208 ****
*
* @see ImageConsumer
*/
public void requestTopDownLeftRightResend(ImageConsumer ic) {
if (proxies != null) {
! ImageFilter imgf = (ImageFilter) proxies.get(ic);
if (imgf != null) {
imgf.resendTopDownLeftRight(src);
}
}
}
--- 198,208 ----
*
* @see ImageConsumer
*/
public void requestTopDownLeftRightResend(ImageConsumer ic) {
if (proxies != null) {
! ImageFilter imgf = proxies.get(ic);
if (imgf != null) {
imgf.resendTopDownLeftRight(src);
}
}
}