Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: src/core/SkBlitter_RGB16.cpp

Issue 179343005: Add a class to allocate small objects w/o extra calls to new. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rename the .h file Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "SkCoreBlitters.h" 11 #include "SkCoreBlitters.h"
12 #include "SkColorPriv.h" 12 #include "SkColorPriv.h"
13 #include "SkDither.h" 13 #include "SkDither.h"
14 #include "SkShader.h" 14 #include "SkShader.h"
15 #include "SkTemplatesPriv.h"
16 #include "SkUtils.h" 15 #include "SkUtils.h"
17 #include "SkXfermode.h" 16 #include "SkXfermode.h"
18 17
19 #if defined(__ARM_HAVE_NEON) && defined(SK_CPU_LENDIAN) 18 #if defined(__ARM_HAVE_NEON) && defined(SK_CPU_LENDIAN)
20 #define SK_USE_NEON 19 #define SK_USE_NEON
21 #include <arm_neon.h> 20 #include <arm_neon.h>
22 #else 21 #else
23 // if we don't have neon, then our black blitter is worth the extra code 22 // if we don't have neon, then our black blitter is worth the extra code
24 #define USE_BLACK_BLITTER 23 #define USE_BLACK_BLITTER
25 #endif 24 #endif
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 count = *runs; 1005 count = *runs;
1007 SkASSERT(count > 0); 1006 SkASSERT(count > 0);
1008 aa = *antialias; 1007 aa = *antialias;
1009 } 1008 }
1010 } 1009 }
1011 } 1010 }
1012 1011
1013 /////////////////////////////////////////////////////////////////////////////// 1012 ///////////////////////////////////////////////////////////////////////////////
1014 1013
1015 SkBlitter* SkBlitter_ChooseD565(const SkBitmap& device, const SkPaint& paint, 1014 SkBlitter* SkBlitter_ChooseD565(const SkBitmap& device, const SkPaint& paint,
1016 void* storage, size_t storageSize) { 1015 SkTBlitterAllocator* allocator) {
1016 SkASSERT(allocator != NULL);
1017
1017 SkBlitter* blitter; 1018 SkBlitter* blitter;
1018 SkShader* shader = paint.getShader(); 1019 SkShader* shader = paint.getShader();
1019 SkXfermode* mode = paint.getXfermode(); 1020 SkXfermode* mode = paint.getXfermode();
1020 1021
1021 // we require a shader if there is an xfermode, handled by our caller 1022 // we require a shader if there is an xfermode, handled by our caller
1022 SkASSERT(NULL == mode || NULL != shader); 1023 SkASSERT(NULL == mode || NULL != shader);
1023 1024
1024 if (shader) { 1025 if (shader) {
1025 if (mode) { 1026 if (mode) {
1026 SK_PLACEMENT_NEW_ARGS(blitter, SkRGB16_Shader_Xfermode_Blitter, 1027 blitter = allocator->createT<SkRGB16_Shader_Xfermode_Blitter>(device , paint);
1027 storage, storageSize, (device, paint));
1028 } else if (shader->canCallShadeSpan16()) { 1028 } else if (shader->canCallShadeSpan16()) {
1029 SK_PLACEMENT_NEW_ARGS(blitter, SkRGB16_Shader16_Blitter, 1029 blitter = allocator->createT<SkRGB16_Shader16_Blitter>(device, paint );
1030 storage, storageSize, (device, paint));
1031 } else { 1030 } else {
1032 SK_PLACEMENT_NEW_ARGS(blitter, SkRGB16_Shader_Blitter, 1031 blitter = allocator->createT<SkRGB16_Shader_Blitter>(device, paint);
1033 storage, storageSize, (device, paint));
1034 } 1032 }
1035 } else { 1033 } else {
1036 // no shader, no xfermode, (and we always ignore colorfilter) 1034 // no shader, no xfermode, (and we always ignore colorfilter)
1037 SkColor color = paint.getColor(); 1035 SkColor color = paint.getColor();
1038 if (0 == SkColorGetA(color)) { 1036 if (0 == SkColorGetA(color)) {
1039 SK_PLACEMENT_NEW(blitter, SkNullBlitter, storage, storageSize); 1037 blitter = allocator->createT<SkNullBlitter>();
1040 #ifdef USE_BLACK_BLITTER 1038 #ifdef USE_BLACK_BLITTER
1041 } else if (SK_ColorBLACK == color) { 1039 } else if (SK_ColorBLACK == color) {
1042 SK_PLACEMENT_NEW_ARGS(blitter, SkRGB16_Black_Blitter, storage, 1040 blitter = allocator->createT<SkRGB16_Black_Blitter>(device, paint);
1043 storageSize, (device, paint));
1044 #endif 1041 #endif
1045 } else if (0xFF == SkColorGetA(color)) { 1042 } else if (0xFF == SkColorGetA(color)) {
1046 SK_PLACEMENT_NEW_ARGS(blitter, SkRGB16_Opaque_Blitter, storage, 1043 blitter = allocator->createT<SkRGB16_Opaque_Blitter>(device, paint);
1047 storageSize, (device, paint));
1048 } else { 1044 } else {
1049 SK_PLACEMENT_NEW_ARGS(blitter, SkRGB16_Blitter, storage, 1045 blitter = allocator->createT<SkRGB16_Blitter>(device, paint);
1050 storageSize, (device, paint));
1051 } 1046 }
1052 } 1047 }
1053 1048
1054 return blitter; 1049 return blitter;
1055 } 1050 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698