Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

8252952: Lanai: VolatileImage/BitmaskVolatileImage test fails

  • Loading branch information
Alexey Ushakov committed Jan 19, 2021
1 parent a086f21 commit dd770c0c4904317175e47044a4a199ced5f890ca
@@ -49,7 +49,7 @@
import java.security.PrivilegedAction;

import static sun.java2d.metal.MTLContext.MTLContextCaps.CAPS_EXT_GRAD_SHADER;
import static sun.java2d.opengl.OGLSurfaceData.TEXTURE;
import static sun.java2d.pipe.hw.AccelSurface.TEXTURE;
import static sun.java2d.pipe.hw.AccelSurface.RT_TEXTURE;
import static sun.java2d.pipe.hw.ContextCapabilities.*;

@@ -372,7 +372,8 @@ public ImageCapabilities getImageCapabilities() {
public VolatileImage createCompatibleVolatileImage(int width, int height,
int transparency,
int type) {
if (type != RT_TEXTURE && type != TEXTURE) {
if ((type != RT_TEXTURE && type != TEXTURE) ||
transparency == Transparency.BITMASK) {
return null;
}

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,12 +28,10 @@
import sun.awt.image.SunVolatileImage;
import sun.awt.image.VolatileSurfaceManager;
import sun.java2d.SurfaceData;
import sun.java2d.opengl.OGLSurfaceData;

import java.awt.*;
import java.awt.image.ColorModel;

import static java.awt.BufferCapabilities.FlipContents.COPIED;
import sun.java2d.pipe.hw.AccelSurface;

public class MTLVolatileSurfaceManager extends VolatileSurfaceManager {

@@ -43,24 +41,19 @@ public MTLVolatileSurfaceManager(SunVolatileImage vImg, Object context) {
super(vImg, context);

/*
* We will attempt to accelerate this image only under the
* following conditions:
* - the image is not bitmask AND the GraphicsConfig supports the FBO
* extension
* We will attempt to accelerate this image only
* if the image is not bitmask
*/
int transparency = vImg.getTransparency();
MTLGraphicsConfig gc = (MTLGraphicsConfig) vImg.getGraphicsConfig();
accelerationEnabled = true;
//gc.isCapPresent(CAPS_EXT_FBOBJECT)
//&& transparency != Transparency.BITMASK;
accelerationEnabled = transparency != Transparency.BITMASK;
}

protected boolean isAccelerationEnabled() {
return accelerationEnabled;
}

/**
* Create a FBO-based SurfaceData object (or init the backbuffer
* Create a SurfaceData object (or init the backbuffer
* of an existing window if this is a double buffered GraphicsConfig)
*/
protected SurfaceData initAcceleratedSurface() {
@@ -71,8 +64,8 @@ protected SurfaceData initAcceleratedSurface() {
int type = vImg.getForcedAccelSurfaceType();
// if acceleration type is forced (type != UNDEFINED) then
// use the forced type, otherwise choose RT_TEXTURE
if (type == OGLSurfaceData.UNDEFINED) {
type = OGLSurfaceData.FBOBJECT;
if (type == AccelSurface.UNDEFINED) {
type = AccelSurface.RT_TEXTURE;
}
return MTLSurfaceData.createData(gc,
vImg.getWidth(),
@@ -90,7 +83,7 @@ protected boolean isConfigValid(GraphicsConfiguration gc) {

@Override
public void initContents() {
if (vImg.getForcedAccelSurfaceType() != OGLSurfaceData.TEXTURE) {
if (vImg.getForcedAccelSurfaceType() != AccelSurface.TEXTURE) {
super.initContents();
}
}

0 comments on commit dd770c0

Please sign in to comment.