gfx/skia/trunk/src/core/SkSpriteBlitterTemplate.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 2006 The Android Open Source Project
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
michael@0 10
michael@0 11 class SkSPRITE_CLASSNAME : public SkSpriteBlitter {
michael@0 12 public:
michael@0 13 SkSPRITE_CLASSNAME(const SkBitmap& source SkSPRITE_ARGS)
michael@0 14 : SkSpriteBlitter(source) {
michael@0 15 SkSPRITE_INIT
michael@0 16 }
michael@0 17
michael@0 18 virtual void blitRect(int x, int y, int width, int height) {
michael@0 19 SkASSERT(width > 0 && height > 0);
michael@0 20 int srcX = x - fLeft;
michael@0 21 int srcY = y - fTop;
michael@0 22 SkSPRITE_DST_TYPE* SK_RESTRICT dst =fDevice->SkSPRITE_DST_GETADDR(x, y);
michael@0 23 const SkSPRITE_SRC_TYPE* SK_RESTRICT src =
michael@0 24 fSource->SkSPRITE_SRC_GETADDR(srcX, srcY);
michael@0 25 size_t dstRB = fDevice->rowBytes();
michael@0 26 size_t srcRB = fSource->rowBytes();
michael@0 27
michael@0 28 SkDEBUGCODE((void)fDevice->SkSPRITE_DST_GETADDR(x + width - 1, y + height - 1);)
michael@0 29 SkDEBUGCODE((void)fSource->SkSPRITE_SRC_GETADDR(srcX + width - 1, srcY + height - 1);)
michael@0 30
michael@0 31 SkSPRITE_PREAMBLE((*fSource), srcX, srcY);
michael@0 32
michael@0 33 do {
michael@0 34 SkSPRITE_DST_TYPE* d = dst;
michael@0 35 const SkSPRITE_SRC_TYPE* s = src;
michael@0 36 #ifdef SkSPRITE_BEGIN_ROW
michael@0 37 SkSPRITE_BEGIN_ROW
michael@0 38 #endif
michael@0 39
michael@0 40 #ifdef SkSPRITE_ROW_PROC
michael@0 41 SkSPRITE_ROW_PROC(d, s, width, x, y);
michael@0 42 #else
michael@0 43 int w = width;
michael@0 44 do {
michael@0 45 SkSPRITE_SRC_TYPE sc = *s++;
michael@0 46 SkSPRITE_BLIT_PIXEL(d, sc);
michael@0 47 d += 1;
michael@0 48 } while (--w != 0);
michael@0 49 #endif
michael@0 50 dst = (SkSPRITE_DST_TYPE* SK_RESTRICT)((char*)dst + dstRB);
michael@0 51 src = (const SkSPRITE_SRC_TYPE* SK_RESTRICT)
michael@0 52 ((const char*)src + srcRB);
michael@0 53 SkSPRITE_NEXT_ROW
michael@0 54 #ifdef SkSPRITE_ROW_PROC
michael@0 55 y += 1;
michael@0 56 #endif
michael@0 57 } while (--height != 0);
michael@0 58
michael@0 59 SkSPRITE_POSTAMBLE((*fSource));
michael@0 60 }
michael@0 61
michael@0 62 private:
michael@0 63 SkSPRITE_FIELDS
michael@0 64 };
michael@0 65
michael@0 66 #undef SkSPRITE_BLIT_PIXEL
michael@0 67 #undef SkSPRITE_CLASSNAME
michael@0 68 #undef SkSPRITE_DST_TYPE
michael@0 69 #undef SkSPRITE_SRC_TYPE
michael@0 70 #undef SkSPRITE_DST_GETADDR
michael@0 71 #undef SkSPRITE_SRC_GETADDR
michael@0 72 #undef SkSPRITE_PREAMBLE
michael@0 73 #undef SkSPRITE_POSTAMBLE
michael@0 74 #undef SkSPRITE_ARGS
michael@0 75 #undef SkSPRITE_FIELDS
michael@0 76 #undef SkSPRITE_INIT
michael@0 77 #undef SkSPRITE_NEXT_ROW
michael@0 78 #undef SkSPRITE_BEGIN_ROW
michael@0 79
michael@0 80 #ifdef SkSPRITE_ROW_PROC
michael@0 81 #undef SkSPRITE_ROW_PROC
michael@0 82 #endif

mercurial