gfx/skia/trunk/src/core/SkBBoxRecord.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 /*
michael@0 3 * Copyright 2012 Google Inc.
michael@0 4 *
michael@0 5 * Use of this source code is governed by a BSD-style license that can be
michael@0 6 * found in the LICENSE file.
michael@0 7 */
michael@0 8
michael@0 9 #ifndef SkBBoxRecord_DEFINED
michael@0 10 #define SkBBoxRecord_DEFINED
michael@0 11
michael@0 12 #include "SkPictureRecord.h"
michael@0 13
michael@0 14 /**
michael@0 15 * This is an abstract SkPictureRecord subclass that intercepts draw calls and computes an
michael@0 16 * axis-aligned bounding box for each draw that it sees, subclasses implement handleBBox()
michael@0 17 * which will be called every time we get a new bounding box.
michael@0 18 */
michael@0 19 class SkBBoxRecord : public SkPictureRecord {
michael@0 20 public:
michael@0 21
michael@0 22 SkBBoxRecord(const SkISize& size, uint32_t recordFlags) : INHERITED(size, recordFlags) {}
michael@0 23 virtual ~SkBBoxRecord() { }
michael@0 24
michael@0 25 /**
michael@0 26 * This is called each time we get a bounding box, it will be axis-aligned,
michael@0 27 * in device coordinates, and expanded to include stroking, shadows, etc.
michael@0 28 */
michael@0 29 virtual void handleBBox(const SkRect& bbox) = 0;
michael@0 30
michael@0 31 virtual void drawOval(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE;
michael@0 32 virtual void drawRRect(const SkRRect& rrect, const SkPaint& paint) SK_OVERRIDE;
michael@0 33 virtual void drawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE;
michael@0 34 virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
michael@0 35 virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[],
michael@0 36 const SkPaint& paint) SK_OVERRIDE;
michael@0 37 virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
michael@0 38 virtual void clear(SkColor) SK_OVERRIDE;
michael@0 39 virtual void drawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
michael@0 40 const SkPaint& paint) SK_OVERRIDE;
michael@0 41 virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
michael@0 42 const SkPaint* paint = NULL) SK_OVERRIDE;
michael@0 43 virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
michael@0 44 const SkRect& dst, const SkPaint* paint,
michael@0 45 DrawBitmapRectFlags flags) SK_OVERRIDE;
michael@0 46 virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& mat,
michael@0 47 const SkPaint* paint) SK_OVERRIDE;
michael@0 48 virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
michael@0 49 const SkRect& dst, const SkPaint* paint) SK_OVERRIDE;
michael@0 50 virtual void drawPosText(const void* text, size_t byteLength,
michael@0 51 const SkPoint pos[], const SkPaint& paint) SK_OVERRIDE;
michael@0 52 virtual void drawPosTextH(const void* text, size_t byteLength,
michael@0 53 const SkScalar xpos[], SkScalar constY,
michael@0 54 const SkPaint& paint) SK_OVERRIDE;
michael@0 55 virtual void drawSprite(const SkBitmap& bitmap, int left, int top,
michael@0 56 const SkPaint* paint) SK_OVERRIDE;
michael@0 57 virtual void drawTextOnPath(const void* text, size_t byteLength,
michael@0 58 const SkPath& path, const SkMatrix* matrix,
michael@0 59 const SkPaint& paint) SK_OVERRIDE;
michael@0 60 virtual void drawVertices(VertexMode mode, int vertexCount,
michael@0 61 const SkPoint vertices[], const SkPoint texs[],
michael@0 62 const SkColor colors[], SkXfermode* xfer,
michael@0 63 const uint16_t indices[], int indexCount,
michael@0 64 const SkPaint& paint) SK_OVERRIDE;
michael@0 65 virtual void drawPicture(SkPicture& picture) SK_OVERRIDE;
michael@0 66
michael@0 67 protected:
michael@0 68 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
michael@0 69
michael@0 70 private:
michael@0 71 /**
michael@0 72 * Takes a bounding box in current canvas view space, accounts for stroking and effects, and
michael@0 73 * computes an axis-aligned bounding box in device coordinates, then passes it to handleBBox()
michael@0 74 * returns false if the draw is completely clipped out, and may safely be ignored.
michael@0 75 **/
michael@0 76 bool transformBounds(const SkRect& bounds, const SkPaint* paint);
michael@0 77
michael@0 78 typedef SkPictureRecord INHERITED;
michael@0 79 };
michael@0 80
michael@0 81 #endif

mercurial