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" |
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 /* | 889 /* |
890 * We create a SkShader::Context object, and store it on the blitter. | 890 * We create a SkShader::Context object, and store it on the blitter. |
891 */ | 891 */ |
892 SkShader::Context* shaderContext = nullptr; | 892 SkShader::Context* shaderContext = nullptr; |
893 if (shader) { | 893 if (shader) { |
894 const SkShader::ContextRec rec(*paint, matrix, nullptr, | 894 const SkShader::ContextRec rec(*paint, matrix, nullptr, |
895 PreferredShaderDest(device.info())); | 895 PreferredShaderDest(device.info())); |
896 size_t contextSize = shader->contextSize(rec); | 896 size_t contextSize = shader->contextSize(rec); |
897 if (contextSize) { | 897 if (contextSize) { |
898 // Try to create the ShaderContext | 898 // Try to create the ShaderContext |
899 shaderContext = allocator->createWithIniter( | 899 void* storage = allocator->reserveT<SkShader::Context>(contextSize); |
900 contextSize, | 900 shaderContext = shader->createContext(rec, storage); |
901 [&rec, shader](void* storage) { | |
902 return shader->createContext(rec, storage); | |
903 }); | |
904 if (!shaderContext) { | 901 if (!shaderContext) { |
| 902 allocator->freeLast(); |
905 return allocator->createT<SkNullBlitter>(); | 903 return allocator->createT<SkNullBlitter>(); |
906 } | 904 } |
907 SkASSERT(shaderContext); | 905 SkASSERT(shaderContext); |
| 906 SkASSERT((void*) shaderContext == storage); |
908 } else { | 907 } else { |
909 return allocator->createT<SkNullBlitter>(); | 908 return allocator->createT<SkNullBlitter>(); |
910 } | 909 } |
911 } | 910 } |
912 | 911 |
913 SkBlitter* blitter = nullptr; | 912 SkBlitter* blitter = nullptr; |
914 switch (device.colorType()) { | 913 switch (device.colorType()) { |
915 case kAlpha_8_SkColorType: | 914 case kAlpha_8_SkColorType: |
916 if (drawCoverage) { | 915 if (drawCoverage) { |
917 SkASSERT(nullptr == shader); | 916 SkASSERT(nullptr == shader); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 SkASSERT(mask.fBounds.contains(clip)); | 1063 SkASSERT(mask.fBounds.contains(clip)); |
1065 SkASSERT(fClipRect.contains(clip)); | 1064 SkASSERT(fClipRect.contains(clip)); |
1066 fBlitter->blitMask(mask, clip); | 1065 fBlitter->blitMask(mask, clip); |
1067 } | 1066 } |
1068 | 1067 |
1069 const SkPixmap* SkRectClipCheckBlitter::justAnOpaqueColor(uint32_t* value) { | 1068 const SkPixmap* SkRectClipCheckBlitter::justAnOpaqueColor(uint32_t* value) { |
1070 return fBlitter->justAnOpaqueColor(value); | 1069 return fBlitter->justAnOpaqueColor(value); |
1071 } | 1070 } |
1072 | 1071 |
1073 #endif | 1072 #endif |
OLD | NEW |