1 /*
2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
132 XDoubleToFixed(transform.getScaleX()),
133 XDoubleToFixed(transform.getShearX()),
134 XDoubleToFixed(transform.getTranslateX()),
135 XDoubleToFixed(transform.getShearY()),
136 XDoubleToFixed(transform.getScaleY()),
137 XDoubleToFixed(transform.getTranslateY()));
138 }
139
140 public void renderRectangle(int dst, byte op, XRColor color,
141 int x, int y, int width, int height) {
142 renderRectangle(dst, op, (short)color.red, (short)color.green,
143 (short)color.blue, (short)color.alpha,
144 x, y, width, height);
145 }
146
147 private short[] getRenderColors(int[] pixels) {
148 short[] renderColors = new short[pixels.length * 4];
149
150 XRColor c = new XRColor();
151 for (int i = 0; i < pixels.length; i++) {
152 c.setColorValues(pixels[i], true);
153 renderColors[i * 4 + 0] = (short) c.alpha;
154 renderColors[i * 4 + 1] = (short) c.red;
155 renderColors[i * 4 + 2] = (short) c.green;
156 renderColors[i * 4 + 3] = (short) c.blue;
157 }
158
159 return renderColors;
160 }
161
162 private static long getFormatPtr(int formatID) {
163 switch (formatID) {
164 case XRUtils.PictStandardA8:
165 return FMTPTR_A8;
166 case XRUtils.PictStandardARGB32:
167 return FMTPTR_ARGB32;
168 }
169
170 return 0L;
171 }
172
|
1 /*
2 * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
132 XDoubleToFixed(transform.getScaleX()),
133 XDoubleToFixed(transform.getShearX()),
134 XDoubleToFixed(transform.getTranslateX()),
135 XDoubleToFixed(transform.getShearY()),
136 XDoubleToFixed(transform.getScaleY()),
137 XDoubleToFixed(transform.getTranslateY()));
138 }
139
140 public void renderRectangle(int dst, byte op, XRColor color,
141 int x, int y, int width, int height) {
142 renderRectangle(dst, op, (short)color.red, (short)color.green,
143 (short)color.blue, (short)color.alpha,
144 x, y, width, height);
145 }
146
147 private short[] getRenderColors(int[] pixels) {
148 short[] renderColors = new short[pixels.length * 4];
149
150 XRColor c = new XRColor();
151 for (int i = 0; i < pixels.length; i++) {
152 c.setColorValues(pixels[i]);
153 renderColors[i * 4 + 0] = (short) c.alpha;
154 renderColors[i * 4 + 1] = (short) c.red;
155 renderColors[i * 4 + 2] = (short) c.green;
156 renderColors[i * 4 + 3] = (short) c.blue;
157 }
158
159 return renderColors;
160 }
161
162 private static long getFormatPtr(int formatID) {
163 switch (formatID) {
164 case XRUtils.PictStandardA8:
165 return FMTPTR_A8;
166 case XRUtils.PictStandardARGB32:
167 return FMTPTR_ARGB32;
168 }
169
170 return 0L;
171 }
172
|