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

Side by Side Diff: src/opts/SkBitmapProcState_matrix_clamp_neon.h

Issue 18978014: Working plumb of image scaling: (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: nits from robert 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/SkBitmapFilter_opts_SSE2.cpp ('k') | src/opts/SkBitmapProcState_matrix_repeat_neon.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* NEON optimized code (C) COPYRIGHT 2009 Motorola 1 /* NEON optimized code (C) COPYRIGHT 2009 Motorola
2 * 2 *
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /* 7 /*
8 * Modifications done in-house at Motorola 8 * Modifications done in-house at Motorola
9 * 9 *
10 * this is a clone of SkBitmapProcState_matrix.h 10 * this is a clone of SkBitmapProcState_matrix.h
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | 60 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
61 SkMatrix::kScale_Mask)) == 0); 61 SkMatrix::kScale_Mask)) == 0);
62 62
63 PREAMBLE(s); 63 PREAMBLE(s);
64 // we store y, x, x, x, x, x 64 // we store y, x, x, x, x, x
65 65
66 const unsigned maxX = s.fBitmap->width() - 1; 66 const unsigned maxX = s.fBitmap->width() - 1;
67 SkFixed fx; 67 SkFixed fx;
68 { 68 {
69 SkPoint pt; 69 SkPoint pt;
70 s.fInvProc(*s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, 70 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf,
71 SkIntToScalar(y) + SK_ScalarHalf, &pt); 71 SkIntToScalar(y) + SK_ScalarHalf, &pt);
72 fx = SkScalarToFixed(pt.fY); 72 fx = SkScalarToFixed(pt.fY);
73 const unsigned maxY = s.fBitmap->height() - 1; 73 const unsigned maxY = s.fBitmap->height() - 1;
74 *xy++ = TILEY_PROCF(fx, maxY); 74 *xy++ = TILEY_PROCF(fx, maxY);
75 fx = SkScalarToFixed(pt.fX); 75 fx = SkScalarToFixed(pt.fX);
76 } 76 }
77 77
78 if (0 == maxX) { 78 if (0 == maxX) {
79 // all of the following X values must be 0 79 // all of the following X values must be 0
80 memset(xy, 0, count * sizeof(uint16_t)); 80 memset(xy, 0, count * sizeof(uint16_t));
81 return; 81 return;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 static void AFFINE_NOFILTER_NAME(const SkBitmapProcState& s, 163 static void AFFINE_NOFILTER_NAME(const SkBitmapProcState& s,
164 uint32_t xy[], int count, int x, int y) { 164 uint32_t xy[], int count, int x, int y) {
165 SkASSERT(s.fInvType & SkMatrix::kAffine_Mask); 165 SkASSERT(s.fInvType & SkMatrix::kAffine_Mask);
166 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | 166 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
167 SkMatrix::kScale_Mask | 167 SkMatrix::kScale_Mask |
168 SkMatrix::kAffine_Mask)) == 0); 168 SkMatrix::kAffine_Mask)) == 0);
169 169
170 PREAMBLE(s); 170 PREAMBLE(s);
171 SkPoint srcPt; 171 SkPoint srcPt;
172 s.fInvProc(*s.fInvMatrix, 172 s.fInvProc(s.fInvMatrix,
173 SkIntToScalar(x) + SK_ScalarHalf, 173 SkIntToScalar(x) + SK_ScalarHalf,
174 SkIntToScalar(y) + SK_ScalarHalf, &srcPt); 174 SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
175 175
176 SkFixed fx = SkScalarToFixed(srcPt.fX); 176 SkFixed fx = SkScalarToFixed(srcPt.fX);
177 SkFixed fy = SkScalarToFixed(srcPt.fY); 177 SkFixed fy = SkScalarToFixed(srcPt.fY);
178 SkFixed dx = s.fInvSx; 178 SkFixed dx = s.fInvSx;
179 SkFixed dy = s.fInvKy; 179 SkFixed dy = s.fInvKy;
180 int maxX = s.fBitmap->width() - 1; 180 int maxX = s.fBitmap->width() - 1;
181 int maxY = s.fBitmap->height() - 1; 181 int maxY = s.fBitmap->height() - 1;
182 182
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 static void PERSP_NOFILTER_NAME(const SkBitmapProcState& s, 275 static void PERSP_NOFILTER_NAME(const SkBitmapProcState& s,
276 uint32_t* SK_RESTRICT xy, 276 uint32_t* SK_RESTRICT xy,
277 int count, int x, int y) { 277 int count, int x, int y) {
278 SkASSERT(s.fInvType & SkMatrix::kPerspective_Mask); 278 SkASSERT(s.fInvType & SkMatrix::kPerspective_Mask);
279 279
280 PREAMBLE(s); 280 PREAMBLE(s);
281 /* max{X,Y} are int here, but later shown/assumed to fit in 16 bits */ 281 /* max{X,Y} are int here, but later shown/assumed to fit in 16 bits */
282 int maxX = s.fBitmap->width() - 1; 282 int maxX = s.fBitmap->width() - 1;
283 int maxY = s.fBitmap->height() - 1; 283 int maxY = s.fBitmap->height() - 1;
284 284
285 SkPerspIter iter(*s.fInvMatrix, 285 SkPerspIter iter(s.fInvMatrix,
286 SkIntToScalar(x) + SK_ScalarHalf, 286 SkIntToScalar(x) + SK_ScalarHalf,
287 SkIntToScalar(y) + SK_ScalarHalf, count); 287 SkIntToScalar(y) + SK_ScalarHalf, count);
288 288
289 while ((count = iter.next()) != 0) { 289 while ((count = iter.next()) != 0) {
290 const SkFixed* SK_RESTRICT srcXY = iter.getXY(); 290 const SkFixed* SK_RESTRICT srcXY = iter.getXY();
291 291
292 #if defined(DEBUG_PERSP_NOFILTER) 292 #if defined(DEBUG_PERSP_NOFILTER)
293 /* debugging stuff */ 293 /* debugging stuff */
294 const SkFixed *end_srcXY = srcXY + (count*2); 294 const SkFixed *end_srcXY = srcXY + (count*2);
295 uint32_t *end_xy = xy + (count); 295 uint32_t *end_xy = xy + (count);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 485
486 PREAMBLE(s); 486 PREAMBLE(s);
487 487
488 const unsigned maxX = s.fBitmap->width() - 1; 488 const unsigned maxX = s.fBitmap->width() - 1;
489 const SkFixed one = s.fFilterOneX; 489 const SkFixed one = s.fFilterOneX;
490 const SkFixed dx = s.fInvSx; 490 const SkFixed dx = s.fInvSx;
491 SkFixed fx; 491 SkFixed fx;
492 492
493 { 493 {
494 SkPoint pt; 494 SkPoint pt;
495 s.fInvProc(*s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, 495 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf,
496 SkIntToScalar(y) + SK_ScalarHalf, &pt); 496 SkIntToScalar(y) + SK_ScalarHalf, &pt);
497 const SkFixed fy = SkScalarToFixed(pt.fY) - (s.fFilterOneY >> 1); 497 const SkFixed fy = SkScalarToFixed(pt.fY) - (s.fFilterOneY >> 1);
498 const unsigned maxY = s.fBitmap->height() - 1; 498 const unsigned maxY = s.fBitmap->height() - 1;
499 // compute our two Y values up front 499 // compute our two Y values up front
500 *xy++ = PACK_FILTER_Y_NAME(fy, maxY, s.fFilterOneY PREAMBLE_ARG_Y); 500 *xy++ = PACK_FILTER_Y_NAME(fy, maxY, s.fFilterOneY PREAMBLE_ARG_Y);
501 // now initialize fx 501 // now initialize fx
502 fx = SkScalarToFixed(pt.fX) - (one >> 1); 502 fx = SkScalarToFixed(pt.fX) - (one >> 1);
503 } 503 }
504 504
505 #ifdef CHECK_FOR_DECAL 505 #ifdef CHECK_FOR_DECAL
506 // test if we don't need to apply the tile proc 506 // test if we don't need to apply the tile proc
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 589
590 static void AFFINE_FILTER_NAME(const SkBitmapProcState& s, 590 static void AFFINE_FILTER_NAME(const SkBitmapProcState& s,
591 uint32_t xy[], int count, int x, int y) { 591 uint32_t xy[], int count, int x, int y) {
592 SkASSERT(s.fInvType & SkMatrix::kAffine_Mask); 592 SkASSERT(s.fInvType & SkMatrix::kAffine_Mask);
593 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | 593 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
594 SkMatrix::kScale_Mask | 594 SkMatrix::kScale_Mask |
595 SkMatrix::kAffine_Mask)) == 0); 595 SkMatrix::kAffine_Mask)) == 0);
596 596
597 PREAMBLE(s); 597 PREAMBLE(s);
598 SkPoint srcPt; 598 SkPoint srcPt;
599 s.fInvProc(*s.fInvMatrix, 599 s.fInvProc(s.fInvMatrix,
600 SkIntToScalar(x) + SK_ScalarHalf, 600 SkIntToScalar(x) + SK_ScalarHalf,
601 SkIntToScalar(y) + SK_ScalarHalf, &srcPt); 601 SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
602 602
603 SkFixed oneX = s.fFilterOneX; 603 SkFixed oneX = s.fFilterOneX;
604 SkFixed oneY = s.fFilterOneY; 604 SkFixed oneY = s.fFilterOneY;
605 SkFixed fx = SkScalarToFixed(srcPt.fX) - (oneX >> 1); 605 SkFixed fx = SkScalarToFixed(srcPt.fX) - (oneX >> 1);
606 SkFixed fy = SkScalarToFixed(srcPt.fY) - (oneY >> 1); 606 SkFixed fy = SkScalarToFixed(srcPt.fY) - (oneY >> 1);
607 SkFixed dx = s.fInvSx; 607 SkFixed dx = s.fInvSx;
608 SkFixed dy = s.fInvKy; 608 SkFixed dy = s.fInvKy;
609 unsigned maxX = s.fBitmap->width() - 1; 609 unsigned maxX = s.fBitmap->width() - 1;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 uint32_t* SK_RESTRICT xy, int count, 750 uint32_t* SK_RESTRICT xy, int count,
751 int x, int y) { 751 int x, int y) {
752 SkASSERT(s.fInvType & SkMatrix::kPerspective_Mask); 752 SkASSERT(s.fInvType & SkMatrix::kPerspective_Mask);
753 753
754 PREAMBLE(s); 754 PREAMBLE(s);
755 unsigned maxX = s.fBitmap->width() - 1; 755 unsigned maxX = s.fBitmap->width() - 1;
756 unsigned maxY = s.fBitmap->height() - 1; 756 unsigned maxY = s.fBitmap->height() - 1;
757 SkFixed oneX = s.fFilterOneX; 757 SkFixed oneX = s.fFilterOneX;
758 SkFixed oneY = s.fFilterOneY; 758 SkFixed oneY = s.fFilterOneY;
759 759
760 SkPerspIter iter(*s.fInvMatrix, 760 SkPerspIter iter(s.fInvMatrix,
761 SkIntToScalar(x) + SK_ScalarHalf, 761 SkIntToScalar(x) + SK_ScalarHalf,
762 SkIntToScalar(y) + SK_ScalarHalf, count); 762 SkIntToScalar(y) + SK_ScalarHalf, count);
763 763
764 while ((count = iter.next()) != 0) { 764 while ((count = iter.next()) != 0) {
765 const SkFixed* SK_RESTRICT srcXY = iter.getXY(); 765 const SkFixed* SK_RESTRICT srcXY = iter.getXY();
766 766
767 if (count >= 4) { 767 if (count >= 4) {
768 int32x4_t wide_i, wide_lo; 768 int32x4_t wide_i, wide_lo;
769 int32x4_t wide_fx1; 769 int32x4_t wide_fx1;
770 int32x4_t wide_fy1; 770 int32x4_t wide_fy1;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 #undef PERSP_FILTER_NAME 902 #undef PERSP_FILTER_NAME
903 903
904 #undef PREAMBLE 904 #undef PREAMBLE
905 #undef PREAMBLE_PARAM_X 905 #undef PREAMBLE_PARAM_X
906 #undef PREAMBLE_PARAM_Y 906 #undef PREAMBLE_PARAM_Y
907 #undef PREAMBLE_ARG_X 907 #undef PREAMBLE_ARG_X
908 #undef PREAMBLE_ARG_Y 908 #undef PREAMBLE_ARG_Y
909 909
910 #undef TILEX_LOW_BITS 910 #undef TILEX_LOW_BITS
911 #undef TILEY_LOW_BITS 911 #undef TILEY_LOW_BITS
OLDNEW
« no previous file with comments | « src/opts/SkBitmapFilter_opts_SSE2.cpp ('k') | src/opts/SkBitmapProcState_matrix_repeat_neon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698