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