gfx/skia/trunk/include/utils/SkLuaCanvas.h

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.

     1 /*
     2  * Copyright 2013 Google Inc.
     3  *
     4  * Use of this source code is governed by a BSD-style license that can be
     5  * found in the LICENSE file.
     6  */
     8 #ifndef SkLuaCanvas_DEFINED
     9 #define SkLuaCanvas_DEFINED
    11 #include "SkCanvas.h"
    12 #include "SkString.h"
    14 struct lua_State;
    16 class SkLuaCanvas : public SkCanvas {
    17 public:
    18     void pushThis();
    20     SkLuaCanvas(int width, int height, lua_State*, const char function[]);
    21     virtual ~SkLuaCanvas();
    23     virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
    24     virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
    25                             const SkPaint& paint) SK_OVERRIDE;
    26     virtual void drawOval(const SkRect&, const SkPaint& paint) SK_OVERRIDE;
    27     virtual void drawRect(const SkRect&, const SkPaint& paint) SK_OVERRIDE;
    28     virtual void drawRRect(const SkRRect&, const SkPaint& paint) SK_OVERRIDE;
    29     virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
    30     virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
    31                             const SkPaint* paint) SK_OVERRIDE;
    32     virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
    33                                       const SkRect& dst, const SkPaint* paint,
    34                                       DrawBitmapRectFlags flags) SK_OVERRIDE;
    35     virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
    36                                   const SkPaint* paint) SK_OVERRIDE;
    37     virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
    38                             const SkPaint* paint) SK_OVERRIDE;
    39     virtual void drawText(const void* text, size_t byteLength, SkScalar x,
    40                           SkScalar y, const SkPaint& paint) SK_OVERRIDE;
    41     virtual void drawPosText(const void* text, size_t byteLength,
    42                              const SkPoint pos[], const SkPaint& paint) SK_OVERRIDE;
    43     virtual void drawPosTextH(const void* text, size_t byteLength,
    44                               const SkScalar xpos[], SkScalar constY,
    45                               const SkPaint& paint) SK_OVERRIDE;
    46     virtual void drawTextOnPath(const void* text, size_t byteLength,
    47                                 const SkPath& path, const SkMatrix* matrix,
    48                                 const SkPaint& paint) SK_OVERRIDE;
    49     virtual void drawPicture(SkPicture&) SK_OVERRIDE;
    50     virtual void drawVertices(VertexMode vmode, int vertexCount,
    51                               const SkPoint vertices[], const SkPoint texs[],
    52                               const SkColor colors[], SkXfermode* xmode,
    53                               const uint16_t indices[], int indexCount,
    54                               const SkPaint& paint) SK_OVERRIDE;
    55     virtual void drawData(const void* data, size_t length) SK_OVERRIDE;
    57 protected:
    58     virtual void willSave(SaveFlags) SK_OVERRIDE;
    59     virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK_OVERRIDE;
    60     virtual void willRestore() SK_OVERRIDE;
    62     virtual void didTranslate(SkScalar, SkScalar) SK_OVERRIDE;
    63     virtual void didScale(SkScalar, SkScalar) SK_OVERRIDE;
    64     virtual void didRotate(SkScalar) SK_OVERRIDE;
    65     virtual void didSkew(SkScalar, SkScalar) SK_OVERRIDE;
    66     virtual void didConcat(const SkMatrix&) SK_OVERRIDE;
    67     virtual void didSetMatrix(const SkMatrix&) SK_OVERRIDE;
    69     virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
    71     virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
    72     virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
    73     virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
    74     virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE;
    76 private:
    77     lua_State*  fL;
    78     SkString    fFunc;
    80     void sendverb(const char verb[]);
    82     typedef SkCanvas INHERITED;
    83 };
    85 #endif

mercurial