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

Side by Side Diff: src/opts/SkBitmapProcState_opts_mips_dsp.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/opts/SkBitmapProcState_opts_arm.cpp ('k') | no next file » | 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 2014 The Android Open Source Project 2 * Copyright 2014 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 "SkBitmapProcState.h" 9 #include "SkBitmapProcState.h"
10 #include "SkBitmapScaler.h" 10 #include "SkBitmapScaler.h"
11 #include "SkColorPriv.h" 11 #include "SkColorPriv.h"
12 #include "SkPaint.h" 12 #include "SkPaint.h"
13 #include "SkUtils.h" 13 #include "SkUtils.h"
14 14
15 static void SI8_D16_nofilter_DX_mips_dsp(const SkBitmapProcState& s, 15 static void SI8_D16_nofilter_DX_mips_dsp(const SkBitmapProcState& s,
16 const uint32_t* SK_RESTRICT xy, 16 const uint32_t* SK_RESTRICT xy,
17 int count, uint16_t* SK_RESTRICT colors ) { 17 int count, uint16_t* SK_RESTRICT colors ) {
18 SkASSERT(count > 0 && colors != NULL); 18 SkASSERT(count > 0 && colors != NULL);
19 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); 19 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
20 SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel); 20 SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel);
21 const uint16_t* SK_RESTRICT table = s.fBitmap->getColorTable()->lock16BitCac he(); 21 const uint16_t* SK_RESTRICT table = s.fBitmap->getColorTable()->read16BitCac he();
22 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels(); 22 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels();
23 SkASSERT((unsigned)xy[0] < (unsigned)s.fBitmap->height()); 23 SkASSERT((unsigned)xy[0] < (unsigned)s.fBitmap->height());
24 srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fBitmap->rowByte s()); 24 srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fBitmap->rowByte s());
25 uint8_t src; 25 uint8_t src;
26 26
27 if (1 == s.fBitmap->width()) { 27 if (1 == s.fBitmap->width()) {
28 src = srcAddr[0]; 28 src = srcAddr[0];
29 uint16_t dstValue = table[src]; 29 uint16_t dstValue = table[src];
30 sk_memset16(colors, dstValue, count); 30 sk_memset16(colors, dstValue, count);
31 } else { 31 } else {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 ".set pop \n\t" 135 ".set pop \n\t"
136 : [xx]"+r"(xx), [count8]"=&r"(count8), [colors]"+r"(colors) 136 : [xx]"+r"(xx), [count8]"=&r"(count8), [colors]"+r"(colors)
137 : [table]"r"(table), [srcAddr]"r"(srcAddr), [count]"r"(count) 137 : [table]"r"(table), [srcAddr]"r"(srcAddr), [count]"r"(count)
138 : "memory","t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7" 138 : "memory","t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"
139 ); 139 );
140 140
141 for (int i = (count & 7); i > 0; --i) { 141 for (int i = (count & 7); i > 0; --i) {
142 src = srcAddr[*xx++]; *colors++ = table[src]; 142 src = srcAddr[*xx++]; *colors++ = table[src];
143 } 143 }
144 } 144 }
145 s.fBitmap->getColorTable()->unlock16BitCache();
146 } 145 }
147 146
148 static void SI8_opaque_D32_nofilter_DX_mips_dsp(const SkBitmapProcState& s, 147 static void SI8_opaque_D32_nofilter_DX_mips_dsp(const SkBitmapProcState& s,
149 const uint32_t* SK_RESTRICT xy, 148 const uint32_t* SK_RESTRICT xy,
150 int count, SkPMColor* SK_RESTRIC T colors) { 149 int count, SkPMColor* SK_RESTRIC T colors) {
151 SkASSERT(count > 0 && colors != NULL); 150 SkASSERT(count > 0 && colors != NULL);
152 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); 151 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
153 SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel); 152 SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel);
154 const SkPMColor* SK_RESTRICT table = s.fBitmap->getColorTable()->lockColors( ); 153 const SkPMColor* SK_RESTRICT table = s.fBitmap->getColorTable()->readColors( );
155 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels(); 154 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels();
156 srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fBitmap->rowByte s()); 155 srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fBitmap->rowByte s());
157 156
158 if (1 == s.fBitmap->width()) { 157 if (1 == s.fBitmap->width()) {
159 uint8_t src = srcAddr[0]; 158 uint8_t src = srcAddr[0];
160 SkPMColor dstValue = table[src]; 159 SkPMColor dstValue = table[src];
161 sk_memset32(colors, dstValue, count); 160 sk_memset32(colors, dstValue, count);
162 } else { 161 } else {
163 const uint16_t* xx = (const uint16_t*)(xy + 1); 162 const uint16_t* xx = (const uint16_t*)(xy + 1);
164 int s0, s1, s2, s3, s4, s5, s6, s7; 163 int s0, s1, s2, s3, s4, s5, s6, s7;
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 "4: \n\t" 355 "4: \n\t"
357 ".set pop \n\t" 356 ".set pop \n\t"
358 : [xx]"+r"(xx), [count]"+r"(count), [colors]"+r"(colors), 357 : [xx]"+r"(xx), [count]"+r"(count), [colors]"+r"(colors),
359 [s0]"=&r"(s0), [s1]"=&r"(s1), [s2]"=&r"(s2), [s3]"=&r"(s3), 358 [s0]"=&r"(s0), [s1]"=&r"(s1), [s2]"=&r"(s2), [s3]"=&r"(s3),
360 [s4]"=&r"(s4), [s5]"=&r"(s5), [s6]"=&r"(s6), [s7]"=&r"(s7) 359 [s4]"=&r"(s4), [s5]"=&r"(s5), [s6]"=&r"(s6), [s7]"=&r"(s7)
361 : [table]"r"(table), [srcAddr]"r"(srcAddr) 360 : [table]"r"(table), [srcAddr]"r"(srcAddr)
362 : "memory", "t0", "t1", "t2", "t3", 361 : "memory", "t0", "t1", "t2", "t3",
363 "t4", "t5", "t6", "t7", "t8" 362 "t4", "t5", "t6", "t7", "t8"
364 ); 363 );
365 } 364 }
366 s.fBitmap->getColorTable()->unlockColors();
367 } 365 }
368 366
369 /* If we replace a sampleproc, then we null-out the associated shaderproc, 367 /* If we replace a sampleproc, then we null-out the associated shaderproc,
370 otherwise the shader won't even look at the matrix/sampler 368 otherwise the shader won't even look at the matrix/sampler
371 */ 369 */
372 370
373 void SkBitmapProcState::platformProcs() { 371 void SkBitmapProcState::platformProcs() {
374 bool isOpaque = 256 == fAlphaScale; 372 bool isOpaque = 256 == fAlphaScale;
375 bool justDx = false; 373 bool justDx = false;
376 374
(...skipping 11 matching lines...) Expand all
388 fShaderProc32 = NULL; 386 fShaderProc32 = NULL;
389 } 387 }
390 } 388 }
391 break; 389 break;
392 default: 390 default:
393 break; 391 break;
394 } 392 }
395 } 393 }
396 394
397 void SkBitmapScaler::PlatformConvolutionProcs(SkConvolutionProcs*) {} 395 void SkBitmapScaler::PlatformConvolutionProcs(SkConvolutionProcs*) {}
OLDNEW
« no previous file with comments | « src/opts/SkBitmapProcState_opts_arm.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698