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

Print this page




  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 /*
  27  * This file was originally generated by JSLC
  28  * and then hand edited for performance.
  29  */
  30 
  31 package com.sun.scenario.effect.impl.sw.java;
  32 
  33 import com.sun.scenario.effect.FilterContext;
  34 import com.sun.scenario.effect.impl.Renderer;
  35 
  36 public class JSWLinearConvolveShadowPeer extends JSWLinearConvolvePeer {
  37     public JSWLinearConvolveShadowPeer(FilterContext fctx, Renderer r, String uniqueName) {
  38         super(fctx, r, uniqueName);
  39     }
  40 
  41     private float[] getShadowColor() {
  42         return getKernel().getShadowColorComponents(getPass());
  43     }
  44 
  45     @Override
  46     protected void filterVector(int dstPixels[], int dstw, int dsth, int dstscan,
  47                                 int srcPixels[], int srcw, int srch, int srcscan,
  48                                 float weights[], int count,
  49                                 float srcx0, float srcy0,
  50                                 float offsetx, float offsety,
  51                                 float deltax, float deltay,
  52                                 float dxcol, float dycol, float dxrow, float dyrow)
  53     {
  54         float shadowColor[] = getShadowColor();
  55 
  56         int dstrow = 0;
  57         // srcxy0 point at UL corner, shift them to center of 1st dest pixel:
  58         srcx0 += (dxrow + dxcol) * 0.5f;
  59         srcy0 += (dyrow + dycol) * 0.5f;
  60         for (int dy = 0; dy < dsth; dy++) {
  61             float srcx = srcx0;
  62             float srcy = srcy0;


  74                             sum += (argb >>> 24) * weights[i];
  75                         }
  76                     }
  77                     sampx += deltax;
  78                     sampy += deltay;
  79                 }
  80                 sum = (sum < 0f) ? 0f : ((sum > 255f) ? 255f : sum);
  81                 dstPixels[dstrow + dx] = ((int) (shadowColor[0] * sum) << 16) |
  82                                          ((int) (shadowColor[1] * sum) <<  8) |
  83                                          ((int) (shadowColor[2] * sum)      ) |
  84                                          ((int) (shadowColor[3] * sum) << 24);
  85                 srcx += dxcol;
  86                 srcy += dycol;
  87             }
  88             srcx0 += dxrow;
  89             srcy0 += dyrow;
  90             dstrow += dstscan;
  91         }
  92     }
  93 
  94     /**
  95      * In the nomenclature of the argument list for this method, "row" refers
  96      * to the coordinate which increments once for each new stream of single
  97      * axis data that we are blurring in a single pass.  And "col" refers to
  98      * the other coordinate that increments along the row.
  99      * Rows are horizontal in the first pass and vertical in the second pass.
 100      * Cols are vice versa.
 101      */
 102     @Override
 103     protected void filterHV(int dstPixels[], int dstcols, int dstrows, int dcolinc, int drowinc,
 104                             int srcPixels[], int srccols, int srcrows, int scolinc, int srowinc,
 105                             float weights[])
 106     {
 107         float shadowColor[] = getShadowColor();
 108 
 109         // avals stores the alpha values from the surrounding K pixels
 110         // from x-r to x+r
 111         int kernelSize = weights.length / 2;
 112         float avals[] = new float[kernelSize];
 113         int dstrow = 0;
 114         int srcrow = 0;




  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 /*
  27  * This file was originally generated by JSLC
  28  * and then hand edited for performance.
  29  */
  30 
  31 package com.sun.scenario.effect.impl.sw.java;
  32 
  33 import com.sun.scenario.effect.FilterContext;
  34 import com.sun.scenario.effect.impl.Renderer;
  35 
  36 public class JSWLinearConvolveShadowPeer extends JSWLinearConvolvePeer {
  37     public JSWLinearConvolveShadowPeer(FilterContext fctx, Renderer r, String uniqueName) {
  38         super(fctx, r, uniqueName);
  39     }
  40 
  41     private float[] getShadowColor() {
  42         return getRenderState().getPassShadowColorComponents();
  43     }
  44 
  45     @Override
  46     protected void filterVector(int dstPixels[], int dstw, int dsth, int dstscan,
  47                                 int srcPixels[], int srcw, int srch, int srcscan,
  48                                 float weights[], int count,
  49                                 float srcx0, float srcy0,
  50                                 float offsetx, float offsety,
  51                                 float deltax, float deltay,
  52                                 float dxcol, float dycol, float dxrow, float dyrow)
  53     {
  54         float shadowColor[] = getShadowColor();
  55 
  56         int dstrow = 0;
  57         // srcxy0 point at UL corner, shift them to center of 1st dest pixel:
  58         srcx0 += (dxrow + dxcol) * 0.5f;
  59         srcy0 += (dyrow + dycol) * 0.5f;
  60         for (int dy = 0; dy < dsth; dy++) {
  61             float srcx = srcx0;
  62             float srcy = srcy0;


  74                             sum += (argb >>> 24) * weights[i];
  75                         }
  76                     }
  77                     sampx += deltax;
  78                     sampy += deltay;
  79                 }
  80                 sum = (sum < 0f) ? 0f : ((sum > 255f) ? 255f : sum);
  81                 dstPixels[dstrow + dx] = ((int) (shadowColor[0] * sum) << 16) |
  82                                          ((int) (shadowColor[1] * sum) <<  8) |
  83                                          ((int) (shadowColor[2] * sum)      ) |
  84                                          ((int) (shadowColor[3] * sum) << 24);
  85                 srcx += dxcol;
  86                 srcy += dycol;
  87             }
  88             srcx0 += dxrow;
  89             srcy0 += dyrow;
  90             dstrow += dstscan;
  91         }
  92     }
  93 
  94     /*
  95      * In the nomenclature of the argument list for this method, "row" refers
  96      * to the coordinate which increments once for each new stream of single
  97      * axis data that we are blurring in a single pass.  And "col" refers to
  98      * the other coordinate that increments along the row.
  99      * Rows are horizontal in the first pass and vertical in the second pass.
 100      * Cols are vice versa.
 101      */
 102     @Override
 103     protected void filterHV(int dstPixels[], int dstcols, int dstrows, int dcolinc, int drowinc,
 104                             int srcPixels[], int srccols, int srcrows, int scolinc, int srowinc,
 105                             float weights[])
 106     {
 107         float shadowColor[] = getShadowColor();
 108 
 109         // avals stores the alpha values from the surrounding K pixels
 110         // from x-r to x+r
 111         int kernelSize = weights.length / 2;
 112         float avals[] = new float[kernelSize];
 113         int dstrow = 0;
 114         int srcrow = 0;