gfx/skia/trunk/include/gpu/GrPathRendererChain.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 2011 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 GrPathRendererChain_DEFINED
michael@0 9 #define GrPathRendererChain_DEFINED
michael@0 10
michael@0 11 #include "SkRefCnt.h"
michael@0 12 #include "SkTArray.h"
michael@0 13
michael@0 14 class GrContext;
michael@0 15 class GrDrawTarget;
michael@0 16 class GrPathRenderer;
michael@0 17 class SkPath;
michael@0 18 class SkStrokeRec;
michael@0 19
michael@0 20 /**
michael@0 21 * Keeps track of an ordered list of path renderers. When a path needs to be
michael@0 22 * drawn this list is scanned to find the most preferred renderer. To add your
michael@0 23 * path renderer to the list implement the GrPathRenderer::AddPathRenderers
michael@0 24 * function.
michael@0 25 */
michael@0 26 class GrPathRendererChain : public SkRefCnt {
michael@0 27 public:
michael@0 28 // See comments in GrPathRenderer.h
michael@0 29 enum StencilSupport {
michael@0 30 kNoSupport_StencilSupport,
michael@0 31 kStencilOnly_StencilSupport,
michael@0 32 kNoRestriction_StencilSupport,
michael@0 33 };
michael@0 34
michael@0 35 SK_DECLARE_INST_COUNT(GrPathRendererChain)
michael@0 36
michael@0 37 GrPathRendererChain(GrContext* context);
michael@0 38
michael@0 39 ~GrPathRendererChain();
michael@0 40
michael@0 41 // takes a ref and unrefs in destructor
michael@0 42 GrPathRenderer* addPathRenderer(GrPathRenderer* pr);
michael@0 43
michael@0 44 /** Documents how the caller plans to use a GrPathRenderer to draw a path. It affects the PR
michael@0 45 returned by getPathRenderer */
michael@0 46 enum DrawType {
michael@0 47 kColor_DrawType, // draw to the color buffer, no AA
michael@0 48 kColorAntiAlias_DrawType, // draw to color buffer, with partial coverage AA
michael@0 49 kStencilOnly_DrawType, // draw just to the stencil buffer
michael@0 50 kStencilAndColor_DrawType, // draw the stencil and color buffer, no AA
michael@0 51 kStencilAndColorAntiAlias_DrawType // draw the stencil and color buffer, with partial
michael@0 52 // coverage AA.
michael@0 53 };
michael@0 54 /** Returns a GrPathRenderer compatible with the request if one is available. If the caller
michael@0 55 is drawing the path to the stencil buffer then stencilSupport can be used to determine
michael@0 56 whether the path can be rendered with arbitrary stencil rules or not. See comments on
michael@0 57 StencilSupport in GrPathRenderer.h. */
michael@0 58 GrPathRenderer* getPathRenderer(const SkPath& path,
michael@0 59 const SkStrokeRec& rec,
michael@0 60 const GrDrawTarget* target,
michael@0 61 DrawType drawType,
michael@0 62 StencilSupport* stencilSupport);
michael@0 63
michael@0 64 private:
michael@0 65 GrPathRendererChain();
michael@0 66
michael@0 67 void init();
michael@0 68
michael@0 69 enum {
michael@0 70 kPreAllocCount = 8,
michael@0 71 };
michael@0 72 bool fInit;
michael@0 73 GrContext* fOwner;
michael@0 74 SkSTArray<kPreAllocCount, GrPathRenderer*, true> fChain;
michael@0 75
michael@0 76 typedef SkRefCnt INHERITED;
michael@0 77 };
michael@0 78
michael@0 79 #endif

mercurial