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

Side by Side Diff: src/opts/SkBitmapProcState_opts_arm.cpp

Issue 719213008: SkColorTable locking serves no purpose anymore. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: oops Created 6 years 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
« no previous file with comments | « src/images/SkImageEncoder_argb.cpp ('k') | src/opts/SkBitmapProcState_opts_mips_dsp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2009 The Android Open Source Project 2 * Copyright 2009 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 8
9 #include "SkBitmapScaler.h" 9 #include "SkBitmapScaler.h"
10 #include "SkBitmapProcState.h" 10 #include "SkBitmapProcState.h"
(...skipping 12 matching lines...) Expand all
23 int count, 23 int count,
24 uint16_t* SK_RESTRICT colors) SK_ATTRIBUTE_OPTIMIZE_O1; 24 uint16_t* SK_RESTRICT colors) SK_ATTRIBUTE_OPTIMIZE_O1;
25 25
26 void SI8_D16_nofilter_DX_arm(const SkBitmapProcState& s, 26 void SI8_D16_nofilter_DX_arm(const SkBitmapProcState& s,
27 const uint32_t* SK_RESTRICT xy, 27 const uint32_t* SK_RESTRICT xy,
28 int count, uint16_t* SK_RESTRICT colors) { 28 int count, uint16_t* SK_RESTRICT colors) {
29 SkASSERT(count > 0 && colors != NULL); 29 SkASSERT(count > 0 && colors != NULL);
30 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); 30 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
31 SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel); 31 SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel);
32 32
33 const uint16_t* SK_RESTRICT table = s.fBitmap->getColorTable()->lock16BitCac he(); 33 const uint16_t* SK_RESTRICT table = s.fBitmap->getColorTable()->read16BitCac he();
34 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels(); 34 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels();
35 35
36 // buffer is y32, x16, x16, x16, x16, x16 36 // buffer is y32, x16, x16, x16, x16, x16
37 // bump srcAddr to the proper row, since we're told Y never changes 37 // bump srcAddr to the proper row, since we're told Y never changes
38 SkASSERT((unsigned)xy[0] < (unsigned)s.fBitmap->height()); 38 SkASSERT((unsigned)xy[0] < (unsigned)s.fBitmap->height());
39 srcAddr = (const uint8_t*)((const char*)srcAddr + 39 srcAddr = (const uint8_t*)((const char*)srcAddr +
40 xy[0] * s.fBitmap->rowBytes()); 40 xy[0] * s.fBitmap->rowBytes());
41 41
42 uint8_t src; 42 uint8_t src;
43 43
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 "2: \n\t" 97 "2: \n\t"
98 : [xx] "+r" (xx), [count8] "+r" (count8), [colors] "+r" (colors) 98 : [xx] "+r" (xx), [count8] "+r" (count8), [colors] "+r" (colors)
99 : [table] "r" (table), [srcAddr] "r" (srcAddr) 99 : [table] "r" (table), [srcAddr] "r" (srcAddr)
100 : "memory", "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11" 100 : "memory", "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11"
101 ); 101 );
102 102
103 for (i = (count & 7); i > 0; --i) { 103 for (i = (count & 7); i > 0; --i) {
104 src = srcAddr[*xx++]; *colors++ = table[src]; 104 src = srcAddr[*xx++]; *colors++ = table[src];
105 } 105 }
106 } 106 }
107
108 s.fBitmap->getColorTable()->unlock16BitCache();
109 } 107 }
110 108
111 void SI8_opaque_D32_nofilter_DX_arm( 109 void SI8_opaque_D32_nofilter_DX_arm(
112 const SkBitmapProcState& s, 110 const SkBitmapProcState& s,
113 const uint32_t* SK_RESTRICT xy, 111 const uint32_t* SK_RESTRICT xy,
114 int count, 112 int count,
115 SkPMColor* SK_RESTRICT colors) SK_ATTRIBUTE_OPTIMIZE_O1; 113 SkPMColor* SK_RESTRICT colors) SK_ATTRIBUTE_OPTIMIZE_O1;
116 114
117 void SI8_opaque_D32_nofilter_DX_arm(const SkBitmapProcState& s, 115 void SI8_opaque_D32_nofilter_DX_arm(const SkBitmapProcState& s,
118 const uint32_t* SK_RESTRICT xy, 116 const uint32_t* SK_RESTRICT xy,
119 int count, SkPMColor* SK_RESTRICT colors) { 117 int count, SkPMColor* SK_RESTRICT colors) {
120 SkASSERT(count > 0 && colors != NULL); 118 SkASSERT(count > 0 && colors != NULL);
121 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); 119 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
122 SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel); 120 SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel);
123 121
124 const SkPMColor* SK_RESTRICT table = s.fBitmap->getColorTable()->lockColors( ); 122 const SkPMColor* SK_RESTRICT table = s.fBitmap->getColorTable()->readColors( );
125 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels(); 123 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels();
126 124
127 // buffer is y32, x16, x16, x16, x16, x16 125 // buffer is y32, x16, x16, x16, x16, x16
128 // bump srcAddr to the proper row, since we're told Y never changes 126 // bump srcAddr to the proper row, since we're told Y never changes
129 SkASSERT((unsigned)xy[0] < (unsigned)s.fBitmap->height()); 127 SkASSERT((unsigned)xy[0] < (unsigned)s.fBitmap->height());
130 srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fBitmap->rowByte s()); 128 srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fBitmap->rowByte s());
131 129
132 if (1 == s.fBitmap->width()) { 130 if (1 == s.fBitmap->width()) {
133 uint8_t src = srcAddr[0]; 131 uint8_t src = srcAddr[0];
134 SkPMColor dstValue = table[src]; 132 SkPMColor dstValue = table[src];
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 "ldrb r5, [%[srcAddr], r4] \n\t" // load pixel from image 175 "ldrb r5, [%[srcAddr], r4] \n\t" // load pixel from image
178 "ldr r6, [%[table], r5, lsl #2] \n\t" // load SkPMColor from colmap 176 "ldr r6, [%[table], r5, lsl #2] \n\t" // load SkPMColor from colmap
179 "str r6, [%[colors]], #4 \n\t" // store pixel, up date ptr 177 "str r6, [%[colors]], #4 \n\t" // store pixel, up date ptr
180 "bne 3b \n\t" // loop if counter != 0 178 "bne 3b \n\t" // loop if counter != 0
181 "4: \n\t" // exit 179 "4: \n\t" // exit
182 : [xx] "+r" (xx), [count] "+r" (count), [colors] "+r" (colors) 180 : [xx] "+r" (xx), [count] "+r" (count), [colors] "+r" (colors)
183 : [table] "r" (table), [srcAddr] "r" (srcAddr) 181 : [table] "r" (table), [srcAddr] "r" (srcAddr)
184 : "memory", "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11" 182 : "memory", "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11"
185 ); 183 );
186 } 184 }
187
188 s.fBitmap->getColorTable()->unlockColors();
189 } 185 }
190 #endif // !defined(SK_CPU_ARM64) && SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN) 186 #endif // !defined(SK_CPU_ARM64) && SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN)
191 187
192 /////////////////////////////////////////////////////////////////////////////// 188 ///////////////////////////////////////////////////////////////////////////////
193 189
194 /* If we replace a sampleproc, then we null-out the associated shaderproc, 190 /* If we replace a sampleproc, then we null-out the associated shaderproc,
195 otherwise the shader won't even look at the matrix/sampler 191 otherwise the shader won't even look at the matrix/sampler
196 */ 192 */
197 void SkBitmapProcState::platformProcs() { 193 void SkBitmapProcState::platformProcs() {
198 #if !defined(SK_CPU_ARM64) && SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN) 194 #if !defined(SK_CPU_ARM64) && SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN)
(...skipping 27 matching lines...) Expand all
226 /////////////////////////////////////////////////////////////////////////////// 222 ///////////////////////////////////////////////////////////////////////////////
227 223
228 extern void platformConvolutionProcs_arm_neon(SkConvolutionProcs* procs); 224 extern void platformConvolutionProcs_arm_neon(SkConvolutionProcs* procs);
229 225
230 void platformConvolutionProcs_arm(SkConvolutionProcs* procs) { 226 void platformConvolutionProcs_arm(SkConvolutionProcs* procs) {
231 } 227 }
232 228
233 void SkBitmapScaler::PlatformConvolutionProcs(SkConvolutionProcs* procs) { 229 void SkBitmapScaler::PlatformConvolutionProcs(SkConvolutionProcs* procs) {
234 SK_ARM_NEON_WRAP(platformConvolutionProcs_arm)(procs); 230 SK_ARM_NEON_WRAP(platformConvolutionProcs_arm)(procs);
235 } 231 }
OLDNEW
« no previous file with comments | « src/images/SkImageEncoder_argb.cpp ('k') | src/opts/SkBitmapProcState_opts_mips_dsp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698