gfx/skia/trunk/src/animator/SkScriptCallBack.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     2 /*
     3  * Copyright 2011 Google Inc.
     4  *
     5  * Use of this source code is governed by a BSD-style license that can be
     6  * found in the LICENSE file.
     7  */
     8 #ifndef SkScriptCallBack_DEFINED
     9 #define SkScriptCallBack_DEFINED
    11 #include "SkOperand2.h"
    12 #include "SkTDArray_Experimental.h"
    14 class SkScriptCallBack {
    15 public:
    16     virtual ~SkScriptCallBack() { }
    18     enum Type {
    19         kBox,
    20         kFunction,
    21         kMember,
    22         kMemberFunction,
    23         kProperty,
    24         kUnbox
    25     };
    27     virtual bool getReference(const char* , size_t len, SkScriptValue2* result) {  return false; }
    28     virtual SkOperand2::OpType getReturnType(size_t ref, SkOperand2*) {
    29         return SkOperand2::kS32; }
    30     virtual Type getType() const = 0;
    31 };
    33 class SkScriptCallBackConvert : public SkScriptCallBack {
    34 public:
    35     virtual bool convert(SkOperand2::OpType type, SkOperand2* operand) = 0;
    36 };
    38 class SkScriptCallBackFunction : public SkScriptCallBack {
    39 public:
    40     virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) = 0;
    41     virtual Type getType() const { return kFunction; }
    42     virtual bool invoke(size_t ref, SkOpArray* params, SkOperand2* value) = 0;
    43 };
    45 class SkScriptCallBackMember: public SkScriptCallBack {
    46 public:
    47     bool getMemberReference(const char* , size_t len, void* object, SkScriptValue2* ref);
    48     virtual Type getType() const { return kMember; }
    49     virtual bool invoke(size_t ref, void* object, SkOperand2* value) = 0;
    50 };
    52 class SkScriptCallBackMemberFunction : public SkScriptCallBack {
    53 public:
    54     bool getMemberReference(const char* , size_t len, void* object, SkScriptValue2* ref);
    55     virtual void getParamTypes(SkIntArray(SkOperand2::OpType)* types) = 0;
    56     virtual Type getType() const { return kMemberFunction; }
    57     virtual bool invoke(size_t ref, void* object, SkOpArray* params, SkOperand2* value) = 0;
    58 };
    60 class SkScriptCallBackProperty : public SkScriptCallBack {
    61 public:
    62     virtual bool getConstValue(const char* name, size_t len, SkOperand2* value) { return false; }
    63     virtual bool getResult(size_t ref, SkOperand2* answer) { return false; }
    64     virtual Type getType() const { return kProperty; }
    65 };
    67 #endif // SkScriptCallBack_DEFINED

mercurial