3261N/A * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * The RenderBuffer class is a simplified, high-performance, Unsafe wrapper 0N/A * used for buffering rendering operations in a single-threaded rendering 0N/A * environment. It's functionality is similar to the ByteBuffer and related 0N/A * NIO classes. However, the methods in this class perform little to no 0N/A * alignment or bounds checks for performance reasons. Therefore, it is 0N/A * the caller's responsibility to ensure that all put() calls are properly 0N/A * aligned and within bounds: 0N/A * - int and float values must be aligned on 4-byte boundaries 0N/A * - long and double values must be aligned on 8-byte boundaries 0N/A * This class only includes the bare minimum of methods to support 0N/A * single-threaded rendering. For example, there is no put(double[]) method 0N/A * because we currently have no need for such a method in the STR classes. 0N/A * These constants represent the size of various data types (in bytes). 0N/A * Represents the number of elements at which we have empirically 0N/A * determined that the average cost of a JNI call exceeds the expense 0N/A * of an element by element copy. In other words, if the number of 0N/A * elements in an array to be copied exceeds this value, then we should 0N/A * use the copyFromArray() method to complete the bulk put operation. 0N/A * (This value can be adjusted if the cost of JNI downcalls is reduced 0N/A * in a future release.) 0N/A * Allocates a fresh buffer using the machine endianness. 0N/A * Returns the base address of the underlying memory buffer. 0N/A * The behavior (and names) of the following methods are nearly 0N/A * identical to their counterparts in the various NIO Buffer classes. 0N/A * putByte() methods... 0N/A * putShort() methods... 0N/A // assert (position() % SIZEOF_SHORT == 0); 0N/A // assert (position() % SIZEOF_SHORT == 0); 0N/A * putInt() methods... 0N/A // assert (baseAddress + pos % SIZEOF_INT == 0); 0N/A // assert (position() % SIZEOF_INT == 0); 0N/A // assert (position() % SIZEOF_INT == 0); 0N/A * putFloat() methods... 0N/A // assert (position() % SIZEOF_FLOAT == 0); 0N/A // assert (position() % SIZEOF_FLOAT == 0); 0N/A * putLong() methods... 0N/A // assert (position() % SIZEOF_LONG == 0); 0N/A // assert (position() % SIZEOF_LONG == 0); 0N/A * putDouble() method(s)... 0N/A // assert (position() % SIZEOF_DOUBLE == 0);