os/graphics/m3g/m3gcore11/inc/m3g_image.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/m3g/m3gcore11/inc/m3g_image.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,135 @@
     1.4 +/*
     1.5 +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: Image interface
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +#ifndef __M3G_IMAGE_H__
    1.22 +#define __M3G_IMAGE_H__
    1.23 +
    1.24 +/*!
    1.25 + * \internal
    1.26 + * \file
    1.27 + * \brief Image interface
    1.28 + */
    1.29 +
    1.30 +#include "m3g_object.h"
    1.31 +#include "m3g_gl.h"
    1.32 +
    1.33 +#if !defined(M3G_NGL_TEXTURE_API)
    1.34 +typedef struct LargeImageImpl LargeImage;
    1.35 +#endif
    1.36 +
    1.37 +/*!
    1.38 + * \internal
    1.39 + * \brief Image object
    1.40 + */
    1.41 +struct M3GImageImpl
    1.42 +{
    1.43 +    Object object;
    1.44 +
    1.45 +    M3Gint width, height;
    1.46 +    M3GImageFormat format;
    1.47 +    M3GPixelFormat internalFormat;
    1.48 +
    1.49 +    Image *powerOfTwo;
    1.50 +
    1.51 +    GLenum glFormat;
    1.52 +#   if !defined(M3G_NGL_TEXTURE_API)
    1.53 +    GLuint texObject;
    1.54 +    LargeImage *large;  /*! \internal \ */
    1.55 +#   endif
    1.56 +
    1.57 +    M3GMemObject data;
    1.58 +    M3GMemObject mipData;
    1.59 +    M3Gsizei paletteBytes;
    1.60 +
    1.61 +    M3Gbitmask flags            : 8; /* flags defined in m3g_core.h */
    1.62 +    M3Gbitmask special          : 8; /* flags defined below */
    1.63 +    
    1.64 +    M3Gbool pinned              : 1; /* image can not be deleted */
    1.65 +    M3Gbool dirty               : 1;
    1.66 +    M3Gbool powerOfTwoDirty     : 1;
    1.67 +    M3Gbool mipDataMapCount     : 4; /* max. 16 concurrent uses */
    1.68 +#   if !defined(M3G_NGL_TEXTURE_API)
    1.69 +    M3Gbool mipmapsDirty        : 1; /*!< \internal 'dirty' overrides this */
    1.70 +#   endif
    1.71 +
    1.72 +    /* For easy cloning of immutable images without replicating the
    1.73 +     * data, we must keep a reference to the original so that it isn't
    1.74 +     * deleted until we are */
    1.75 +    
    1.76 +    Image *copyOf;
    1.77 +};
    1.78 +
    1.79 +/*!
    1.80 + * \internal \brief "special" flag bits */
    1.81 +#define IMG_NPOT        0x01
    1.82 +#define IMG_LARGE       0x02
    1.83 +
    1.84 +/*----------------------------------------------------------------------
    1.85 + * Internal functions
    1.86 + *--------------------------------------------------------------------*/
    1.87 +
    1.88 +static void m3gBindTextureImage(Image *img, M3Genum levelFilter, M3Genum imageFilter);
    1.89 +static void m3gReleaseTextureImage(Image *img);
    1.90 +
    1.91 +static Image *m3gGetPowerOfTwoImage(Image *img);
    1.92 +
    1.93 +static M3GPixelFormat m3gPixelFormat  (M3GImageFormat format);
    1.94 +static M3Gint         m3gBytesPerPixel(M3GPixelFormat format);
    1.95 +
    1.96 +static void m3gConvertPixels(M3GPixelFormat srcFormat, const M3Gubyte *src,
    1.97 +                             M3GPixelFormat dstFormat, M3Gubyte *dst,
    1.98 +                             M3Gsizei count);
    1.99 +
   1.100 +static void m3gConvertPixelRect(
   1.101 +    M3GPixelFormat srcFormat, const M3Gubyte *src, M3Gsizei srcStride,
   1.102 +    M3Gsizei width, M3Gsizei height,
   1.103 +    M3GPixelFormat dstFormat, M3Gubyte *dst, M3Gsizei dstStride);
   1.104 +
   1.105 +static void m3gCopyImagePixels(Image *dst, const Image *src);
   1.106 +#if !defined(M3G_NGL_TEXTURE_API)
   1.107 +static void m3gCopyFrameBufferImage(Image *dst);
   1.108 +static void m3gDrawFrameBufferImage(RenderContext *ctx, const Image *src);
   1.109 +#endif /* !defined(M3G_NGL_TEXTURE_API)*/
   1.110 +
   1.111 +static void m3gInvalidateImage(Image *img);
   1.112 +
   1.113 +#if defined(M3G_NGL_TEXTURE_API)
   1.114 +static M3Gbool m3gValidateMipmapMemory(Image *img);
   1.115 +#endif
   1.116 +
   1.117 +/*! \internal */
   1.118 +static M3Gsizei m3gGetImageStride(const Image *img);
   1.119 +
   1.120 +static M3Gint m3gGetAlpha(Image *image, M3Gint x, M3Gint y);
   1.121 +
   1.122 +static M3G_INLINE M3Gbool m3gIsInternallyPaletted(const Image *img)
   1.123 +{
   1.124 +    return (img->paletteBytes > 0);
   1.125 +}
   1.126 +
   1.127 +#if 0
   1.128 +/*!
   1.129 + * \internal
   1.130 + * \brief Type-safe helper function
   1.131 + */
   1.132 +static M3G_INLINE void m3gDeleteImage(Image *img)
   1.133 +{
   1.134 +    m3gDeleteObject((Object*) img);
   1.135 +}
   1.136 +#endif
   1.137 +
   1.138 +#endif /*__M3G_IMAGE_H__*/