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

Print this page

        

*** 36,84 **** import com.sun.scenario.effect.ImageData; import com.sun.scenario.effect.impl.HeapImage; import com.sun.scenario.effect.impl.Renderer; import com.sun.javafx.geom.Rectangle; import com.sun.javafx.geom.transform.BaseTransform; ! public class SSEBoxShadowPeer extends SSEEffectPeer { public SSEBoxShadowPeer(FilterContext fctx, Renderer r, String uniqueName) { super(fctx, r, uniqueName); } @Override - protected final BoxShadow getEffect() { - return (BoxShadow)super.getEffect(); - } - - @Override public ImageData filter(Effect effect, BaseTransform transform, Rectangle outputClip, ImageData... inputs) { // NOTE: for now, all input images must be TYPE_INT_ARGB_PRE - setEffect(effect); // Calculate the amount the image grows on each iteration (size-1) boolean horizontal = (getPass() == 0); ! int hinc = horizontal ? getEffect().getHorizontalSize() - 1 : 0; ! int vinc = horizontal ? 0 : getEffect().getVerticalSize() - 1; if (hinc < 0) hinc = 0; if (vinc < 0) vinc = 0; ! int iterations = getEffect().getPasses(); ! float spread = getEffect().getSpread(); if (horizontal && (iterations < 1 || (hinc < 1 && vinc < 1))) { inputs[0].addref(); return inputs[0]; } // Calculate the amount the image will grow through the full operation // Always upgrade to the next even amount of growth int growx = (hinc * iterations + 1) & (~0x1); int growy = (vinc * iterations + 1) & (~0x1); ! // Assert: ((FilterEffect) effect).operatesInUserSpace()... // NOTE: We could still have a transformed ImageData for other reasons... HeapImage src = (HeapImage)inputs[0].getUntransformedImage(); Rectangle srcr = inputs[0].getUntransformedBounds(); HeapImage cur = src; --- 36,81 ---- import com.sun.scenario.effect.ImageData; import com.sun.scenario.effect.impl.HeapImage; import com.sun.scenario.effect.impl.Renderer; import com.sun.javafx.geom.Rectangle; import com.sun.javafx.geom.transform.BaseTransform; + import com.sun.scenario.effect.impl.state.BoxRenderState; ! public class SSEBoxShadowPeer extends SSEEffectPeer<BoxRenderState> { public SSEBoxShadowPeer(FilterContext fctx, Renderer r, String uniqueName) { super(fctx, r, uniqueName); } @Override public ImageData filter(Effect effect, + BoxRenderState brstate, BaseTransform transform, Rectangle outputClip, ImageData... inputs) { + setRenderState(brstate); // NOTE: for now, all input images must be TYPE_INT_ARGB_PRE // Calculate the amount the image grows on each iteration (size-1) boolean horizontal = (getPass() == 0); ! int hinc = horizontal ? brstate.getBoxPixelSize(0) - 1 : 0; ! int vinc = horizontal ? 0 : brstate.getBoxPixelSize(1) - 1; if (hinc < 0) hinc = 0; if (vinc < 0) vinc = 0; ! int iterations = brstate.getBlurPasses(); ! float spread = brstate.getSpread(); if (horizontal && (iterations < 1 || (hinc < 1 && vinc < 1))) { inputs[0].addref(); return inputs[0]; } // Calculate the amount the image will grow through the full operation // Always upgrade to the next even amount of growth int growx = (hinc * iterations + 1) & (~0x1); int growy = (vinc * iterations + 1) & (~0x1); ! // Assert: rstate.getEffectTransformSpace() == UserSpace // NOTE: We could still have a transformed ImageData for other reasons... HeapImage src = (HeapImage)inputs[0].getUntransformedImage(); Rectangle srcr = inputs[0].getUntransformedBounds(); HeapImage cur = src;
*** 111,121 **** filterVerticalBlack(newPixels, neww, newh, newscan, curPixels, curw, curh, curscan, spread); } else { float shadowColor[] = ! getEffect().getColor().getPremultipliedRGBComponents(); if (shadowColor[3] == 1f && shadowColor[0] == 0f && shadowColor[1] == 0f && shadowColor[2] == 0f) { --- 108,118 ---- filterVerticalBlack(newPixels, neww, newh, newscan, curPixels, curw, curh, curscan, spread); } else { float shadowColor[] = ! brstate.getShadowColor().getPremultipliedRGBComponents(); if (shadowColor[3] == 1f && shadowColor[0] == 0f && shadowColor[1] == 0f && shadowColor[2] == 0f) {