jdk/src/share/classes/sun/java2d/pipe/BufferedContext.java
changeset 16734 da1901d79073
parent 12813 c10ab96dcf41
child 16843 21ec7ce3e580
equal deleted inserted replaced
16733:9267ec7004a1 16734:da1901d79073
     1 /*
     1 /*
     2  * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    35 import sun.java2d.SunGraphics2D;
    35 import sun.java2d.SunGraphics2D;
    36 import sun.java2d.loops.XORComposite;
    36 import sun.java2d.loops.XORComposite;
    37 import static sun.java2d.pipe.BufferedOpCodes.*;
    37 import static sun.java2d.pipe.BufferedOpCodes.*;
    38 import static sun.java2d.pipe.BufferedRenderPipe.BYTES_PER_SPAN;
    38 import static sun.java2d.pipe.BufferedRenderPipe.BYTES_PER_SPAN;
    39 
    39 
    40 import javax.tools.annotation.GenerateNativeHeader;
    40 import java.lang.annotation.Native;
    41 
    41 
    42 /**
    42 /**
    43  * Base context class for managing state in a single-threaded rendering
    43  * Base context class for managing state in a single-threaded rendering
    44  * environment.  Each state-setting operation (e.g. SET_COLOR) is added to
    44  * environment.  Each state-setting operation (e.g. SET_COLOR) is added to
    45  * the provided RenderQueue, which will be processed at a later time by a
    45  * the provided RenderQueue, which will be processed at a later time by a
    47  * calling the validate() method (or any other method in this class).  See
    47  * calling the validate() method (or any other method in this class).  See
    48  * the RenderQueue class comments for a sample usage scenario.
    48  * the RenderQueue class comments for a sample usage scenario.
    49  *
    49  *
    50  * @see RenderQueue
    50  * @see RenderQueue
    51  */
    51  */
    52 /* No native methods here, but the constants are needed in the supporting JNI code */
       
    53 @GenerateNativeHeader
       
    54 public abstract class BufferedContext {
    52 public abstract class BufferedContext {
    55 
    53 
    56     /*
    54     /*
    57      * The following flags help the internals of validate() determine
    55      * The following flags help the internals of validate() determine
    58      * the appropriate (meaning correct, or optimal) code path when
    56      * the appropriate (meaning correct, or optimal) code path when
    61      */
    59      */
    62 
    60 
    63     /**
    61     /**
    64      * Indicates that no flags are needed; take all default code paths.
    62      * Indicates that no flags are needed; take all default code paths.
    65      */
    63      */
    66     public static final int NO_CONTEXT_FLAGS = (0 << 0);
    64     @Native public static final int NO_CONTEXT_FLAGS = (0 << 0);
    67     /**
    65     /**
    68      * Indicates that the source surface (or color value, if it is a simple
    66      * Indicates that the source surface (or color value, if it is a simple
    69      * rendering operation) is opaque (has an alpha value of 1.0).  If this
    67      * rendering operation) is opaque (has an alpha value of 1.0).  If this
    70      * flag is present, it allows us to disable blending in certain
    68      * flag is present, it allows us to disable blending in certain
    71      * situations in order to improve performance.
    69      * situations in order to improve performance.
    72      */
    70      */
    73     public static final int SRC_IS_OPAQUE    = (1 << 0);
    71     @Native public static final int SRC_IS_OPAQUE    = (1 << 0);
    74     /**
    72     /**
    75      * Indicates that the operation uses an alpha mask, which may determine
    73      * Indicates that the operation uses an alpha mask, which may determine
    76      * the code path that is used when setting up the current paint state.
    74      * the code path that is used when setting up the current paint state.
    77      */
    75      */
    78     public static final int USE_MASK         = (1 << 1);
    76     @Native public static final int USE_MASK         = (1 << 1);
    79 
    77 
    80     protected RenderQueue rq;
    78     protected RenderQueue rq;
    81     protected RenderBuffer buf;
    79     protected RenderBuffer buf;
    82 
    80 
    83     /**
    81     /**