modules/graphics/src/main/java/com/sun/prism/es2/ES2Context.java

Print this page

        

*** 465,478 **** ES2Shader shader = (ES2Shader) getPhongShader(meshView); setShaderProgram(shader.getProgramObject()); // Support retina display by scaling the projViewTx and pass it to the shader. ! float pixelScaleFactor = g.getPixelScaleFactor(); ! if (pixelScaleFactor != 1.0) { scratchTx = scratchTx.set(projViewTx); ! scratchTx.scale(pixelScaleFactor, pixelScaleFactor, 1.0); updateRawMatrix(scratchTx); } else { updateRawMatrix(projViewTx); } shader.setMatrix("viewProjectionMatrix", rawMatrix); --- 465,479 ---- ES2Shader shader = (ES2Shader) getPhongShader(meshView); setShaderProgram(shader.getProgramObject()); // Support retina display by scaling the projViewTx and pass it to the shader. ! float pixelScaleFactorX = g.getPixelScaleFactorX(); ! float pixelScaleFactorY = g.getPixelScaleFactorY(); ! if (pixelScaleFactorX != 1.0 || pixelScaleFactorY != 1.0) { scratchTx = scratchTx.set(projViewTx); ! scratchTx.scale(pixelScaleFactorX, pixelScaleFactorY, 1.0); updateRawMatrix(scratchTx); } else { updateRawMatrix(projViewTx); } shader.setMatrix("viewProjectionMatrix", rawMatrix);
*** 480,493 **** (float) cameraPos.y, (float)cameraPos.z); // Undo the SwapChain scaling done in createGraphics() because 3D needs // this information in the shader (via projViewTx) BaseTransform xform = g.getTransformNoClone(); ! if (pixelScaleFactor != 1.0) { ! float invPSF = 1/pixelScaleFactor; scratchAffine3DTx.setToIdentity(); ! scratchAffine3DTx.scale(invPSF, invPSF); scratchAffine3DTx.concatenate(xform); updateWorldTransform(scratchAffine3DTx); } else { updateWorldTransform(xform); } --- 481,493 ---- (float) cameraPos.y, (float)cameraPos.z); // Undo the SwapChain scaling done in createGraphics() because 3D needs // this information in the shader (via projViewTx) BaseTransform xform = g.getTransformNoClone(); ! if (pixelScaleFactorX != 1.0 || pixelScaleFactorY != 1.0) { scratchAffine3DTx.setToIdentity(); ! scratchAffine3DTx.scale(1.0 / pixelScaleFactorX, 1.0 / pixelScaleFactorY); scratchAffine3DTx.concatenate(xform); updateWorldTransform(scratchAffine3DTx); } else { updateWorldTransform(xform); }