javauis/m2g_qt/src/jni/M2GSVGSVGElement.cpp
changeset 80 d6dafc5d983f
child 87 1627c337e51e
equal deleted inserted replaced
78:71ad690e91f5 80:d6dafc5d983f
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  JNI methods
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "com_nokia_microedition_m2g_M2GSVGSVGElement.h"
       
    20 #include "MM2GSVGProxy.h"
       
    21 
       
    22 M2G_NS_START
       
    23 
       
    24 // EXTERNAL DATA STRUCTURES
       
    25 
       
    26 // EXTERNAL FUNCTION PROTOTYPES
       
    27 
       
    28 // CONSTANTS
       
    29 
       
    30 // MACROS
       
    31 
       
    32 // LOCAL CONSTANTS AND MACROS
       
    33 
       
    34 // MODULE DATA STRUCTURES
       
    35 
       
    36 // LOCAL FUNCTION PROTOTYPES
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 // ================================ FUNCTIONS ==================================
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // Java_com_nokia_microedition_m2g_M2GSVGImage::_getMediaTime
       
    46 // -----------------------------------------------------------------------------
       
    47 /**
       
    48  * Calls MM2GSVGProxy::GetMediaTimeL method.
       
    49  * @since Series S60 3.0
       
    50  * @param aProxy Proxy instance.
       
    51  * @param aDocumentHandle Document handle
       
    52  * @param aSeconds Media time to be returned.
       
    53  */
       
    54 JNIEXPORT jfloat JNICALL
       
    55 Java_com_nokia_microedition_m2g_M2GSVGSVGElement__1getMediaTime(
       
    56     JNIEnv* aJni,
       
    57     jclass,
       
    58     jint aSvgProxyHandle,
       
    59     jint aDocumentHandle)
       
    60 {
       
    61     M2G_DEBUG_0("JNI ( M2GSVGSVGElement ) _getMediaTime - begin");
       
    62     TReal32 seconds = 0;
       
    63     TInt err = KM2GNotOk;
       
    64     
       
    65     M2G_DO_LOCK
       
    66     if (aSvgProxyHandle)
       
    67         {
       
    68         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
    69         TRAP(err, aProxy->GetMediaTimeL(STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),seconds); );
       
    70         }
       
    71     M2G_DO_UNLOCK(aJni)
       
    72 
       
    73     M2GGeneral::CheckErrorCode(aJni, err);
       
    74  
       
    75     M2G_DEBUG_1("JNI ( M2GSVGSVGElement ) _getMediaTime: %f - end", seconds);
       
    76     return STATIC_CAST(jfloat, seconds);
       
    77 }
       
    78 
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // Java_com_nokia_microedition_m2g_M2GSVGImage::_setMediaTime
       
    82 // -----------------------------------------------------------------------------
       
    83 /**
       
    84  * Calls MM2GSVGProxy::SetMediaTimeL method.
       
    85  * @since Series S60 3.0
       
    86  * @param aProxy Proxy instance.
       
    87  * @param aDocumentHandle Document handle
       
    88  * @param aSeconds Media time
       
    89  */
       
    90 JNIEXPORT void JNICALL
       
    91 Java_com_nokia_microedition_m2g_M2GSVGSVGElement__1setMediaTime(
       
    92     JNIEnv* aJni,
       
    93     jclass,
       
    94     jint aSvgProxyHandle,
       
    95     jint aDocumentHandle,
       
    96     jfloat aSeconds
       
    97 )
       
    98 {
       
    99     M2G_DEBUG_0("JNI ( M2GSVGSVGElement ) _setMediaTime - begin");
       
   100     TInt err = KM2GNotOk;
       
   101     
       
   102     TReal32* lseconds = REINTERPRET_CAST(TReal32*, &aSeconds);
       
   103     
       
   104     M2G_DO_LOCK
       
   105     if (aSvgProxyHandle)
       
   106         {
       
   107         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   108         TRAP(err, aProxy->SetMediaTimeL(
       
   109                 STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
       
   110                 *lseconds); );
       
   111         }
       
   112     M2G_DO_UNLOCK(aJni)
       
   113     
       
   114     M2GGeneral::CheckErrorCode(aJni, err);
       
   115 
       
   116     M2G_DEBUG_1("JNI ( M2GSVGSVGElement ) _setMediaTime: %f - end", aSeconds);
       
   117 }