michael@0: /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: package org.mozilla.gecko.gfx; michael@0: michael@0: import javax.microedition.khronos.opengles.GL10; michael@0: michael@0: /** Information needed to render Cairo bitmaps using OpenGL ES. */ michael@0: public class CairoGLInfo { michael@0: public final int internalFormat; michael@0: public final int format; michael@0: public final int type; michael@0: michael@0: public CairoGLInfo(int cairoFormat) { michael@0: switch (cairoFormat) { michael@0: case CairoImage.FORMAT_ARGB32: michael@0: internalFormat = format = GL10.GL_RGBA; type = GL10.GL_UNSIGNED_BYTE; michael@0: break; michael@0: case CairoImage.FORMAT_RGB24: michael@0: internalFormat = format = GL10.GL_RGB; type = GL10.GL_UNSIGNED_BYTE; michael@0: break; michael@0: case CairoImage.FORMAT_RGB16_565: michael@0: internalFormat = format = GL10.GL_RGB; type = GL10.GL_UNSIGNED_SHORT_5_6_5; michael@0: break; michael@0: case CairoImage.FORMAT_A8: michael@0: case CairoImage.FORMAT_A1: michael@0: throw new RuntimeException("Cairo FORMAT_A1 and FORMAT_A8 unsupported"); michael@0: default: michael@0: throw new RuntimeException("Unknown Cairo format"); michael@0: } michael@0: } michael@0: } michael@0: