src/java.desktop/macosx/classes/sun/java2d/metal/MetalSurfaceData.java
branchmetal-prototype-branch
changeset 57243 8c3a74033daf
parent 57196 a95707a39ff5
equal deleted inserted replaced
57234:e1e5386479c4 57243:8c3a74033daf
    25 
    25 
    26 package sun.java2d.metal;
    26 package sun.java2d.metal;
    27 
    27 
    28 import java.awt.*;
    28 import java.awt.*;
    29 
    29 
       
    30 import sun.awt.image.PixelConverter;
    30 import sun.java2d.SurfaceData;
    31 import sun.java2d.SurfaceData;
    31 
    32 
    32 import java.awt.Composite;
    33 import java.awt.Composite;
    33 import sun.java2d.loops.CompositeType;
    34 import sun.java2d.loops.CompositeType;
    34 import sun.java2d.loops.GraphicsPrimitive;
    35 import sun.java2d.loops.GraphicsPrimitive;
    63     protected int type;
    64     protected int type;
    64     protected static ParallelogramPipe mtlAAPgramPipe;
    65     protected static ParallelogramPipe mtlAAPgramPipe;
    65     protected static MetalRenderer mtlRenderPipe;
    66     protected static MetalRenderer mtlRenderPipe;
    66     protected static PixelToParallelogramConverter mtlTxRenderPipe;
    67     protected static PixelToParallelogramConverter mtlTxRenderPipe;
    67 
    68 
       
    69     /**
       
    70      * SurfaceTypes
       
    71      */
       
    72     private static final String DESC_METAL_SURFACE = "Metal Surface";
       
    73 
       
    74     static final SurfaceType MetalSurface =
       
    75             SurfaceType.Any.deriveSubType(DESC_METAL_SURFACE,
       
    76                     PixelConverter.ArgbPre.instance);
       
    77 
    68     private native int getTextureTarget(long pData);
    78     private native int getTextureTarget(long pData);
    69     private native int getTextureID(long pData);
    79     private native int getTextureID(long pData);
    70     protected native boolean initTexture(long pData,
    80     protected native boolean initTexture(long pData,
    71                                          boolean isOpaque,
    81                                          boolean isOpaque,
    72                                          int width, int height);
    82                                          int width, int height);
    81 
    91 
    82             mtlTxRenderPipe =
    92             mtlTxRenderPipe =
    83                 new PixelToParallelogramConverter(mtlRenderPipe,
    93                 new PixelToParallelogramConverter(mtlRenderPipe,
    84                                                   mtlRenderPipe,
    94                                                   mtlRenderPipe,
    85                                                   1.0, 0.25, true);
    95                                                   1.0, 0.25, true);
       
    96             MetalBlitLoops.register();
    86         }
    97         }
    87     }
    98     }
    88 
    99 
    89     native void validate(int xoff, int yoff, int width, int height, boolean isOpaque);
   100     native void validate(int xoff, int yoff, int width, int height, boolean isOpaque);
    90 
   101 
    93 
   104 
    94     MetalSurfaceData(MetalGraphicsConfig gc, ColorModel cm, int type,
   105     MetalSurfaceData(MetalGraphicsConfig gc, ColorModel cm, int type,
    95                      int width, int height) {
   106                      int width, int height) {
    96         // TODO : Map the coming type to proper custom type and call super()
   107         // TODO : Map the coming type to proper custom type and call super()
    97         //super(gc, cm, type);
   108         //super(gc, cm, type);
    98         super(SurfaceType.Any3Byte, cm );
   109         //super(SurfaceType.Any3Byte, cm );
       
   110         super(MetalSurface, cm );
    99         // TEXTURE shouldn't be scaled, it is used for managed BufferedImages.
   111         // TEXTURE shouldn't be scaled, it is used for managed BufferedImages.
   100         // TODO : We need to set scale factor
   112         // TODO : We need to set scale factor
   101         //scale = type == TEXTURE ? 1 : gc.getDevice().getScaleFactor();
   113         //scale = type == TEXTURE ? 1 : gc.getDevice().getScaleFactor();
   102         this.width = width ;// * scale;
   114         this.width = width ;// * scale;
   103         this.height = height;// * scale;
   115         this.height = height;// * scale;