modules/graphics/src/main/java/com/sun/scenario/effect/impl/sw/java/JSWEffectPeer.java

Print this page




  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.scenario.effect.impl.sw.java;
  27 
  28 import com.sun.scenario.effect.FilterContext;
  29 import com.sun.scenario.effect.impl.EffectPeer;
  30 import com.sun.scenario.effect.impl.Renderer;

  31 
  32 public abstract class JSWEffectPeer extends EffectPeer {
  33 
  34     protected JSWEffectPeer(FilterContext fctx, Renderer r, String uniqueName) {
  35         super(fctx, r, uniqueName);
  36     }
  37 
  38     protected final static int FVALS_A = 3;
  39     protected final static int FVALS_R = 0;
  40     protected final static int FVALS_G = 1;
  41     protected final static int FVALS_B = 2;
  42 
  43     protected final void laccum(int pixel, float mul, float fvals[]) {
  44         mul /= 255f;
  45         fvals[FVALS_R] += ((pixel >>  16) & 0xff) * mul;
  46         fvals[FVALS_G] += ((pixel >>   8) & 0xff) * mul;
  47         fvals[FVALS_B] += ((pixel       ) & 0xff) * mul;
  48         fvals[FVALS_A] += ((pixel >>> 24)       ) * mul;
  49     }
  50 
  51     protected final void lsample(int img[],
  52                                  float floc_x, float floc_y,




  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.scenario.effect.impl.sw.java;
  27 
  28 import com.sun.scenario.effect.FilterContext;
  29 import com.sun.scenario.effect.impl.EffectPeer;
  30 import com.sun.scenario.effect.impl.Renderer;
  31 import com.sun.scenario.effect.impl.state.RenderState;
  32 
  33 public abstract class JSWEffectPeer<T extends RenderState> extends EffectPeer<T> {
  34 
  35     protected JSWEffectPeer(FilterContext fctx, Renderer r, String uniqueName) {
  36         super(fctx, r, uniqueName);
  37     }
  38 
  39     protected final static int FVALS_A = 3;
  40     protected final static int FVALS_R = 0;
  41     protected final static int FVALS_G = 1;
  42     protected final static int FVALS_B = 2;
  43 
  44     protected final void laccum(int pixel, float mul, float fvals[]) {
  45         mul /= 255f;
  46         fvals[FVALS_R] += ((pixel >>  16) & 0xff) * mul;
  47         fvals[FVALS_G] += ((pixel >>   8) & 0xff) * mul;
  48         fvals[FVALS_B] += ((pixel       ) & 0xff) * mul;
  49         fvals[FVALS_A] += ((pixel >>> 24)       ) * mul;
  50     }
  51 
  52     protected final void lsample(int img[],
  53                                  float floc_x, float floc_y,