Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.
/ lanai Public archive

8252952: Lanai: VolatileImage/BitmaskVolatileImage test fails #158

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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;
}

Original file line number Diff line number Diff line change
@@ -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();
}
}