Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- |
michael@0 | 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | package org.mozilla.gecko.gfx; |
michael@0 | 7 | |
michael@0 | 8 | import javax.microedition.khronos.opengles.GL10; |
michael@0 | 9 | |
michael@0 | 10 | /** Information needed to render Cairo bitmaps using OpenGL ES. */ |
michael@0 | 11 | public class CairoGLInfo { |
michael@0 | 12 | public final int internalFormat; |
michael@0 | 13 | public final int format; |
michael@0 | 14 | public final int type; |
michael@0 | 15 | |
michael@0 | 16 | public CairoGLInfo(int cairoFormat) { |
michael@0 | 17 | switch (cairoFormat) { |
michael@0 | 18 | case CairoImage.FORMAT_ARGB32: |
michael@0 | 19 | internalFormat = format = GL10.GL_RGBA; type = GL10.GL_UNSIGNED_BYTE; |
michael@0 | 20 | break; |
michael@0 | 21 | case CairoImage.FORMAT_RGB24: |
michael@0 | 22 | internalFormat = format = GL10.GL_RGB; type = GL10.GL_UNSIGNED_BYTE; |
michael@0 | 23 | break; |
michael@0 | 24 | case CairoImage.FORMAT_RGB16_565: |
michael@0 | 25 | internalFormat = format = GL10.GL_RGB; type = GL10.GL_UNSIGNED_SHORT_5_6_5; |
michael@0 | 26 | break; |
michael@0 | 27 | case CairoImage.FORMAT_A8: |
michael@0 | 28 | case CairoImage.FORMAT_A1: |
michael@0 | 29 | throw new RuntimeException("Cairo FORMAT_A1 and FORMAT_A8 unsupported"); |
michael@0 | 30 | default: |
michael@0 | 31 | throw new RuntimeException("Unknown Cairo format"); |
michael@0 | 32 | } |
michael@0 | 33 | } |
michael@0 | 34 | } |
michael@0 | 35 |