gfx/skia/trunk/include/gpu/SkGrPixelRef.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 2010 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 SkGrPixelRef_DEFINED
michael@0 9 #define SkGrPixelRef_DEFINED
michael@0 10
michael@0 11 #include "SkBitmap.h"
michael@0 12 #include "SkPixelRef.h"
michael@0 13 #include "GrTexture.h"
michael@0 14 #include "GrRenderTarget.h"
michael@0 15
michael@0 16
michael@0 17 /**
michael@0 18 * Common baseclass that implements onLockPixels() by calling onReadPixels().
michael@0 19 * Since it has a copy, it always returns false for onLockPixelsAreWritable().
michael@0 20 */
michael@0 21 class SK_API SkROLockPixelsPixelRef : public SkPixelRef {
michael@0 22 public:
michael@0 23 SK_DECLARE_INST_COUNT(SkROLockPixelsPixelRef)
michael@0 24 SkROLockPixelsPixelRef(const SkImageInfo&);
michael@0 25 virtual ~SkROLockPixelsPixelRef();
michael@0 26
michael@0 27 protected:
michael@0 28 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE;
michael@0 29 virtual void onUnlockPixels() SK_OVERRIDE;
michael@0 30 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE; // return false;
michael@0 31
michael@0 32 private:
michael@0 33 SkBitmap fBitmap;
michael@0 34 typedef SkPixelRef INHERITED;
michael@0 35 };
michael@0 36
michael@0 37 /**
michael@0 38 * PixelRef that wraps a GrSurface
michael@0 39 */
michael@0 40 class SK_API SkGrPixelRef : public SkROLockPixelsPixelRef {
michael@0 41 public:
michael@0 42 SK_DECLARE_INST_COUNT(SkGrPixelRef)
michael@0 43 /**
michael@0 44 * Constructs a pixel ref around a GrSurface. If the caller has locked the GrSurface in the
michael@0 45 * cache and would like the pixel ref to unlock it in its destructor then transferCacheLock
michael@0 46 * should be set to true.
michael@0 47 */
michael@0 48 SkGrPixelRef(const SkImageInfo&, GrSurface*, bool transferCacheLock = false);
michael@0 49 virtual ~SkGrPixelRef();
michael@0 50
michael@0 51 // override from SkPixelRef
michael@0 52 virtual GrTexture* getTexture() SK_OVERRIDE;
michael@0 53
michael@0 54 SK_DECLARE_UNFLATTENABLE_OBJECT()
michael@0 55
michael@0 56 protected:
michael@0 57 // overrides from SkPixelRef
michael@0 58 virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subset) SK_OVERRIDE;
michael@0 59 virtual SkPixelRef* deepCopy(SkBitmap::Config dstConfig, const SkIRect* subset) SK_OVERRIDE;
michael@0 60
michael@0 61 private:
michael@0 62 GrSurface* fSurface;
michael@0 63 bool fUnlock; // if true the pixel ref owns a texture cache lock on fSurface
michael@0 64
michael@0 65 typedef SkROLockPixelsPixelRef INHERITED;
michael@0 66 };
michael@0 67
michael@0 68 #endif

mercurial