gfx/skia/trunk/src/core/SkCoreBlitters.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 2006 The Android Open Source Project
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 SkCoreBlitters_DEFINED
michael@0 9 #define SkCoreBlitters_DEFINED
michael@0 10
michael@0 11 #include "SkBitmapProcShader.h"
michael@0 12 #include "SkBlitter.h"
michael@0 13 #include "SkBlitRow.h"
michael@0 14 #include "SkShader.h"
michael@0 15 #include "SkSmallAllocator.h"
michael@0 16
michael@0 17 class SkRasterBlitter : public SkBlitter {
michael@0 18 public:
michael@0 19 SkRasterBlitter(const SkBitmap& device) : fDevice(device) {}
michael@0 20
michael@0 21 protected:
michael@0 22 const SkBitmap& fDevice;
michael@0 23
michael@0 24 private:
michael@0 25 typedef SkBlitter INHERITED;
michael@0 26 };
michael@0 27
michael@0 28 class SkShaderBlitter : public SkRasterBlitter {
michael@0 29 public:
michael@0 30 SkShaderBlitter(const SkBitmap& device, const SkPaint& paint);
michael@0 31 virtual ~SkShaderBlitter();
michael@0 32
michael@0 33 protected:
michael@0 34 uint32_t fShaderFlags;
michael@0 35 SkShader* fShader;
michael@0 36
michael@0 37 private:
michael@0 38 // illegal
michael@0 39 SkShaderBlitter& operator=(const SkShaderBlitter&);
michael@0 40
michael@0 41 typedef SkRasterBlitter INHERITED;
michael@0 42 };
michael@0 43
michael@0 44 ///////////////////////////////////////////////////////////////////////////////
michael@0 45
michael@0 46 class SkA8_Coverage_Blitter : public SkRasterBlitter {
michael@0 47 public:
michael@0 48 SkA8_Coverage_Blitter(const SkBitmap& device, const SkPaint& paint);
michael@0 49 virtual void blitH(int x, int y, int width) SK_OVERRIDE;
michael@0 50 virtual void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]) SK_OVERRIDE;
michael@0 51 virtual void blitV(int x, int y, int height, SkAlpha alpha) SK_OVERRIDE;
michael@0 52 virtual void blitRect(int x, int y, int width, int height) SK_OVERRIDE;
michael@0 53 virtual void blitMask(const SkMask&, const SkIRect&) SK_OVERRIDE;
michael@0 54 virtual const SkBitmap* justAnOpaqueColor(uint32_t*) SK_OVERRIDE;
michael@0 55 };
michael@0 56
michael@0 57 class SkA8_Blitter : public SkRasterBlitter {
michael@0 58 public:
michael@0 59 SkA8_Blitter(const SkBitmap& device, const SkPaint& paint);
michael@0 60 virtual void blitH(int x, int y, int width);
michael@0 61 virtual void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]);
michael@0 62 virtual void blitV(int x, int y, int height, SkAlpha alpha);
michael@0 63 virtual void blitRect(int x, int y, int width, int height);
michael@0 64 virtual void blitMask(const SkMask&, const SkIRect&);
michael@0 65 virtual const SkBitmap* justAnOpaqueColor(uint32_t*);
michael@0 66
michael@0 67 private:
michael@0 68 unsigned fSrcA;
michael@0 69
michael@0 70 // illegal
michael@0 71 SkA8_Blitter& operator=(const SkA8_Blitter&);
michael@0 72
michael@0 73 typedef SkRasterBlitter INHERITED;
michael@0 74 };
michael@0 75
michael@0 76 class SkA8_Shader_Blitter : public SkShaderBlitter {
michael@0 77 public:
michael@0 78 SkA8_Shader_Blitter(const SkBitmap& device, const SkPaint& paint);
michael@0 79 virtual ~SkA8_Shader_Blitter();
michael@0 80 virtual void blitH(int x, int y, int width);
michael@0 81 virtual void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]);
michael@0 82 virtual void blitMask(const SkMask&, const SkIRect&);
michael@0 83
michael@0 84 private:
michael@0 85 SkXfermode* fXfermode;
michael@0 86 SkPMColor* fBuffer;
michael@0 87 uint8_t* fAAExpand;
michael@0 88
michael@0 89 // illegal
michael@0 90 SkA8_Shader_Blitter& operator=(const SkA8_Shader_Blitter&);
michael@0 91
michael@0 92 typedef SkShaderBlitter INHERITED;
michael@0 93 };
michael@0 94
michael@0 95 ////////////////////////////////////////////////////////////////
michael@0 96
michael@0 97 class SkARGB32_Blitter : public SkRasterBlitter {
michael@0 98 public:
michael@0 99 SkARGB32_Blitter(const SkBitmap& device, const SkPaint& paint);
michael@0 100 virtual void blitH(int x, int y, int width);
michael@0 101 virtual void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]);
michael@0 102 virtual void blitV(int x, int y, int height, SkAlpha alpha);
michael@0 103 virtual void blitRect(int x, int y, int width, int height);
michael@0 104 virtual void blitMask(const SkMask&, const SkIRect&);
michael@0 105 virtual const SkBitmap* justAnOpaqueColor(uint32_t*);
michael@0 106
michael@0 107 protected:
michael@0 108 SkColor fColor;
michael@0 109 SkPMColor fPMColor;
michael@0 110 SkBlitRow::ColorProc fColor32Proc;
michael@0 111 SkBlitRow::ColorRectProc fColorRect32Proc;
michael@0 112
michael@0 113 private:
michael@0 114 unsigned fSrcA, fSrcR, fSrcG, fSrcB;
michael@0 115
michael@0 116 // illegal
michael@0 117 SkARGB32_Blitter& operator=(const SkARGB32_Blitter&);
michael@0 118
michael@0 119 typedef SkRasterBlitter INHERITED;
michael@0 120 };
michael@0 121
michael@0 122 class SkARGB32_Opaque_Blitter : public SkARGB32_Blitter {
michael@0 123 public:
michael@0 124 SkARGB32_Opaque_Blitter(const SkBitmap& device, const SkPaint& paint)
michael@0 125 : INHERITED(device, paint) { SkASSERT(paint.getAlpha() == 0xFF); }
michael@0 126 virtual void blitMask(const SkMask&, const SkIRect&);
michael@0 127
michael@0 128 private:
michael@0 129 typedef SkARGB32_Blitter INHERITED;
michael@0 130 };
michael@0 131
michael@0 132 class SkARGB32_Black_Blitter : public SkARGB32_Opaque_Blitter {
michael@0 133 public:
michael@0 134 SkARGB32_Black_Blitter(const SkBitmap& device, const SkPaint& paint)
michael@0 135 : INHERITED(device, paint) {}
michael@0 136 virtual void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]);
michael@0 137
michael@0 138 private:
michael@0 139 typedef SkARGB32_Opaque_Blitter INHERITED;
michael@0 140 };
michael@0 141
michael@0 142 class SkARGB32_Shader_Blitter : public SkShaderBlitter {
michael@0 143 public:
michael@0 144 SkARGB32_Shader_Blitter(const SkBitmap& device, const SkPaint& paint);
michael@0 145 virtual ~SkARGB32_Shader_Blitter();
michael@0 146 virtual void blitH(int x, int y, int width) SK_OVERRIDE;
michael@0 147 virtual void blitV(int x, int y, int height, SkAlpha alpha) SK_OVERRIDE;
michael@0 148 virtual void blitRect(int x, int y, int width, int height) SK_OVERRIDE;
michael@0 149 virtual void blitAntiH(int x, int y, const SkAlpha[], const int16_t[]) SK_OVERRIDE;
michael@0 150 virtual void blitMask(const SkMask&, const SkIRect&) SK_OVERRIDE;
michael@0 151
michael@0 152 private:
michael@0 153 SkXfermode* fXfermode;
michael@0 154 SkPMColor* fBuffer;
michael@0 155 SkBlitRow::Proc32 fProc32;
michael@0 156 SkBlitRow::Proc32 fProc32Blend;
michael@0 157 bool fShadeDirectlyIntoDevice;
michael@0 158 bool fConstInY;
michael@0 159
michael@0 160 // illegal
michael@0 161 SkARGB32_Shader_Blitter& operator=(const SkARGB32_Shader_Blitter&);
michael@0 162
michael@0 163 typedef SkShaderBlitter INHERITED;
michael@0 164 };
michael@0 165
michael@0 166 ///////////////////////////////////////////////////////////////////////////////
michael@0 167
michael@0 168 /* These return the correct subclass of blitter for their device config.
michael@0 169
michael@0 170 Currently, they make the following assumptions about the state of the
michael@0 171 paint:
michael@0 172
michael@0 173 1. If there is an xfermode, there will also be a shader
michael@0 174 2. If there is a colorfilter, there will be a shader that itself handles
michael@0 175 calling the filter, so the blitter can always ignore the colorfilter obj
michael@0 176
michael@0 177 These pre-conditions must be handled by the caller, in our case
michael@0 178 SkBlitter::Choose(...)
michael@0 179 */
michael@0 180
michael@0 181 SkBlitter* SkBlitter_ChooseD565(const SkBitmap& device, const SkPaint& paint,
michael@0 182 SkTBlitterAllocator* allocator);
michael@0 183
michael@0 184 #endif

mercurial