gfx/skia/trunk/src/xml/SkJSDisplayable.cpp

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1
michael@0 2 /*
michael@0 3 * Copyright 2006 The Android Open Source Project
michael@0 4 *
michael@0 5 * Use of this source code is governed by a BSD-style license that can be
michael@0 6 * found in the LICENSE file.
michael@0 7 */
michael@0 8
michael@0 9
michael@0 10 #include <jsapi.h>
michael@0 11 #include "SkJS.h"
michael@0 12 #include "SkDisplayType.h"
michael@0 13 //#include "SkAnimateColor.h"
michael@0 14 #include "SkAnimateMaker.h"
michael@0 15 #include "SkAnimateSet.h"
michael@0 16 //#include "SkAnimateTransform.h"
michael@0 17 #include "SkCanvas.h"
michael@0 18 //#include "SkDimensions.h"
michael@0 19 #include "SkDisplayAdd.h"
michael@0 20 #include "SkDisplayApply.h"
michael@0 21 //#include "SkDisplayBefore.h"
michael@0 22 #include "SkDisplayEvent.h"
michael@0 23 //#include "SkDisplayFocus.h"
michael@0 24 #include "SkDisplayInclude.h"
michael@0 25 #include "SkDisplayPost.h"
michael@0 26 #include "SkDisplayRandom.h"
michael@0 27 #include "SkDraw3D.h"
michael@0 28 #include "SkDrawBitmap.h"
michael@0 29 #include "SkDrawClip.h"
michael@0 30 #include "SkDrawDash.h"
michael@0 31 #include "SkDrawDiscrete.h"
michael@0 32 #include "SkDrawEmboss.h"
michael@0 33 //#include "SkDrawFont.h"
michael@0 34 #include "SkDrawFull.h"
michael@0 35 #include "SkDrawGradient.h"
michael@0 36 #include "SkDrawLine.h"
michael@0 37 //#include "SkDrawMaskFilter.h"
michael@0 38 #include "SkDrawMatrix.h"
michael@0 39 #include "SkDrawOval.h"
michael@0 40 #include "SkDrawPaint.h"
michael@0 41 #include "SkDrawPath.h"
michael@0 42 #include "SkDrawPoint.h"
michael@0 43 // #include "SkDrawStroke.h"
michael@0 44 #include "SkDrawText.h"
michael@0 45 #include "SkDrawTo.h"
michael@0 46 //#include "SkDrawTransferMode.h"
michael@0 47 #include "SkDrawTransparentShader.h"
michael@0 48 //#include "SkDrawUse.h"
michael@0 49 #include "SkMatrixParts.h"
michael@0 50 #include "SkPathParts.h"
michael@0 51 #include "SkPostParts.h"
michael@0 52 #include "SkScript.h"
michael@0 53 #include "SkSnapshot.h"
michael@0 54 #include "SkTextOnPath.h"
michael@0 55 #include "SkTextToPath.h"
michael@0 56
michael@0 57
michael@0 58 class SkJSDisplayable {
michael@0 59 public:
michael@0 60 SkJSDisplayable() : fDisplayable(NULL) {}
michael@0 61 ~SkJSDisplayable() { delete fDisplayable; }
michael@0 62 static void Destructor(JSContext *cx, JSObject *obj);
michael@0 63 static JSBool GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
michael@0 64 static JSBool SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
michael@0 65 static SkCanvas* gCanvas;
michael@0 66 static SkPaint* gPaint;
michael@0 67 static JSBool Draw(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
michael@0 68 SkDisplayable* fDisplayable;
michael@0 69 };
michael@0 70
michael@0 71 SkCanvas* SkJSDisplayable::gCanvas;
michael@0 72 SkPaint* SkJSDisplayable::gPaint;
michael@0 73
michael@0 74 JSBool SkJSDisplayable::Draw(JSContext *cx, JSObject *obj, uintN argc,
michael@0 75 jsval *argv, jsval *rval)
michael@0 76 {
michael@0 77 SkJSDisplayable *p = (SkJSDisplayable*) JS_GetPrivate(cx, obj);
michael@0 78 SkASSERT(p->fDisplayable->isDrawable());
michael@0 79 SkDrawable* drawable = (SkDrawable*) p->fDisplayable;
michael@0 80 SkAnimateMaker maker(NULL, gCanvas, gPaint);
michael@0 81 drawable->draw(maker);
michael@0 82 return JS_TRUE;
michael@0 83 }
michael@0 84
michael@0 85
michael@0 86 JSFunctionSpec SkJSDisplayable_methods[] =
michael@0 87 {
michael@0 88 { "draw", SkJSDisplayable::Draw, 1, 0, 0 },
michael@0 89 { 0 }
michael@0 90 };
michael@0 91
michael@0 92 static JSPropertySpec* gDisplayableProperties[kNumberOfTypes];
michael@0 93 static JSClass gDisplayableClasses[kNumberOfTypes];
michael@0 94
michael@0 95 #define JS_INIT(_prefix, _class) \
michael@0 96 static JSBool _class##Constructor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { \
michael@0 97 SkJSDisplayable* jsDisplayable = new SkJSDisplayable(); \
michael@0 98 jsDisplayable->fDisplayable = new _prefix##_class(); \
michael@0 99 JS_SetPrivate(cx, obj, (void*) jsDisplayable); \
michael@0 100 return JS_TRUE; \
michael@0 101 } \
michael@0 102 \
michael@0 103 static JSObject* _class##Init(JSContext *cx, JSObject *obj, JSObject *proto) { \
michael@0 104 JSObject *newProtoObj = JS_InitClass(cx, obj, proto, &gDisplayableClasses[SkType_##_class], \
michael@0 105 _class##Constructor, 0, \
michael@0 106 NULL, SkJSDisplayable_methods , \
michael@0 107 NULL, NULL); \
michael@0 108 JS_DefineProperties(cx, newProtoObj, gDisplayableProperties[SkType_##_class]); \
michael@0 109 return newProtoObj; \
michael@0 110 }
michael@0 111
michael@0 112 JS_INIT(Sk, Add)
michael@0 113 JS_INIT(Sk, AddCircle)
michael@0 114 JS_INIT(Sk, AddOval)
michael@0 115 JS_INIT(Sk, AddPath)
michael@0 116 JS_INIT(Sk, AddRectangle)
michael@0 117 JS_INIT(Sk, AddRoundRect)
michael@0 118 //JS_INIT(Sk, After)
michael@0 119 JS_INIT(Sk, Apply)
michael@0 120 // JS_INIT(Sk, Animate)
michael@0 121 //JS_INIT(Sk, AnimateColor)
michael@0 122 JS_INIT(Sk, AnimateField)
michael@0 123 //JS_INIT(Sk, AnimateRotate)
michael@0 124 //JS_INIT(Sk, AnimateScale)
michael@0 125 //JS_INIT(Sk, AnimateTranslate)
michael@0 126 JS_INIT(SkDraw, Bitmap)
michael@0 127 JS_INIT(Sk, BaseBitmap)
michael@0 128 //JS_INIT(Sk, Before)
michael@0 129 JS_INIT(SkDraw, BitmapShader)
michael@0 130 JS_INIT(SkDraw, Blur)
michael@0 131 JS_INIT(SkDraw, Clip)
michael@0 132 JS_INIT(SkDraw, Color)
michael@0 133 JS_INIT(Sk, CubicTo)
michael@0 134 JS_INIT(Sk, Dash)
michael@0 135 JS_INIT(Sk, Data)
michael@0 136 //JS_INIT(Sk, Dimensions)
michael@0 137 JS_INIT(Sk, Discrete)
michael@0 138 JS_INIT(Sk, DrawTo)
michael@0 139 JS_INIT(SkDraw, Emboss)
michael@0 140 JS_INIT(SkDisplay, Event)
michael@0 141 // JS_INIT(SkDraw, Font)
michael@0 142 // JS_INIT(Sk, Focus)
michael@0 143 JS_INIT(Sk, Image)
michael@0 144 JS_INIT(Sk, Include)
michael@0 145 // JS_INIT(Sk, Input)
michael@0 146 JS_INIT(Sk, Line)
michael@0 147 JS_INIT(Sk, LinearGradient)
michael@0 148 JS_INIT(Sk, LineTo)
michael@0 149 JS_INIT(SkDraw, Matrix)
michael@0 150 JS_INIT(Sk, Move)
michael@0 151 JS_INIT(Sk, MoveTo)
michael@0 152 JS_INIT(Sk, Oval)
michael@0 153 JS_INIT(SkDraw, Path)
michael@0 154 JS_INIT(SkDraw, Paint)
michael@0 155 JS_INIT(Sk, DrawPoint)
michael@0 156 JS_INIT(Sk, PolyToPoly)
michael@0 157 JS_INIT(Sk, Polygon)
michael@0 158 JS_INIT(Sk, Polyline)
michael@0 159 JS_INIT(Sk, Post)
michael@0 160 JS_INIT(Sk, QuadTo)
michael@0 161 JS_INIT(Sk, RadialGradient)
michael@0 162 JS_INIT(SkDisplay, Random)
michael@0 163 JS_INIT(Sk, RectToRect)
michael@0 164 JS_INIT(Sk, Rectangle)
michael@0 165 JS_INIT(Sk, Remove)
michael@0 166 JS_INIT(Sk, Replace)
michael@0 167 JS_INIT(Sk, Rotate)
michael@0 168 JS_INIT(Sk, RoundRect)
michael@0 169 JS_INIT(Sk, Scale)
michael@0 170 JS_INIT(Sk, Set)
michael@0 171 JS_INIT(Sk, Skew)
michael@0 172 // JS_INIT(Sk, 3D_Camera)
michael@0 173 // JS_INIT(Sk, 3D_Patch)
michael@0 174 JS_INIT(Sk, Snapshot)
michael@0 175 // JS_INIT(SkDraw, Stroke)
michael@0 176 JS_INIT(Sk, Text)
michael@0 177 JS_INIT(Sk, TextOnPath)
michael@0 178 JS_INIT(Sk, TextToPath)
michael@0 179 JS_INIT(Sk, Translate)
michael@0 180 //JS_INIT(Sk, Use)
michael@0 181
michael@0 182 #if SK_USE_CONDENSED_INFO == 0
michael@0 183 static void GenerateTables() {
michael@0 184 for (int index = 0; index < kTypeNamesSize; index++) {
michael@0 185 int infoCount;
michael@0 186 SkDisplayTypes type = gTypeNames[index].fType;
michael@0 187 const SkMemberInfo* info = SkDisplayType::GetMembers(NULL /* fMaker */, type, &infoCount);
michael@0 188 if (info == NULL)
michael@0 189 continue;
michael@0 190 gDisplayableProperties[type] = new JSPropertySpec[infoCount + 1];
michael@0 191 JSPropertySpec* propertySpec = gDisplayableProperties[type];
michael@0 192 memset(propertySpec, 0, sizeof (JSPropertySpec) * (infoCount + 1));
michael@0 193 for (int inner = 0; inner < infoCount; inner++) {
michael@0 194 if (info[inner].fType == SkType_BaseClassInfo)
michael@0 195 continue;
michael@0 196 propertySpec[inner].name = info[inner].fName;
michael@0 197 propertySpec[inner].tinyid = inner;
michael@0 198 propertySpec[inner].flags = JSPROP_ENUMERATE;
michael@0 199 }
michael@0 200 gDisplayableClasses[type].name = gTypeNames[index].fName;
michael@0 201 gDisplayableClasses[type].flags = JSCLASS_HAS_PRIVATE;
michael@0 202 gDisplayableClasses[type].addProperty = JS_PropertyStub;
michael@0 203 gDisplayableClasses[type].delProperty = JS_PropertyStub;
michael@0 204 gDisplayableClasses[type].getProperty = SkJSDisplayable::GetProperty;
michael@0 205 gDisplayableClasses[type].setProperty = SkJSDisplayable::SetProperty;
michael@0 206 gDisplayableClasses[type].enumerate = JS_EnumerateStub;
michael@0 207 gDisplayableClasses[type].resolve = JS_ResolveStub;
michael@0 208 gDisplayableClasses[type].convert = JS_ConvertStub;
michael@0 209 gDisplayableClasses[type].finalize = SkJSDisplayable::Destructor;
michael@0 210 }
michael@0 211 }
michael@0 212 #endif
michael@0 213
michael@0 214 void SkJSDisplayable::Destructor(JSContext *cx, JSObject *obj) {
michael@0 215 delete (SkJSDisplayable*) JS_GetPrivate(cx, obj);
michael@0 216 }
michael@0 217
michael@0 218 JSBool SkJSDisplayable::GetProperty(JSContext *cx, JSObject *obj, jsval id,
michael@0 219 jsval *vp)
michael@0 220 {
michael@0 221 if (JSVAL_IS_INT(id) == 0)
michael@0 222 return JS_TRUE;
michael@0 223 SkJSDisplayable *p = (SkJSDisplayable *) JS_GetPrivate(cx, obj);
michael@0 224 SkDisplayable* displayable = p->fDisplayable;
michael@0 225 SkDisplayTypes displayableType = displayable->getType();
michael@0 226 int members;
michael@0 227 const SkMemberInfo* info = SkDisplayType::GetMembers(NULL /* fMaker */, displayableType, &members);
michael@0 228 int idIndex = JSVAL_TO_INT(id);
michael@0 229 SkASSERT(idIndex >= 0 && idIndex < members);
michael@0 230 info = &info[idIndex];
michael@0 231 SkDisplayTypes infoType = (SkDisplayTypes) info->fType;
michael@0 232 SkScalar scalar = 0;
michael@0 233 S32 s32 = 0;
michael@0 234 SkString* string= NULL;
michael@0 235 JSString *str;
michael@0 236 if (infoType == SkType_MemberProperty) {
michael@0 237 infoType = info->propertyType();
michael@0 238 switch (infoType) {
michael@0 239 case SkType_Scalar: {
michael@0 240 SkScriptValue scriptValue;
michael@0 241 bool success = displayable->getProperty(info->propertyIndex(), &scriptValue);
michael@0 242 SkASSERT(scriptValue.fType == SkType_Scalar);
michael@0 243 scalar = scriptValue.fOperand.fScalar;
michael@0 244 } break;
michael@0 245 default:
michael@0 246 SkASSERT(0); // !!! unimplemented
michael@0 247 }
michael@0 248 } else {
michael@0 249 SkASSERT(info->fCount == 1);
michael@0 250 switch (infoType) {
michael@0 251 case SkType_Boolean:
michael@0 252 case SkType_Color:
michael@0 253 case SkType_S32:
michael@0 254 s32 = *(S32*) info->memberData(displayable);
michael@0 255 break;
michael@0 256 case SkType_String:
michael@0 257 info->getString(displayable, &string);
michael@0 258 break;
michael@0 259 case SkType_Scalar:
michael@0 260 SkOperand operand;
michael@0 261 info->getValue(displayable, &operand, 1);
michael@0 262 scalar = operand.fScalar;
michael@0 263 break;
michael@0 264 default:
michael@0 265 SkASSERT(0); // !!! unimplemented
michael@0 266 }
michael@0 267 }
michael@0 268 switch (infoType) {
michael@0 269 case SkType_Boolean:
michael@0 270 *vp = BOOLEAN_TO_JSVAL(s32);
michael@0 271 break;
michael@0 272 case SkType_Color:
michael@0 273 case SkType_S32:
michael@0 274 *vp = INT_TO_JSVAL(s32);
michael@0 275 break;
michael@0 276 case SkType_Scalar:
michael@0 277 if (SkScalarFraction(scalar) == 0)
michael@0 278 *vp = INT_TO_JSVAL(SkScalarFloor(scalar));
michael@0 279 else
michael@0 280 *vp = DOUBLE_TO_JSVAL(scalar);
michael@0 281 break;
michael@0 282 case SkType_String:
michael@0 283 str = JS_NewStringCopyN(cx, string->c_str(), string->size());
michael@0 284 *vp = STRING_TO_JSVAL(str);
michael@0 285 break;
michael@0 286 default:
michael@0 287 SkASSERT(0); // !!! unimplemented
michael@0 288 }
michael@0 289 return JS_TRUE;
michael@0 290 }
michael@0 291
michael@0 292 JSBool SkJSDisplayable::SetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) {
michael@0 293 if (JSVAL_IS_INT(id) == 0)
michael@0 294 return JS_TRUE;
michael@0 295 SkJSDisplayable *p = (SkJSDisplayable *) JS_GetPrivate(cx, obj);
michael@0 296 SkDisplayable* displayable = p->fDisplayable;
michael@0 297 SkDisplayTypes displayableType = displayable->getType();
michael@0 298 int members;
michael@0 299 const SkMemberInfo* info = SkDisplayType::GetMembers(NULL /* fMaker */, displayableType, &members);
michael@0 300 int idIndex = JSVAL_TO_INT(id);
michael@0 301 SkASSERT(idIndex >= 0 && idIndex < members);
michael@0 302 info = &info[idIndex];
michael@0 303 SkDisplayTypes infoType = info->getType();
michael@0 304 SkScalar scalar = 0;
michael@0 305 S32 s32 = 0;
michael@0 306 SkString string;
michael@0 307 JSString* str;
michael@0 308 jsval value = *vp;
michael@0 309 switch (infoType) {
michael@0 310 case SkType_Boolean:
michael@0 311 s32 = JSVAL_TO_BOOLEAN(value);
michael@0 312 break;
michael@0 313 case SkType_Color:
michael@0 314 case SkType_S32:
michael@0 315 s32 = JSVAL_TO_INT(value);
michael@0 316 break;
michael@0 317 case SkType_Scalar:
michael@0 318 if (JSVAL_IS_INT(value))
michael@0 319 scalar = SkIntToScalar(JSVAL_TO_INT(value));
michael@0 320 else {
michael@0 321 SkASSERT(JSVAL_IS_DOUBLE(value));
michael@0 322 scalar = (float) *(double*) JSVAL_TO_DOUBLE(value);
michael@0 323 }
michael@0 324 break;
michael@0 325 case SkType_String:
michael@0 326 str = JS_ValueToString(cx, value);
michael@0 327 string.set(JS_GetStringBytes(str));
michael@0 328 break;
michael@0 329 default:
michael@0 330 SkASSERT(0); // !!! unimplemented
michael@0 331 }
michael@0 332 if (info->fType == SkType_MemberProperty) {
michael@0 333 switch (infoType) {
michael@0 334 case SkType_Scalar: {
michael@0 335 SkScriptValue scriptValue;
michael@0 336 scriptValue.fType = SkType_Scalar;
michael@0 337 scriptValue.fOperand.fScalar = scalar;
michael@0 338 displayable->setProperty(-1 - (int) info->fOffset, scriptValue);
michael@0 339 } break;
michael@0 340 default:
michael@0 341 SkASSERT(0); // !!! unimplemented
michael@0 342 }
michael@0 343 } else {
michael@0 344 SkASSERT(info->fCount == 1);
michael@0 345 switch (infoType) {
michael@0 346 case SkType_Boolean:
michael@0 347 case SkType_Color:
michael@0 348 case SkType_S32:
michael@0 349 s32 = *(S32*) ((const char*) displayable + info->fOffset);
michael@0 350 break;
michael@0 351 case SkType_String:
michael@0 352 info->setString(displayable, &string);
michael@0 353 break;
michael@0 354 case SkType_Scalar:
michael@0 355 SkOperand operand;
michael@0 356 operand.fScalar = scalar;
michael@0 357 info->setValue(displayable, &operand, 1);
michael@0 358 break;
michael@0 359 default:
michael@0 360 SkASSERT(0); // !!! unimplemented
michael@0 361 }
michael@0 362 }
michael@0 363 return JS_TRUE;
michael@0 364 }
michael@0 365
michael@0 366 void SkJS::InitializeDisplayables(const SkBitmap& bitmap, JSContext *cx, JSObject *obj, JSObject *proto) {
michael@0 367 SkJSDisplayable::gCanvas = new SkCanvas(bitmap);
michael@0 368 SkJSDisplayable::gPaint = new SkPaint();
michael@0 369 #if SK_USE_CONDENSED_INFO == 0
michael@0 370 GenerateTables();
michael@0 371 #else
michael@0 372 SkASSERT(0); // !!! compressed version hasn't been implemented
michael@0 373 #endif
michael@0 374 AddInit(cx, obj, proto);
michael@0 375 AddCircleInit(cx, obj, proto);
michael@0 376 AddOvalInit(cx, obj, proto);
michael@0 377 AddPathInit(cx, obj, proto);
michael@0 378 AddRectangleInit(cx, obj, proto);
michael@0 379 AddRoundRectInit(cx, obj, proto);
michael@0 380 // AfterInit(cx, obj, proto);
michael@0 381 ApplyInit(cx, obj, proto);
michael@0 382 // AnimateInit(cx, obj, proto);
michael@0 383 // AnimateColorInit(cx, obj, proto);
michael@0 384 AnimateFieldInit(cx, obj, proto);
michael@0 385 // AnimateRotateInit(cx, obj, proto);
michael@0 386 // AnimateScaleInit(cx, obj, proto);
michael@0 387 // AnimateTranslateInit(cx, obj, proto);
michael@0 388 BitmapInit(cx, obj, proto);
michael@0 389 // BaseBitmapInit(cx, obj, proto);
michael@0 390 // BeforeInit(cx, obj, proto);
michael@0 391 BitmapShaderInit(cx, obj, proto);
michael@0 392 BlurInit(cx, obj, proto);
michael@0 393 ClipInit(cx, obj, proto);
michael@0 394 ColorInit(cx, obj, proto);
michael@0 395 CubicToInit(cx, obj, proto);
michael@0 396 DashInit(cx, obj, proto);
michael@0 397 DataInit(cx, obj, proto);
michael@0 398 // DimensionsInit(cx, obj, proto);
michael@0 399 DiscreteInit(cx, obj, proto);
michael@0 400 DrawToInit(cx, obj, proto);
michael@0 401 EmbossInit(cx, obj, proto);
michael@0 402 EventInit(cx, obj, proto);
michael@0 403 // FontInit(cx, obj, proto);
michael@0 404 // FocusInit(cx, obj, proto);
michael@0 405 ImageInit(cx, obj, proto);
michael@0 406 IncludeInit(cx, obj, proto);
michael@0 407 // InputInit(cx, obj, proto);
michael@0 408 LineInit(cx, obj, proto);
michael@0 409 LinearGradientInit(cx, obj, proto);
michael@0 410 LineToInit(cx, obj, proto);
michael@0 411 MatrixInit(cx, obj, proto);
michael@0 412 MoveInit(cx, obj, proto);
michael@0 413 MoveToInit(cx, obj, proto);
michael@0 414 OvalInit(cx, obj, proto);
michael@0 415 PathInit(cx, obj, proto);
michael@0 416 PaintInit(cx, obj, proto);
michael@0 417 DrawPointInit(cx, obj, proto);
michael@0 418 PolyToPolyInit(cx, obj, proto);
michael@0 419 PolygonInit(cx, obj, proto);
michael@0 420 PolylineInit(cx, obj, proto);
michael@0 421 PostInit(cx, obj, proto);
michael@0 422 QuadToInit(cx, obj, proto);
michael@0 423 RadialGradientInit(cx, obj, proto);
michael@0 424 RandomInit(cx, obj, proto);
michael@0 425 RectToRectInit(cx, obj, proto);
michael@0 426 RectangleInit(cx, obj, proto);
michael@0 427 RemoveInit(cx, obj, proto);
michael@0 428 ReplaceInit(cx, obj, proto);
michael@0 429 RotateInit(cx, obj, proto);
michael@0 430 RoundRectInit(cx, obj, proto);
michael@0 431 ScaleInit(cx, obj, proto);
michael@0 432 SetInit(cx, obj, proto);
michael@0 433 SkewInit(cx, obj, proto);
michael@0 434 // 3D_CameraInit(cx, obj, proto);
michael@0 435 // 3D_PatchInit(cx, obj, proto);
michael@0 436 SnapshotInit(cx, obj, proto);
michael@0 437 // StrokeInit(cx, obj, proto);
michael@0 438 TextInit(cx, obj, proto);
michael@0 439 TextOnPathInit(cx, obj, proto);
michael@0 440 TextToPathInit(cx, obj, proto);
michael@0 441 TranslateInit(cx, obj, proto);
michael@0 442 // UseInit(cx, obj, proto);
michael@0 443 }
michael@0 444
michael@0 445 void SkJS::DisposeDisplayables() {
michael@0 446 delete SkJSDisplayable::gPaint;
michael@0 447 delete SkJSDisplayable::gCanvas;
michael@0 448 for (int index = 0; index < kTypeNamesSize; index++) {
michael@0 449 SkDisplayTypes type = gTypeNames[index].fType;
michael@0 450 delete[] gDisplayableProperties[type];
michael@0 451 }
michael@0 452 }

mercurial