Chromium Code Reviews| 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 if (NULL != fBlitMemory) { | |
|
reed1
2014/07/21 14:51:13
Should this happen (we get called twice)?
krajcevski
2014/07/21 15:04:41
Added an assert to catch if it is, but we shouldn'
| |
| 203 sk_free(fBlitMemory); | |
| 204 fBlitMemory = NULL; | |
| 205 } | |
| 206 | |
| 207 fBlitMemory = sk_malloc_throw(sz); | |
| 208 return fBlitMemory; | |
| 209 } | |
| 210 | |
| 196 /////////////////////// these guys are not virtual, just a helpers | 211 /////////////////////// these guys are not virtual, just a helpers |
| 197 | 212 |
| 198 void SkBlitter::blitMaskRegion(const SkMask& mask, const SkRegion& clip) { | 213 void SkBlitter::blitMaskRegion(const SkMask& mask, const SkRegion& clip) { |
| 199 if (clip.quickReject(mask.fBounds)) { | 214 if (clip.quickReject(mask.fBounds)) { |
| 200 return; | 215 return; |
| 201 } | 216 } |
| 202 | 217 |
| 203 SkRegion::Cliperator clipper(clip, mask.fBounds); | 218 SkRegion::Cliperator clipper(clip, mask.fBounds); |
| 204 | 219 |
| 205 while (!clipper.done()) { | 220 while (!clipper.done()) { |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1032 fShaderContext->~Context(); | 1047 fShaderContext->~Context(); |
| 1033 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); | 1048 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); |
| 1034 if (NULL == ctx) { | 1049 if (NULL == ctx) { |
| 1035 // Need a valid context in fShaderContext's storage, so we can later (or our caller) call | 1050 // Need a valid context in fShaderContext's storage, so we can later (or our caller) call |
| 1036 // the in-place destructor. | 1051 // the in-place destructor. |
| 1037 SkNEW_PLACEMENT_ARGS(fShaderContext, SkTransparentShaderContext, (*fShad er, rec)); | 1052 SkNEW_PLACEMENT_ARGS(fShaderContext, SkTransparentShaderContext, (*fShad er, rec)); |
| 1038 return false; | 1053 return false; |
| 1039 } | 1054 } |
| 1040 return true; | 1055 return true; |
| 1041 } | 1056 } |
| OLD | NEW |