OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkBlitRow.h" | 10 #include "SkBlitRow.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 dst[count - 1] = value; | 52 dst[count - 1] = value; |
53 } | 53 } |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 /////////////////////////////////////////////////////////////////////////////// | 57 /////////////////////////////////////////////////////////////////////////////// |
58 | 58 |
59 class SkRGB16_Blitter : public SkRasterBlitter { | 59 class SkRGB16_Blitter : public SkRasterBlitter { |
60 public: | 60 public: |
61 SkRGB16_Blitter(const SkBitmap& device, const SkPaint& paint); | 61 SkRGB16_Blitter(const SkBitmap& device, const SkPaint& paint); |
62 virtual void blitH(int x, int y, int width) SK_OVERRIDE; | 62 void blitH(int x, int y, int width) SK_OVERRIDE; |
63 virtual void blitAntiH(int x, int y, const SkAlpha* antialias, | 63 virtual void blitAntiH(int x, int y, const SkAlpha* antialias, |
64 const int16_t* runs) SK_OVERRIDE; | 64 const int16_t* runs) SK_OVERRIDE; |
65 virtual void blitV(int x, int y, int height, SkAlpha alpha) SK_OVERRIDE; | 65 void blitV(int x, int y, int height, SkAlpha alpha) SK_OVERRIDE; |
66 virtual void blitRect(int x, int y, int width, int height) SK_OVERRIDE; | 66 void blitRect(int x, int y, int width, int height) SK_OVERRIDE; |
67 virtual void blitMask(const SkMask&, | 67 virtual void blitMask(const SkMask&, |
68 const SkIRect&) SK_OVERRIDE; | 68 const SkIRect&) SK_OVERRIDE; |
69 virtual const SkBitmap* justAnOpaqueColor(uint32_t*) SK_OVERRIDE; | 69 const SkBitmap* justAnOpaqueColor(uint32_t*) SK_OVERRIDE; |
70 | 70 |
71 protected: | 71 protected: |
72 SkPMColor fSrcColor32; | 72 SkPMColor fSrcColor32; |
73 uint32_t fExpandedRaw16; | 73 uint32_t fExpandedRaw16; |
74 unsigned fScale; | 74 unsigned fScale; |
75 uint16_t fColor16; // already scaled by fScale | 75 uint16_t fColor16; // already scaled by fScale |
76 uint16_t fRawColor16; // unscaled | 76 uint16_t fRawColor16; // unscaled |
77 uint16_t fRawDither16; // unscaled | 77 uint16_t fRawDither16; // unscaled |
78 SkBool8 fDoDither; | 78 SkBool8 fDoDither; |
79 | 79 |
80 // illegal | 80 // illegal |
81 SkRGB16_Blitter& operator=(const SkRGB16_Blitter&); | 81 SkRGB16_Blitter& operator=(const SkRGB16_Blitter&); |
82 | 82 |
83 typedef SkRasterBlitter INHERITED; | 83 typedef SkRasterBlitter INHERITED; |
84 }; | 84 }; |
85 | 85 |
86 class SkRGB16_Opaque_Blitter : public SkRGB16_Blitter { | 86 class SkRGB16_Opaque_Blitter : public SkRGB16_Blitter { |
87 public: | 87 public: |
88 SkRGB16_Opaque_Blitter(const SkBitmap& device, const SkPaint& paint); | 88 SkRGB16_Opaque_Blitter(const SkBitmap& device, const SkPaint& paint); |
89 virtual void blitH(int x, int y, int width) SK_OVERRIDE; | 89 void blitH(int x, int y, int width) SK_OVERRIDE; |
90 virtual void blitAntiH(int x, int y, const SkAlpha* antialias, | 90 virtual void blitAntiH(int x, int y, const SkAlpha* antialias, |
91 const int16_t* runs) SK_OVERRIDE; | 91 const int16_t* runs) SK_OVERRIDE; |
92 virtual void blitV(int x, int y, int height, SkAlpha alpha) SK_OVERRIDE; | 92 void blitV(int x, int y, int height, SkAlpha alpha) SK_OVERRIDE; |
93 virtual void blitRect(int x, int y, int width, int height) SK_OVERRIDE; | 93 void blitRect(int x, int y, int width, int height) SK_OVERRIDE; |
94 virtual void blitMask(const SkMask&, | 94 virtual void blitMask(const SkMask&, |
95 const SkIRect&) SK_OVERRIDE; | 95 const SkIRect&) SK_OVERRIDE; |
96 | 96 |
97 private: | 97 private: |
98 typedef SkRGB16_Blitter INHERITED; | 98 typedef SkRGB16_Blitter INHERITED; |
99 }; | 99 }; |
100 | 100 |
101 #ifdef USE_BLACK_BLITTER | 101 #ifdef USE_BLACK_BLITTER |
102 class SkRGB16_Black_Blitter : public SkRGB16_Opaque_Blitter { | 102 class SkRGB16_Black_Blitter : public SkRGB16_Opaque_Blitter { |
103 public: | 103 public: |
104 SkRGB16_Black_Blitter(const SkBitmap& device, const SkPaint& paint); | 104 SkRGB16_Black_Blitter(const SkBitmap& device, const SkPaint& paint); |
105 virtual void blitMask(const SkMask&, const SkIRect&) SK_OVERRIDE; | 105 void blitMask(const SkMask&, const SkIRect&) SK_OVERRIDE; |
106 virtual void blitAntiH(int x, int y, const SkAlpha* antialias, | 106 virtual void blitAntiH(int x, int y, const SkAlpha* antialias, |
107 const int16_t* runs) SK_OVERRIDE; | 107 const int16_t* runs) SK_OVERRIDE; |
108 | 108 |
109 private: | 109 private: |
110 typedef SkRGB16_Opaque_Blitter INHERITED; | 110 typedef SkRGB16_Opaque_Blitter INHERITED; |
111 }; | 111 }; |
112 #endif | 112 #endif |
113 | 113 |
114 class SkRGB16_Shader_Blitter : public SkShaderBlitter { | 114 class SkRGB16_Shader_Blitter : public SkShaderBlitter { |
115 public: | 115 public: |
116 SkRGB16_Shader_Blitter(const SkBitmap& device, const SkPaint& paint, | 116 SkRGB16_Shader_Blitter(const SkBitmap& device, const SkPaint& paint, |
117 SkShader::Context* shaderContext); | 117 SkShader::Context* shaderContext); |
118 virtual ~SkRGB16_Shader_Blitter(); | 118 virtual ~SkRGB16_Shader_Blitter(); |
119 virtual void blitH(int x, int y, int width) SK_OVERRIDE; | 119 void blitH(int x, int y, int width) SK_OVERRIDE; |
120 virtual void blitAntiH(int x, int y, const SkAlpha* antialias, | 120 virtual void blitAntiH(int x, int y, const SkAlpha* antialias, |
121 const int16_t* runs) SK_OVERRIDE; | 121 const int16_t* runs) SK_OVERRIDE; |
122 virtual void blitRect(int x, int y, int width, int height) SK_OVERRIDE; | 122 void blitRect(int x, int y, int width, int height) SK_OVERRIDE; |
123 | 123 |
124 protected: | 124 protected: |
125 SkPMColor* fBuffer; | 125 SkPMColor* fBuffer; |
126 SkBlitRow::Proc fOpaqueProc; | 126 SkBlitRow::Proc fOpaqueProc; |
127 SkBlitRow::Proc fAlphaProc; | 127 SkBlitRow::Proc fAlphaProc; |
128 | 128 |
129 private: | 129 private: |
130 // illegal | 130 // illegal |
131 SkRGB16_Shader_Blitter& operator=(const SkRGB16_Shader_Blitter&); | 131 SkRGB16_Shader_Blitter& operator=(const SkRGB16_Shader_Blitter&); |
132 | 132 |
133 typedef SkShaderBlitter INHERITED; | 133 typedef SkShaderBlitter INHERITED; |
134 }; | 134 }; |
135 | 135 |
136 // used only if the shader can perform shadSpan16 | 136 // used only if the shader can perform shadSpan16 |
137 class SkRGB16_Shader16_Blitter : public SkRGB16_Shader_Blitter { | 137 class SkRGB16_Shader16_Blitter : public SkRGB16_Shader_Blitter { |
138 public: | 138 public: |
139 SkRGB16_Shader16_Blitter(const SkBitmap& device, const SkPaint& paint, | 139 SkRGB16_Shader16_Blitter(const SkBitmap& device, const SkPaint& paint, |
140 SkShader::Context* shaderContext); | 140 SkShader::Context* shaderContext); |
141 virtual void blitH(int x, int y, int width) SK_OVERRIDE; | 141 void blitH(int x, int y, int width) SK_OVERRIDE; |
142 virtual void blitAntiH(int x, int y, const SkAlpha* antialias, | 142 virtual void blitAntiH(int x, int y, const SkAlpha* antialias, |
143 const int16_t* runs) SK_OVERRIDE; | 143 const int16_t* runs) SK_OVERRIDE; |
144 virtual void blitRect(int x, int y, int width, int height) SK_OVERRIDE; | 144 void blitRect(int x, int y, int width, int height) SK_OVERRIDE; |
145 | 145 |
146 private: | 146 private: |
147 typedef SkRGB16_Shader_Blitter INHERITED; | 147 typedef SkRGB16_Shader_Blitter INHERITED; |
148 }; | 148 }; |
149 | 149 |
150 class SkRGB16_Shader_Xfermode_Blitter : public SkShaderBlitter { | 150 class SkRGB16_Shader_Xfermode_Blitter : public SkShaderBlitter { |
151 public: | 151 public: |
152 SkRGB16_Shader_Xfermode_Blitter(const SkBitmap& device, const SkPaint& paint
, | 152 SkRGB16_Shader_Xfermode_Blitter(const SkBitmap& device, const SkPaint& paint
, |
153 SkShader::Context* shaderContext); | 153 SkShader::Context* shaderContext); |
154 virtual ~SkRGB16_Shader_Xfermode_Blitter(); | 154 virtual ~SkRGB16_Shader_Xfermode_Blitter(); |
155 virtual void blitH(int x, int y, int width) SK_OVERRIDE; | 155 void blitH(int x, int y, int width) SK_OVERRIDE; |
156 virtual void blitAntiH(int x, int y, const SkAlpha* antialias, | 156 virtual void blitAntiH(int x, int y, const SkAlpha* antialias, |
157 const int16_t* runs) SK_OVERRIDE; | 157 const int16_t* runs) SK_OVERRIDE; |
158 | 158 |
159 private: | 159 private: |
160 SkXfermode* fXfermode; | 160 SkXfermode* fXfermode; |
161 SkPMColor* fBuffer; | 161 SkPMColor* fBuffer; |
162 uint8_t* fAAExpand; | 162 uint8_t* fAAExpand; |
163 | 163 |
164 // illegal | 164 // illegal |
165 SkRGB16_Shader_Xfermode_Blitter& operator=(const SkRGB16_Shader_Xfermode_Bli
tter&); | 165 SkRGB16_Shader_Xfermode_Blitter& operator=(const SkRGB16_Shader_Xfermode_Bli
tter&); |
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 #endif | 1060 #endif |
1061 } else if (0xFF == SkColorGetA(color)) { | 1061 } else if (0xFF == SkColorGetA(color)) { |
1062 blitter = allocator->createT<SkRGB16_Opaque_Blitter>(device, paint); | 1062 blitter = allocator->createT<SkRGB16_Opaque_Blitter>(device, paint); |
1063 } else { | 1063 } else { |
1064 blitter = allocator->createT<SkRGB16_Blitter>(device, paint); | 1064 blitter = allocator->createT<SkRGB16_Blitter>(device, paint); |
1065 } | 1065 } |
1066 } | 1066 } |
1067 | 1067 |
1068 return blitter; | 1068 return blitter; |
1069 } | 1069 } |
OLD | NEW |