gfx/skia/trunk/include/utils/SkNoSaveLayerCanvas.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.

michael@0 1 /*
michael@0 2 * Copyright 2014 Google Inc.
michael@0 3 *
michael@0 4 * Use of this source code is governed by a BSD-style license that can be
michael@0 5 * found in the LICENSE file.
michael@0 6 */
michael@0 7
michael@0 8 #ifndef SkNoSaveLayerCanvas_DEFINED
michael@0 9 #define SkNoSaveLayerCanvas_DEFINED
michael@0 10
michael@0 11 #include "SkCanvas.h"
michael@0 12 #include "SkRRect.h"
michael@0 13
michael@0 14 // The NoSaveLayerCanvas is used to play back SkPictures when the saveLayer
michael@0 15 // functionality isn't required (e.g., during analysis of the draw calls).
michael@0 16 // It also simplifies the clipping calls to only use rectangles.
michael@0 17 class SK_API SkNoSaveLayerCanvas : public SkCanvas {
michael@0 18 public:
michael@0 19 SkNoSaveLayerCanvas(SkBaseDevice* device) : INHERITED(device) {}
michael@0 20
michael@0 21 protected:
michael@0 22 virtual SaveLayerStrategy willSaveLayer(const SkRect* bounds, const SkPaint* paint,
michael@0 23 SaveFlags flags) SK_OVERRIDE {
michael@0 24 this->INHERITED::willSaveLayer(bounds, paint, flags);
michael@0 25 return kNoLayer_SaveLayerStrategy;
michael@0 26 }
michael@0 27
michael@0 28 // disable aa for speed
michael@0 29 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle) SK_OVERRIDE {
michael@0 30 this->INHERITED::onClipRect(rect, op, kHard_ClipEdgeStyle);
michael@0 31 }
michael@0 32
michael@0 33 // for speed, just respect the bounds, and disable AA. May give us a few
michael@0 34 // false positives and negatives.
michael@0 35 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle) SK_OVERRIDE {
michael@0 36 this->updateClipConservativelyUsingBounds(path.getBounds(), op,
michael@0 37 path.isInverseFillType());
michael@0 38 }
michael@0 39 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle) SK_OVERRIDE {
michael@0 40 this->updateClipConservativelyUsingBounds(rrect.getBounds(), op, false);
michael@0 41 }
michael@0 42
michael@0 43 private:
michael@0 44 typedef SkCanvas INHERITED;
michael@0 45 };
michael@0 46
michael@0 47 #endif // SkNoSaveLayerCanvas_DEFINED

mercurial