1 /* 2 * Copyright (c) 2019, 2019, 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 23 * questions. 24 */ 25 26 #ifndef MetalRenderer_h_Included 27 #define MetalRenderer_h_Included 28 29 #include "sun_java2d_pipe_BufferedRenderPipe.h" 30 #import <Metal/Metal.h> 31 //#include "MetalContext.h" 32 33 // define this in MetalContext 34 typedef struct 35 { 36 int info; 37 } MetalContext; 38 39 #define BYTES_PER_POLY_POINT \ 40 sun_java2d_pipe_BufferedRenderPipe_BYTES_PER_POLY_POINT 41 #define BYTES_PER_SCANLINE \ 42 sun_java2d_pipe_BufferedRenderPipe_BYTES_PER_SCANLINE 43 #define BYTES_PER_SPAN \ 44 sun_java2d_pipe_BufferedRenderPipe_BYTES_PER_SPAN 45 // TODO : We might not need MetalContext itself in our case, 46 // just having SDOps for destination can suffice 47 void MetalRenderer_DrawLine(MetalContext *mtlc, 48 jint x1, jint y1, jint x2, jint y2); 49 50 51 void MetalRenderer_DrawRect(MetalContext *mtlc, 52 jint x, jint y, jint w, jint h); 53 54 void MetalRenderer_FillRect(MetalContext *mtlc, 55 jint x, jint y, jint w, jint h); 56 57 void MetalRenderer_SetColor(MetalContext *mtlc, jint color); 58 59 60 void 61 MetalRenderer_DrawParallelogram(MetalContext *mtlc, 62 jfloat fx11, jfloat fy11, 63 jfloat dx21, jfloat dy21, 64 jfloat dx12, jfloat dy12, 65 jfloat lwr21, jfloat lwr12); 66 void 67 MetalRenderer_FillParallelogram(MetalContext *mtlc, 68 jfloat fx11, jfloat fy11, 69 jfloat dx21, jfloat dy21, 70 jfloat dx12, jfloat dy12); 71 void FILL_PGRAM(float fx11, float fy11, float dx21, float dy21, float dx12, float dy12); 72 void MetalRenderer_DrawQuad(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4); 73 74 void MetalRenderer_Flush(); 75 void MetalRenderer_blitToScreenDrawable(); 76 77 void MetalRenderer_SetRectClip(MetalContext *mtlc, jint x1, jint y1, jint x2, jint y2); 78 79 /*void OGLRenderer_DrawRect(OGLContext *oglc, 80 jint x, jint y, jint w, jint h); 81 void OGLRenderer_DrawPoly(OGLContext *oglc, 82 jint nPoints, jint isClosed, 83 jint transX, jint transY, 84 jint *xPoints, jint *yPoints); 85 void OGLRenderer_DrawScanlines(OGLContext *oglc, 86 jint count, jint *scanlines); 87 void OGLRenderer_DrawParallelogram(OGLContext *oglc, 88 jfloat fx11, jfloat fy11, 89 jfloat dx21, jfloat dy21, 90 jfloat dx12, jfloat dy12, 91 jfloat lw21, jfloat lw12); 92 void OGLRenderer_DrawAAParallelogram(OGLContext *oglc, OGLSDOps *dstOps, 93 jfloat fx11, jfloat fy11, 94 jfloat dx21, jfloat dy21, 95 jfloat dx12, jfloat dy12, 96 jfloat lw21, jfloat lw12); 97 98 void OGLRenderer_FillRect(OGLContext *oglc, 99 jint x, jint y, jint w, jint h); 100 void OGLRenderer_FillSpans(OGLContext *oglc, 101 jint count, jint *spans); 102 void OGLRenderer_FillParallelogram(OGLContext *oglc, 103 jfloat fx11, jfloat fy11, 104 jfloat dx21, jfloat dy21, 105 jfloat dx12, jfloat dy12); 106 void OGLRenderer_FillAAParallelogram(OGLContext *oglc, OGLSDOps *dstOps, 107 jfloat fx11, jfloat fy11, 108 jfloat dx21, jfloat dy21, 109 jfloat dx12, jfloat dy12); 110 111 void OGLRenderer_EnableAAParallelogramProgram(); 112 void OGLRenderer_DisableAAParallelogramProgram();*/ 113 114 #endif /* MetalRenderer_h_Included */