OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkBlitter.h" | 8 #include "SkBlitter.h" |
9 #include "SkAntiRun.h" | 9 #include "SkAntiRun.h" |
10 #include "SkColor.h" | 10 #include "SkColor.h" |
11 #include "SkColorFilter.h" | 11 #include "SkColorFilter.h" |
12 #include "SkCoreBlitters.h" | 12 #include "SkCoreBlitters.h" |
13 #include "SkFilterShader.h" | 13 #include "SkFilterShader.h" |
14 #include "SkReadBuffer.h" | 14 #include "SkReadBuffer.h" |
15 #include "SkWriteBuffer.h" | 15 #include "SkWriteBuffer.h" |
16 #include "SkMask.h" | 16 #include "SkMask.h" |
17 #include "SkMaskFilter.h" | 17 #include "SkMaskFilter.h" |
18 #include "SkString.h" | 18 #include "SkString.h" |
19 #include "SkTLazy.h" | 19 #include "SkTLazy.h" |
20 #include "SkUtils.h" | 20 #include "SkUtils.h" |
21 #include "SkXfermode.h" | 21 #include "SkXfermode.h" |
22 | 22 |
23 SkBlitter::~SkBlitter() {} | 23 SkBlitter::~SkBlitter() { |
| 24 if (NULL != fBlitMemory) { |
| 25 sk_free(fBlitMemory); |
| 26 fBlitMemory = NULL; |
| 27 } |
| 28 } |
24 | 29 |
25 bool SkBlitter::isNullBlitter() const { return false; } | 30 bool SkBlitter::isNullBlitter() const { return false; } |
26 | 31 |
27 bool SkBlitter::resetShaderContext(const SkShader::ContextRec&) { | 32 bool SkBlitter::resetShaderContext(const SkShader::ContextRec&) { |
28 return true; | 33 return true; |
29 } | 34 } |
30 | 35 |
31 SkShader::Context* SkBlitter::getShaderContext() const { | 36 SkShader::Context* SkBlitter::getShaderContext() const { |
32 return NULL; | 37 return NULL; |
33 } | 38 } |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 int height = clip.height(); | 191 int height = clip.height(); |
187 int y = clip.fTop; | 192 int y = clip.fTop; |
188 while (--height >= 0) { | 193 while (--height >= 0) { |
189 this->blitAntiH(clip.fLeft, y, aa, runs); | 194 this->blitAntiH(clip.fLeft, y, aa, runs); |
190 aa += mask.fRowBytes; | 195 aa += mask.fRowBytes; |
191 y += 1; | 196 y += 1; |
192 } | 197 } |
193 } | 198 } |
194 } | 199 } |
195 | 200 |
| 201 void* SkBlitter::allocBlitMemory(size_t sz) { |
| 202 SkASSERT(NULL == fBlitMemory); |
| 203 if (NULL != fBlitMemory) { |
| 204 sk_free(fBlitMemory); |
| 205 fBlitMemory = NULL; |
| 206 } |
| 207 |
| 208 fBlitMemory = sk_malloc_throw(sz); |
| 209 return fBlitMemory; |
| 210 } |
| 211 |
196 /////////////////////// these guys are not virtual, just a helpers | 212 /////////////////////// these guys are not virtual, just a helpers |
197 | 213 |
198 void SkBlitter::blitMaskRegion(const SkMask& mask, const SkRegion& clip) { | 214 void SkBlitter::blitMaskRegion(const SkMask& mask, const SkRegion& clip) { |
199 if (clip.quickReject(mask.fBounds)) { | 215 if (clip.quickReject(mask.fBounds)) { |
200 return; | 216 return; |
201 } | 217 } |
202 | 218 |
203 SkRegion::Cliperator clipper(clip, mask.fBounds); | 219 SkRegion::Cliperator clipper(clip, mask.fBounds); |
204 | 220 |
205 while (!clipper.done()) { | 221 while (!clipper.done()) { |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 fShaderContext->~Context(); | 1048 fShaderContext->~Context(); |
1033 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); | 1049 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); |
1034 if (NULL == ctx) { | 1050 if (NULL == ctx) { |
1035 // Need a valid context in fShaderContext's storage, so we can later (or
our caller) call | 1051 // Need a valid context in fShaderContext's storage, so we can later (or
our caller) call |
1036 // the in-place destructor. | 1052 // the in-place destructor. |
1037 SkNEW_PLACEMENT_ARGS(fShaderContext, SkTransparentShaderContext, (*fShad
er, rec)); | 1053 SkNEW_PLACEMENT_ARGS(fShaderContext, SkTransparentShaderContext, (*fShad
er, rec)); |
1038 return false; | 1054 return false; |
1039 } | 1055 } |
1040 return true; | 1056 return true; |
1041 } | 1057 } |
OLD | NEW |