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 "SkBlitter.h" | 10 #include "SkBlitter.h" |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 SkBlitter* SkBlitter::Choose(const SkBitmap& device, | 850 SkBlitter* SkBlitter::Choose(const SkBitmap& device, |
851 const SkMatrix& matrix, | 851 const SkMatrix& matrix, |
852 const SkPaint& origPaint, | 852 const SkPaint& origPaint, |
853 void* storage, size_t storageSize) { | 853 void* storage, size_t storageSize) { |
854 SkASSERT(storageSize == 0 || storage != NULL); | 854 SkASSERT(storageSize == 0 || storage != NULL); |
855 | 855 |
856 SkBlitter* blitter = NULL; | 856 SkBlitter* blitter = NULL; |
857 | 857 |
858 // which check, in case we're being called by a client with a dummy device | 858 // which check, in case we're being called by a client with a dummy device |
859 // (e.g. they have a bounder that always aborts the draw) | 859 // (e.g. they have a bounder that always aborts the draw) |
860 if (SkBitmap::kNo_Config == device.getConfig()) { | 860 if (SkBitmap::kNo_Config == device.config()) { |
861 SK_PLACEMENT_NEW(blitter, SkNullBlitter, storage, storageSize); | 861 SK_PLACEMENT_NEW(blitter, SkNullBlitter, storage, storageSize); |
862 return blitter; | 862 return blitter; |
863 } | 863 } |
864 | 864 |
865 SkShader* shader = origPaint.getShader(); | 865 SkShader* shader = origPaint.getShader(); |
866 SkColorFilter* cf = origPaint.getColorFilter(); | 866 SkColorFilter* cf = origPaint.getColorFilter(); |
867 SkXfermode* mode = origPaint.getXfermode(); | 867 SkXfermode* mode = origPaint.getXfermode(); |
868 Sk3DShader* shader3D = NULL; | 868 Sk3DShader* shader3D = NULL; |
869 | 869 |
870 SkTCopyOnFirstWrite<SkPaint> paint(origPaint); | 870 SkTCopyOnFirstWrite<SkPaint> paint(origPaint); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 * endContext | 933 * endContext |
934 * We make the first call here, in case it fails we can abort the draw. | 934 * We make the first call here, in case it fails we can abort the draw. |
935 * The endContext() call is made by the blitter (assuming setContext did | 935 * The endContext() call is made by the blitter (assuming setContext did |
936 * not fail) in its destructor. | 936 * not fail) in its destructor. |
937 */ | 937 */ |
938 if (shader && !shader->setContext(device, *paint, matrix)) { | 938 if (shader && !shader->setContext(device, *paint, matrix)) { |
939 SK_PLACEMENT_NEW(blitter, SkNullBlitter, storage, storageSize); | 939 SK_PLACEMENT_NEW(blitter, SkNullBlitter, storage, storageSize); |
940 return blitter; | 940 return blitter; |
941 } | 941 } |
942 | 942 |
943 switch (device.getConfig()) { | 943 switch (device.config()) { |
944 case SkBitmap::kA1_Config: | 944 case SkBitmap::kA1_Config: |
945 SK_PLACEMENT_NEW_ARGS(blitter, SkA1_Blitter, | 945 SK_PLACEMENT_NEW_ARGS(blitter, SkA1_Blitter, |
946 storage, storageSize, (device, *paint)); | 946 storage, storageSize, (device, *paint)); |
947 break; | 947 break; |
948 | 948 |
949 case SkBitmap::kA8_Config: | 949 case SkBitmap::kA8_Config: |
950 if (shader) { | 950 if (shader) { |
951 SK_PLACEMENT_NEW_ARGS(blitter, SkA8_Shader_Blitter, | 951 SK_PLACEMENT_NEW_ARGS(blitter, SkA8_Shader_Blitter, |
952 storage, storageSize, (device, *paint)); | 952 storage, storageSize, (device, *paint)); |
953 } else { | 953 } else { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 | 1007 |
1008 fShader->ref(); | 1008 fShader->ref(); |
1009 fShaderFlags = fShader->getFlags(); | 1009 fShaderFlags = fShader->getFlags(); |
1010 } | 1010 } |
1011 | 1011 |
1012 SkShaderBlitter::~SkShaderBlitter() { | 1012 SkShaderBlitter::~SkShaderBlitter() { |
1013 SkASSERT(fShader->setContextHasBeenCalled()); | 1013 SkASSERT(fShader->setContextHasBeenCalled()); |
1014 fShader->endContext(); | 1014 fShader->endContext(); |
1015 fShader->unref(); | 1015 fShader->unref(); |
1016 } | 1016 } |
OLD | NEW |