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

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

Issue 18721006: fix trivial matrix computation (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/opts/SkBitmapProcState_opts_SSSE3.cpp ('k') | tests/FitsInTest.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 "SkBitmapProcState.h" 9 #include "SkBitmapProcState.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
11 #include "SkTypes.h" 11 #include "SkTypes.h"
12 #include "SkUtils.h" 12 #include "SkUtils.h"
13 13
14 #if SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN) 14 #if SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN)
15 void SI8_D16_nofilter_DX_arm( 15 void SI8_D16_nofilter_DX_arm(
16 const SkBitmapProcState& s, 16 const SkBitmapProcState& s,
17 const uint32_t* SK_RESTRICT xy, 17 const uint32_t* SK_RESTRICT xy,
18 int count, 18 int count,
19 uint16_t* SK_RESTRICT colors) SK_ATTRIBUTE_OPTIMIZE_O1; 19 uint16_t* SK_RESTRICT colors) SK_ATTRIBUTE_OPTIMIZE_O1;
20 20
21 void SI8_D16_nofilter_DX_arm(const SkBitmapProcState& s, 21 void SI8_D16_nofilter_DX_arm(const SkBitmapProcState& s,
22 const uint32_t* SK_RESTRICT xy, 22 const uint32_t* SK_RESTRICT xy,
23 int count, uint16_t* SK_RESTRICT colors) { 23 int count, uint16_t* SK_RESTRICT colors) {
24 SkASSERT(count > 0 && colors != NULL); 24 SkASSERT(count > 0 && colors != NULL);
25 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); 25 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
26 SkASSERT(s.fDoFilter == false); 26 SkASSERT(SkBitmapProcState::kNone_BitmapFilter == s.fFilterQuality);
27 27
28 const uint16_t* SK_RESTRICT table = s.fBitmap->getColorTable()->lock16BitCac he(); 28 const uint16_t* SK_RESTRICT table = s.fBitmap->getColorTable()->lock16BitCac he();
29 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels(); 29 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels();
30 30
31 // buffer is y32, x16, x16, x16, x16, x16 31 // buffer is y32, x16, x16, x16, x16, x16
32 // bump srcAddr to the proper row, since we're told Y never changes 32 // bump srcAddr to the proper row, since we're told Y never changes
33 SkASSERT((unsigned)xy[0] < (unsigned)s.fBitmap->height()); 33 SkASSERT((unsigned)xy[0] < (unsigned)s.fBitmap->height());
34 srcAddr = (const uint8_t*)((const char*)srcAddr + 34 srcAddr = (const uint8_t*)((const char*)srcAddr +
35 xy[0] * s.fBitmap->rowBytes()); 35 xy[0] * s.fBitmap->rowBytes());
36 36
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 const SkBitmapProcState& s, 107 const SkBitmapProcState& s,
108 const uint32_t* SK_RESTRICT xy, 108 const uint32_t* SK_RESTRICT xy,
109 int count, 109 int count,
110 SkPMColor* SK_RESTRICT colors) SK_ATTRIBUTE_OPTIMIZE_O1; 110 SkPMColor* SK_RESTRICT colors) SK_ATTRIBUTE_OPTIMIZE_O1;
111 111
112 void SI8_opaque_D32_nofilter_DX_arm(const SkBitmapProcState& s, 112 void SI8_opaque_D32_nofilter_DX_arm(const SkBitmapProcState& s,
113 const uint32_t* SK_RESTRICT xy, 113 const uint32_t* SK_RESTRICT xy,
114 int count, SkPMColor* SK_RESTRICT colors) { 114 int count, SkPMColor* SK_RESTRICT colors) {
115 SkASSERT(count > 0 && colors != NULL); 115 SkASSERT(count > 0 && colors != NULL);
116 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); 116 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
117 SkASSERT(s.fDoFilter == false); 117 SkASSERT(SkBitmapProcState::kNone_BitmapFilter == s.fFilterQuality);
118 118
119 const SkPMColor* SK_RESTRICT table = s.fBitmap->getColorTable()->lockColors( ); 119 const SkPMColor* SK_RESTRICT table = s.fBitmap->getColorTable()->lockColors( );
120 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels(); 120 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels();
121 121
122 // buffer is y32, x16, x16, x16, x16, x16 122 // buffer is y32, x16, x16, x16, x16, x16
123 // bump srcAddr to the proper row, since we're told Y never changes 123 // bump srcAddr to the proper row, since we're told Y never changes
124 SkASSERT((unsigned)xy[0] < (unsigned)s.fBitmap->height()); 124 SkASSERT((unsigned)xy[0] < (unsigned)s.fBitmap->height());
125 srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fBitmap->rowByte s()); 125 srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fBitmap->rowByte s());
126 126
127 if (1 == s.fBitmap->width()) { 127 if (1 == s.fBitmap->width()) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 s.fBitmap->getColorTable()->unlockColors(false); 183 s.fBitmap->getColorTable()->unlockColors(false);
184 } 184 }
185 #endif // SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN) 185 #endif // SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN)
186 186
187 /////////////////////////////////////////////////////////////////////////////// 187 ///////////////////////////////////////////////////////////////////////////////
188 188
189 /* If we replace a sampleproc, then we null-out the associated shaderproc, 189 /* If we replace a sampleproc, then we null-out the associated shaderproc,
190 otherwise the shader won't even look at the matrix/sampler 190 otherwise the shader won't even look at the matrix/sampler
191 */ 191 */
192 void SkBitmapProcState::platformProcs() { 192 void SkBitmapProcState::platformProcs() {
193 bool doFilter = fDoFilter;
194 bool isOpaque = 256 == fAlphaScale; 193 bool isOpaque = 256 == fAlphaScale;
195 bool justDx = false; 194 bool justDx = false;
196 195
197 if (fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)) { 196 if (fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)) {
198 justDx = true; 197 justDx = true;
199 } 198 }
200 199
201 switch (fBitmap->config()) { 200 switch (fBitmap->config()) {
202 case SkBitmap::kIndex8_Config: 201 case SkBitmap::kIndex8_Config:
203 #if SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN) 202 #if SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN)
204 if (justDx && !doFilter) { 203 if (justDx && kNone_BitmapFilter == fFilterQuality) {
205 #if 0 /* crashing on android device */ 204 #if 0 /* crashing on android device */
206 fSampleProc16 = SI8_D16_nofilter_DX_arm; 205 fSampleProc16 = SI8_D16_nofilter_DX_arm;
207 fShaderProc16 = NULL; 206 fShaderProc16 = NULL;
208 #endif 207 #endif
209 if (isOpaque) { 208 if (isOpaque) {
210 // this one is only very slighty faster than the C version 209 // this one is only very slighty faster than the C version
211 fSampleProc32 = SI8_opaque_D32_nofilter_DX_arm; 210 fSampleProc32 = SI8_opaque_D32_nofilter_DX_arm;
212 fShaderProc32 = NULL; 211 fShaderProc32 = NULL;
213 } 212 }
214 } 213 }
215 #endif 214 #endif
216 break; 215 break;
217 default: 216 default:
218 break; 217 break;
219 } 218 }
220 } 219 }
OLDNEW
« no previous file with comments | « src/opts/SkBitmapProcState_opts_SSSE3.cpp ('k') | tests/FitsInTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698