modules/graphics/src/main/java/com/sun/prism/impl/ps/BaseShaderGraphics.java

Print this page




1587                 context.validatePaintOp(this, xform, MaskType.ALPHA_ONE, null,
1588                                         bx, by, bw, bh);
1589             AffineBase paintTx = getPaintTextureTx(IDENT, shader, bx, by, bw, bh);
1590             if (paintTx != null) {
1591                 paintTx.translate(-mxt, -myt);
1592             }
1593             context.getVertexBuffer().addQuad(x1, y1, x2, y2, 0, 0, 0, 0, paintTx);
1594             return;
1595         }
1596         if (isSimpleTranslate) {
1597             xform = IDENT;
1598             bx += transX;
1599             by += transY;
1600         }
1601         context.validatePaintOp(this, xform, MaskType.SOLID, bx, by, bw, bh);
1602 
1603         VertexBuffer vb = context.getVertexBuffer();
1604         vb.addQuad(bx, by, bx+bw, by+bh);
1605     }
1606 
1607     @Override
1608     public void fillTriangles(VertexBuffer tris, int numVerts,
1609                               float bx, float by, float bw, float bh)
1610     {
1611         if (isComplexPaint) {
1612             throw new AssertionError("fillTriangles() not supported for complex paints");
1613         }
1614 
1615         BaseTransform xform = getTransformNoClone();
1616         context.validatePaintOp(this, xform, MaskType.SOLID, bx, by, bw, bh);
1617 
1618         VertexBuffer vb = context.getVertexBuffer();
1619         vb.addVerts(tris, numVerts);
1620     }
1621 
1622     void fillCubicCurves(VertexBuffer tris, int numVerts,
1623                          float bx, float by, float bw, float bh)
1624     {
1625         if (isComplexPaint) {
1626             throw new AssertionError("fillCubicCurves() not supported for complex paints");
1627         }
1628 
1629         BaseTransform xform = getTransformNoClone();
1630         context.validatePaintOp(this, xform, MaskType.FILL_CUBICCURVE, bx, by, bw, bh);
1631 
1632         VertexBuffer vb = context.getVertexBuffer();
1633         vb.addVerts(tris, numVerts);
1634     }
1635 
1636     private static final double SQRT_2 = Math.sqrt(2.0);
1637     private static boolean canUseStrokeShader(BasicStroke bs) {
1638         // RT-27378
1639         // TODO: Expand the cases that renderGeneralRoundRect() can handle...
1640         return (!bs.isDashed() &&
1641                 (bs.getType() == BasicStroke.TYPE_INNER ||
1642                  bs.getLineJoin() == BasicStroke.JOIN_ROUND ||
1643                  (bs.getLineJoin() == BasicStroke.JOIN_MITER &&
1644                   bs.getMiterLimit() >= SQRT_2)));
1645     }
1646 
1647     public void blit(RTTexture srcTex, RTTexture dstTex,
1648                      int srcX0, int srcY0, int srcX1, int srcY1,
1649                      int dstX0, int dstY0, int dstX1, int dstY1) {
1650         if (dstTex == null) {
1651             context.setRenderTarget(this);
1652         } else {
1653             context.setRenderTarget((BaseGraphics)dstTex.createGraphics());
1654         }
1655         context.blit(srcTex, dstTex, srcX0, srcY0, srcX1, srcY1,




1587                 context.validatePaintOp(this, xform, MaskType.ALPHA_ONE, null,
1588                                         bx, by, bw, bh);
1589             AffineBase paintTx = getPaintTextureTx(IDENT, shader, bx, by, bw, bh);
1590             if (paintTx != null) {
1591                 paintTx.translate(-mxt, -myt);
1592             }
1593             context.getVertexBuffer().addQuad(x1, y1, x2, y2, 0, 0, 0, 0, paintTx);
1594             return;
1595         }
1596         if (isSimpleTranslate) {
1597             xform = IDENT;
1598             bx += transX;
1599             by += transY;
1600         }
1601         context.validatePaintOp(this, xform, MaskType.SOLID, bx, by, bw, bh);
1602 
1603         VertexBuffer vb = context.getVertexBuffer();
1604         vb.addQuad(bx, by, bx+bw, by+bh);
1605     }
1606 





























1607     private static final double SQRT_2 = Math.sqrt(2.0);
1608     private static boolean canUseStrokeShader(BasicStroke bs) {
1609         // RT-27378
1610         // TODO: Expand the cases that renderGeneralRoundRect() can handle...
1611         return (!bs.isDashed() &&
1612                 (bs.getType() == BasicStroke.TYPE_INNER ||
1613                  bs.getLineJoin() == BasicStroke.JOIN_ROUND ||
1614                  (bs.getLineJoin() == BasicStroke.JOIN_MITER &&
1615                   bs.getMiterLimit() >= SQRT_2)));
1616     }
1617 
1618     public void blit(RTTexture srcTex, RTTexture dstTex,
1619                      int srcX0, int srcY0, int srcX1, int srcY1,
1620                      int dstX0, int dstY0, int dstX1, int dstY1) {
1621         if (dstTex == null) {
1622             context.setRenderTarget(this);
1623         } else {
1624             context.setRenderTarget((BaseGraphics)dstTex.createGraphics());
1625         }
1626         context.blit(srcTex, dstTex, srcX0, srcY0, srcX1, srcY1,