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

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

Issue 1158273007: switch bitmapshader internals over to pixmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix neon/mips to use pixmpas Created 5 years, 6 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
« 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(kNone_SkFilterQuality == s.fFilterLevel); 20 SkASSERT(kNone_SkFilterQuality == s.fFilterLevel);
21 const uint16_t* SK_RESTRICT table = s.fBitmap->getColorTable()->read16BitCac he(); 21 const uint16_t* SK_RESTRICT table = s.fPixmap.ctable()->read16BitCache();
22 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels(); 22 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fPixmap.addr();
23 SkASSERT((unsigned)xy[0] < (unsigned)s.fBitmap->height()); 23 SkASSERT((unsigned)xy[0] < (unsigned)s.fPixmap.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.fPixmap.rowBytes ());
25 uint8_t src; 25 uint8_t src;
26 26
27 if (1 == s.fBitmap->width()) { 27 if (1 == s.fPixmap.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 {
32 int count8; 32 int count8;
33 const uint16_t* SK_RESTRICT xx = (const uint16_t*)(xy + 1); 33 const uint16_t* SK_RESTRICT xx = (const uint16_t*)(xy + 1);
34 34
35 __asm__ volatile ( 35 __asm__ volatile (
36 ".set push \n\t" 36 ".set push \n\t"
37 ".set noreorder \n\t" 37 ".set noreorder \n\t"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 143 }
144 } 144 }
145 } 145 }
146 146
147 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,
148 const uint32_t* SK_RESTRICT xy, 148 const uint32_t* SK_RESTRICT xy,
149 int count, SkPMColor* SK_RESTRIC T colors) { 149 int count, SkPMColor* SK_RESTRIC T colors) {
150 SkASSERT(count > 0 && colors != NULL); 150 SkASSERT(count > 0 && colors != NULL);
151 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); 151 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
152 SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); 152 SkASSERT(kNone_SkFilterQuality == s.fFilterLevel);
153 const SkPMColor* SK_RESTRICT table = s.fBitmap->getColorTable()->readColors( ); 153 const SkPMColor* SK_RESTRICT table = s.fPixmap.ctable()->readColors();
154 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels(); 154 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fPixmap.addr();
155 srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fBitmap->rowByte s()); 155 srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fPixmap.rowBytes ());
156 156
157 if (1 == s.fBitmap->width()) { 157 if (1 == s.fPixmap.width()) {
158 uint8_t src = srcAddr[0]; 158 uint8_t src = srcAddr[0];
159 SkPMColor dstValue = table[src]; 159 SkPMColor dstValue = table[src];
160 sk_memset32(colors, dstValue, count); 160 sk_memset32(colors, dstValue, count);
161 } else { 161 } else {
162 const uint16_t* xx = (const uint16_t*)(xy + 1); 162 const uint16_t* xx = (const uint16_t*)(xy + 1);
163 int s0, s1, s2, s3, s4, s5, s6, s7; 163 int s0, s1, s2, s3, s4, s5, s6, s7;
164 __asm__ volatile ( 164 __asm__ volatile (
165 ".set push \n\t" 165 ".set push \n\t"
166 ".set noreorder \n\t" 166 ".set noreorder \n\t"
167 ".set noat \n\t" 167 ".set noat \n\t"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 */ 369 */
370 370
371 void SkBitmapProcState::platformProcs() { 371 void SkBitmapProcState::platformProcs() {
372 bool isOpaque = 256 == fAlphaScale; 372 bool isOpaque = 256 == fAlphaScale;
373 bool justDx = false; 373 bool justDx = false;
374 374
375 if (fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)) { 375 if (fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)) {
376 justDx = true; 376 justDx = true;
377 } 377 }
378 378
379 switch (fBitmap->colorType()) { 379 switch (fPixmap.colorType()) {
380 case kIndex_8_SkColorType: 380 case kIndex_8_SkColorType:
381 if (justDx && kNone_SkFilterQuality == fFilterLevel) { 381 if (justDx && kNone_SkFilterQuality == fFilterLevel) {
382 fSampleProc16 = SI8_D16_nofilter_DX_mips_dsp; 382 fSampleProc16 = SI8_D16_nofilter_DX_mips_dsp;
383 fShaderProc16 = NULL; 383 fShaderProc16 = NULL;
384 if (isOpaque) { 384 if (isOpaque) {
385 fSampleProc32 = SI8_opaque_D32_nofilter_DX_mips_dsp; 385 fSampleProc32 = SI8_opaque_D32_nofilter_DX_mips_dsp;
386 fShaderProc32 = NULL; 386 fShaderProc32 = NULL;
387 } 387 }
388 } 388 }
389 break; 389 break;
390 default: 390 default:
391 break; 391 break;
392 } 392 }
393 } 393 }
394 394
395 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