gfx/skia/trunk/src/utils/SkProxyCanvas.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.

     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 #include "SkProxyCanvas.h"
    10 SkProxyCanvas::SkProxyCanvas(SkCanvas* proxy) : fProxy(proxy) {
    11     SkSafeRef(fProxy);
    12 }
    14 SkProxyCanvas::~SkProxyCanvas() {
    15     SkSafeUnref(fProxy);
    16 }
    18 void SkProxyCanvas::setProxy(SkCanvas* proxy) {
    19     SkRefCnt_SafeAssign(fProxy, proxy);
    20 }
    22 ///////////////////////////////// Overrides ///////////
    24 void SkProxyCanvas::willSave(SaveFlags flags) {
    25     fProxy->save(flags);
    26     this->INHERITED::willSave(flags);
    27 }
    29 SkCanvas::SaveLayerStrategy SkProxyCanvas::willSaveLayer(const SkRect* bounds, const SkPaint* paint,
    30                                                          SaveFlags flags) {
    31     fProxy->saveLayer(bounds, paint, flags);
    32     this->INHERITED::willSaveLayer(bounds, paint, flags);
    33     // No need for a layer.
    34     return kNoLayer_SaveLayerStrategy;
    35 }
    37 void SkProxyCanvas::willRestore() {
    38     fProxy->restore();
    39     this->INHERITED::willRestore();
    40 }
    42 void SkProxyCanvas::didTranslate(SkScalar dx, SkScalar dy) {
    43     fProxy->translate(dx, dy);
    44     this->INHERITED::didTranslate(dx, dy);
    45 }
    47 void SkProxyCanvas::didScale(SkScalar sx, SkScalar sy) {
    48     fProxy->scale(sx, sy);
    49     this->INHERITED::didScale(sx, sy);
    50 }
    52 void SkProxyCanvas::didRotate(SkScalar degrees) {
    53     fProxy->rotate(degrees);
    54     this->INHERITED::didRotate(degrees);
    55 }
    57 void SkProxyCanvas::didSkew(SkScalar sx, SkScalar sy) {
    58     fProxy->skew(sx, sy);
    59     this->INHERITED::didSkew(sx, sy);
    60 }
    62 void SkProxyCanvas::didConcat(const SkMatrix& matrix) {
    63     fProxy->concat(matrix);
    64     this->INHERITED::didConcat(matrix);
    65 }
    67 void SkProxyCanvas::didSetMatrix(const SkMatrix& matrix) {
    68     fProxy->setMatrix(matrix);
    69     this->INHERITED::didSetMatrix(matrix);
    70 }
    72 void SkProxyCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
    73     fProxy->clipRect(rect, op, kSoft_ClipEdgeStyle == edgeStyle);
    74 }
    76 void SkProxyCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
    77     fProxy->clipRRect(rrect, op, kSoft_ClipEdgeStyle == edgeStyle);
    78 }
    80 void SkProxyCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
    81     fProxy->clipPath(path, op, kSoft_ClipEdgeStyle == edgeStyle);
    82 }
    84 void SkProxyCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
    85     fProxy->clipRegion(deviceRgn, op);
    86 }
    88 void SkProxyCanvas::drawPaint(const SkPaint& paint) {
    89     fProxy->drawPaint(paint);
    90 }
    92 void SkProxyCanvas::drawPoints(PointMode mode, size_t count,
    93                                const SkPoint pts[], const SkPaint& paint) {
    94     fProxy->drawPoints(mode, count, pts, paint);
    95 }
    97 void SkProxyCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
    98     fProxy->drawOval(rect, paint);
    99 }
   101 void SkProxyCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
   102     fProxy->drawRect(rect, paint);
   103 }
   105 void SkProxyCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
   106     fProxy->drawRRect(rrect, paint);
   107 }
   109 void SkProxyCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
   110                                  const SkPaint& paint) {
   111     fProxy->drawDRRect(outer, inner, paint);
   112 }
   114 void SkProxyCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
   115     fProxy->drawPath(path, paint);
   116 }
   118 void SkProxyCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
   119                                const SkPaint* paint) {
   120     fProxy->drawBitmap(bitmap, x, y, paint);
   121 }
   123 void SkProxyCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
   124                                    const SkRect& dst, const SkPaint* paint,
   125                                    DrawBitmapRectFlags flags) {
   126     fProxy->drawBitmapRectToRect(bitmap, src, dst, paint, flags);
   127 }
   129 void SkProxyCanvas::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
   130                                      const SkPaint* paint) {
   131     fProxy->drawBitmapMatrix(bitmap, m, paint);
   132 }
   134 void SkProxyCanvas::drawSprite(const SkBitmap& bitmap, int x, int y,
   135                                const SkPaint* paint) {
   136     fProxy->drawSprite(bitmap, x, y, paint);
   137 }
   139 void SkProxyCanvas::drawText(const void* text, size_t byteLength, SkScalar x,
   140                              SkScalar y, const SkPaint& paint) {
   141     fProxy->drawText(text, byteLength, x, y, paint);
   142 }
   144 void SkProxyCanvas::drawPosText(const void* text, size_t byteLength,
   145                                 const SkPoint pos[], const SkPaint& paint) {
   146     fProxy->drawPosText(text, byteLength, pos, paint);
   147 }
   149 void SkProxyCanvas::drawPosTextH(const void* text, size_t byteLength,
   150                                  const SkScalar xpos[], SkScalar constY,
   151                                  const SkPaint& paint) {
   152     fProxy->drawPosTextH(text, byteLength, xpos, constY, paint);
   153 }
   155 void SkProxyCanvas::drawTextOnPath(const void* text, size_t byteLength,
   156                                    const SkPath& path, const SkMatrix* matrix,
   157                                    const SkPaint& paint) {
   158     fProxy->drawTextOnPath(text, byteLength, path, matrix, paint);
   159 }
   161 void SkProxyCanvas::drawPicture(SkPicture& picture) {
   162     fProxy->drawPicture(picture);
   163 }
   165 void SkProxyCanvas::drawVertices(VertexMode vmode, int vertexCount,
   166                                  const SkPoint vertices[], const SkPoint texs[],
   167                                  const SkColor colors[], SkXfermode* xmode,
   168                                  const uint16_t indices[], int indexCount,
   169                                  const SkPaint& paint) {
   170     fProxy->drawVertices(vmode, vertexCount, vertices, texs, colors,
   171                                      xmode, indices, indexCount, paint);
   172 }
   174 void SkProxyCanvas::drawData(const void* data, size_t length) {
   175     fProxy->drawData(data, length);
   176 }
   178 void SkProxyCanvas::beginCommentGroup(const char* description) {
   179     fProxy->beginCommentGroup(description);
   180 }
   182 void SkProxyCanvas::addComment(const char* kywd, const char* value) {
   183     fProxy->addComment(kywd, value);
   184 }
   186 void SkProxyCanvas::endCommentGroup() {
   187     fProxy->endCommentGroup();
   188 }
   190 SkBounder* SkProxyCanvas::setBounder(SkBounder* bounder) {
   191     return fProxy->setBounder(bounder);
   192 }
   194 SkDrawFilter* SkProxyCanvas::setDrawFilter(SkDrawFilter* filter) {
   195     return fProxy->setDrawFilter(filter);
   196 }

mercurial