Home | History | Annotate | Download | only in xml
      1 /*
      2  * Copyright (C) 2006 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #include "SkTypes.h"
     18 #include "SkWindow.h"
     19 
     20 extern "C" {
     21     typedef long JSWord;
     22     typedef JSWord jsword;
     23     typedef jsword  jsval;
     24     typedef struct JSRuntime JSRuntime;
     25     typedef struct JSContext JSContext;
     26     typedef struct JSObject JSObject;
     27 }
     28 
     29 class SkString;
     30 
     31 class SkJS : public SkOSWindow {
     32 public:
     33     SkJS(void* hwnd);
     34     ~SkJS();
     35     SkBool EvaluateScript(const char* script, jsval* rVal);
     36     SkBool ValueToString(jsval value, SkString* string);
     37 #ifdef SK_DEBUG
     38     static void Test(void* hwnd);
     39 #endif
     40 protected:
     41     void InitializeDisplayables(const SkBitmap& , JSContext *, JSObject *, JSObject *);
     42     void DisposeDisplayables();
     43     JSRuntime *fRuntime;
     44     JSContext *fContext;
     45     JSObject *fGlobal;
     46 };
     47 
     48