gfx/layers/basic/BasicLayersImpl.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 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
michael@0 2 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef GFX_BASICLAYERSIMPL_H
michael@0 7 #define GFX_BASICLAYERSIMPL_H
michael@0 8
michael@0 9 #include "BasicImplData.h" // for BasicImplData
michael@0 10 #include "BasicLayers.h" // for BasicLayerManager
michael@0 11 #include "ReadbackLayer.h" // for ReadbackLayer
michael@0 12 #include "gfxContext.h" // for gfxContext, etc
michael@0 13 #include "mozilla/Attributes.h" // for MOZ_DELETE, MOZ_STACK_CLASS
michael@0 14 #include "mozilla/Maybe.h" // for Maybe
michael@0 15 #include "nsAutoPtr.h" // for nsRefPtr
michael@0 16 #include "nsDebug.h" // for NS_ASSERTION
michael@0 17 #include "nsISupportsImpl.h" // for gfxContext::Release, etc
michael@0 18 #include "nsRegion.h" // for nsIntRegion
michael@0 19
michael@0 20 namespace mozilla {
michael@0 21 namespace gfx {
michael@0 22 class DrawTarget;
michael@0 23 }
michael@0 24
michael@0 25 namespace layers {
michael@0 26
michael@0 27 class AutoMoz2DMaskData;
michael@0 28 class BasicContainerLayer;
michael@0 29 class Layer;
michael@0 30
michael@0 31 class AutoSetOperator {
michael@0 32 public:
michael@0 33 AutoSetOperator(gfxContext* aContext, gfxContext::GraphicsOperator aOperator) {
michael@0 34 if (aOperator != gfxContext::OPERATOR_OVER) {
michael@0 35 aContext->SetOperator(aOperator);
michael@0 36 mContext = aContext;
michael@0 37 }
michael@0 38 }
michael@0 39 ~AutoSetOperator() {
michael@0 40 if (mContext) {
michael@0 41 mContext->SetOperator(gfxContext::OPERATOR_OVER);
michael@0 42 }
michael@0 43 }
michael@0 44 private:
michael@0 45 nsRefPtr<gfxContext> mContext;
michael@0 46 };
michael@0 47
michael@0 48 class BasicReadbackLayer : public ReadbackLayer,
michael@0 49 public BasicImplData
michael@0 50 {
michael@0 51 public:
michael@0 52 BasicReadbackLayer(BasicLayerManager* aLayerManager) :
michael@0 53 ReadbackLayer(aLayerManager,
michael@0 54 static_cast<BasicImplData*>(MOZ_THIS_IN_INITIALIZER_LIST()))
michael@0 55 {
michael@0 56 MOZ_COUNT_CTOR(BasicReadbackLayer);
michael@0 57 }
michael@0 58 virtual ~BasicReadbackLayer()
michael@0 59 {
michael@0 60 MOZ_COUNT_DTOR(BasicReadbackLayer);
michael@0 61 }
michael@0 62
michael@0 63 virtual void SetVisibleRegion(const nsIntRegion& aRegion)
michael@0 64 {
michael@0 65 NS_ASSERTION(BasicManager()->InConstruction(),
michael@0 66 "Can only set properties in construction phase");
michael@0 67 ReadbackLayer::SetVisibleRegion(aRegion);
michael@0 68 }
michael@0 69
michael@0 70 protected:
michael@0 71 BasicLayerManager* BasicManager()
michael@0 72 {
michael@0 73 return static_cast<BasicLayerManager*>(mManager);
michael@0 74 }
michael@0 75 };
michael@0 76
michael@0 77 /*
michael@0 78 * Extract a mask surface for a mask layer
michael@0 79 * Returns true and through outparams a surface for the mask layer if
michael@0 80 * a mask layer is present and has a valid surface and transform;
michael@0 81 * false otherwise.
michael@0 82 * The transform for the layer will be put in aMaskData
michael@0 83 */
michael@0 84 bool
michael@0 85 GetMaskData(Layer* aMaskLayer,
michael@0 86 const gfx::Point& aDeviceOffset,
michael@0 87 AutoMoz2DMaskData* aMaskData);
michael@0 88
michael@0 89 // Paint the current source to a context using a mask, if present
michael@0 90 void
michael@0 91 PaintWithMask(gfxContext* aContext, float aOpacity, Layer* aMaskLayer);
michael@0 92
michael@0 93 // Fill the rect with the source, using a mask and opacity, if present
michael@0 94 void
michael@0 95 FillRectWithMask(gfx::DrawTarget* aDT,
michael@0 96 const gfx::Rect& aRect,
michael@0 97 const gfx::Color& aColor,
michael@0 98 const gfx::DrawOptions& aOptions,
michael@0 99 gfx::SourceSurface* aMaskSource = nullptr,
michael@0 100 const gfx::Matrix* aMaskTransform = nullptr);
michael@0 101 void
michael@0 102 FillRectWithMask(gfx::DrawTarget* aDT,
michael@0 103 const gfx::Rect& aRect,
michael@0 104 gfx::SourceSurface* aSurface,
michael@0 105 gfx::Filter aFilter,
michael@0 106 const gfx::DrawOptions& aOptions,
michael@0 107 gfx::ExtendMode aExtendMode,
michael@0 108 gfx::SourceSurface* aMaskSource = nullptr,
michael@0 109 const gfx::Matrix* aMaskTransform = nullptr,
michael@0 110 const gfx::Matrix* aSurfaceTransform = nullptr);
michael@0 111 void
michael@0 112 FillRectWithMask(gfx::DrawTarget* aDT,
michael@0 113 const gfx::Point& aDeviceOffset,
michael@0 114 const gfx::Rect& aRect,
michael@0 115 gfx::SourceSurface* aSurface,
michael@0 116 gfx::Filter aFilter,
michael@0 117 const gfx::DrawOptions& aOptions,
michael@0 118 Layer* aMaskLayer);
michael@0 119 void
michael@0 120 FillRectWithMask(gfx::DrawTarget* aDT,
michael@0 121 const gfx::Point& aDeviceOffset,
michael@0 122 const gfx::Rect& aRect,
michael@0 123 const gfx::Color& aColor,
michael@0 124 const gfx::DrawOptions& aOptions,
michael@0 125 Layer* aMaskLayer);
michael@0 126
michael@0 127 BasicImplData*
michael@0 128 ToData(Layer* aLayer);
michael@0 129
michael@0 130 /**
michael@0 131 * Returns the operator to be used when blending and compositing this layer.
michael@0 132 * Currently there is no way to specify both a blending and a compositing
michael@0 133 * operator other than normal and source over respectively.
michael@0 134 *
michael@0 135 * If the layer has
michael@0 136 * an effective blend mode operator other than normal, as returned by
michael@0 137 * GetEffectiveMixBlendMode, this operator is used for blending, and source
michael@0 138 * over is used for compositing.
michael@0 139 * If the blend mode for this layer is normal, the compositing operator
michael@0 140 * returned by GetOperator is used.
michael@0 141 */
michael@0 142 gfx::CompositionOp
michael@0 143 GetEffectiveOperator(Layer* aLayer);
michael@0 144
michael@0 145 }
michael@0 146 }
michael@0 147
michael@0 148 #endif

mercurial