photos_plat/gallery_utilities_api/inc/glxthumbnailattributeinfo.inl
changeset 0 4e91876724a2
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    Thumbnail Info
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include <fbs.h>
       
    22 
       
    23 // ---------------------------------------------------------------------------
       
    24 // GlxFullThumbnailAttributeId
       
    25 // ---------------------------------------------------------------------------
       
    26 //
       
    27 inline TUint GlxFullThumbnailAttributeId(TBool aHighQuality,
       
    28                                             TInt aWidth, TInt aHeight)
       
    29     {
       
    30     return ((aHighQuality ? 0xA0000000u : 0x80000000u)
       
    31             | ((aWidth & 0x7FFFu) << 15) | (aHeight & 0x7FFFu));
       
    32     }
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // GlxZoomedThumbnailAttributeId
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 inline TUint GlxZoomedThumbnailAttributeId(TInt aZoomLevel,
       
    39                                             TInt aXIndex, TInt aYIndex)
       
    40     {
       
    41     return (((aZoomLevel & 0x7u) << 28)
       
    42             | ((aXIndex & 0xFFFu) << 12) | (aYIndex & 0xFFFu));
       
    43     }
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // GlxIsFullThumbnailAttribute
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 inline TBool GlxIsFullThumbnailAttribute(TUint aAttributeId)
       
    50     {
       
    51     return (aAttributeId & 0x80000000u);
       
    52     }
       
    53 
       
    54 // ---------------------------------------------------------------------------
       
    55 // GlxZoomedThumbnailZoomLevel
       
    56 // ---------------------------------------------------------------------------
       
    57 //
       
    58 inline TInt GlxZoomedThumbnailZoomLevel(TUint aAttributeId)
       
    59     {
       
    60     return (aAttributeId >> 28) & 0x7u;
       
    61     }
       
    62 
       
    63 // ---------------------------------------------------------------------------
       
    64 // C++ default constructor can NOT contain any code that might leave.
       
    65 // ---------------------------------------------------------------------------
       
    66 //
       
    67 inline CGlxThumbnailAttribute::CGlxThumbnailAttribute()
       
    68     {
       
    69     }
       
    70 
       
    71 // ---------------------------------------------------------------------------
       
    72 // Destructor
       
    73 // ---------------------------------------------------------------------------
       
    74 //
       
    75 inline CGlxThumbnailAttribute::~CGlxThumbnailAttribute()
       
    76     {
       
    77     delete iBitmap;
       
    78     }
       
    79 
       
    80 // ---------------------------------------------------------------------------
       
    81 // ExternalizeL
       
    82 // ---------------------------------------------------------------------------
       
    83 //
       
    84 inline void CGlxThumbnailAttribute::ExternalizeL(RWriteStream& aStream) const
       
    85     {
       
    86     aStream.WriteInt32L(iThumbnailQuality);
       
    87     aStream.WriteInt32L(iCroppingRect.iTl.iX);
       
    88     aStream.WriteInt32L(iCroppingRect.iTl.iY);
       
    89     aStream.WriteInt32L(iCroppingRect.iBr.iX);
       
    90     aStream.WriteInt32L(iCroppingRect.iBr.iY);
       
    91     aStream.WriteInt32L(iDimensions.iWidth);
       
    92     aStream.WriteInt32L(iDimensions.iHeight);
       
    93     }
       
    94 
       
    95 // ---------------------------------------------------------------------------
       
    96 // InternalizeL
       
    97 // ---------------------------------------------------------------------------
       
    98 //
       
    99 void CGlxThumbnailAttribute::InternalizeL(RReadStream& aStream)
       
   100     {
       
   101     iThumbnailQuality=aStream.ReadInt32L();
       
   102     iCroppingRect.iTl.iX=aStream.ReadInt32L();
       
   103     iCroppingRect.iTl.iY=aStream.ReadInt32L();
       
   104     iCroppingRect.iBr.iX=aStream.ReadInt32L();
       
   105     iCroppingRect.iBr.iY=aStream.ReadInt32L();
       
   106     iDimensions.iWidth=aStream.ReadInt32L();
       
   107     iDimensions.iHeight=aStream.ReadInt32L();
       
   108     }