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

Side by Side Diff: src/core/SkBitmapProcState_matrix_template.h

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/core/SkBitmapProcState_matrixProcs.cpp ('k') | src/core/SkBitmapProcState_procs.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 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
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 #ifndef SkBitmapProcState_MatrixTemplates_DEFINED 8 #ifndef SkBitmapProcState_MatrixTemplates_DEFINED
9 #define SkBitmapProcState_MatrixTemplates_DEFINED 9 #define SkBitmapProcState_MatrixTemplates_DEFINED
10 10
11 #include "SkMath.h" 11 #include "SkMath.h"
12 #include "SkMathPriv.h" 12 #include "SkMathPriv.h"
13 13
14 template <typename TileProc, bool tryDecal> 14 template <typename TileProc, bool tryDecal>
15 void NoFilterProc_Scale(const SkBitmapProcState& s, uint32_t xy[], 15 void NoFilterProc_Scale(const SkBitmapProcState& s, uint32_t xy[],
16 int count, int x, int y) { 16 int count, int x, int y) {
17 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | 17 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
18 SkMatrix::kScale_Mask)) == 0); 18 SkMatrix::kScale_Mask)) == 0);
19 19
20 // we store y, x, x, x, x, x 20 // we store y, x, x, x, x, x
21 21
22 const unsigned maxX = s.fBitmap->width() - 1; 22 const unsigned maxX = s.fPixmap.width() - 1;
23 SkFractionalInt fx; 23 SkFractionalInt fx;
24 { 24 {
25 SkPoint pt; 25 SkPoint pt;
26 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, 26 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf,
27 SkIntToScalar(y) + SK_ScalarHalf, &pt); 27 SkIntToScalar(y) + SK_ScalarHalf, &pt);
28 fx = SkScalarToFractionalInt(pt.fY); 28 fx = SkScalarToFractionalInt(pt.fY);
29 const unsigned maxY = s.fBitmap->height() - 1; 29 const unsigned maxY = s.fPixmap.height() - 1;
30 *xy++ = TileProc::Y(s, SkFractionalIntToFixed(fx), maxY); 30 *xy++ = TileProc::Y(s, SkFractionalIntToFixed(fx), maxY);
31 fx = SkScalarToFractionalInt(pt.fX); 31 fx = SkScalarToFractionalInt(pt.fX);
32 } 32 }
33 33
34 if (0 == maxX) { 34 if (0 == maxX) {
35 // all of the following X values must be 0 35 // all of the following X values must be 0
36 memset(xy, 0, count * sizeof(uint16_t)); 36 memset(xy, 0, count * sizeof(uint16_t));
37 return; 37 return;
38 } 38 }
39 39
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 SkPoint srcPt; 83 SkPoint srcPt;
84 s.fInvProc(s.fInvMatrix, 84 s.fInvProc(s.fInvMatrix,
85 SkIntToScalar(x) + SK_ScalarHalf, 85 SkIntToScalar(x) + SK_ScalarHalf,
86 SkIntToScalar(y) + SK_ScalarHalf, &srcPt); 86 SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
87 87
88 SkFractionalInt fx = SkScalarToFractionalInt(srcPt.fX); 88 SkFractionalInt fx = SkScalarToFractionalInt(srcPt.fX);
89 SkFractionalInt fy = SkScalarToFractionalInt(srcPt.fY); 89 SkFractionalInt fy = SkScalarToFractionalInt(srcPt.fY);
90 SkFractionalInt dx = s.fInvSxFractionalInt; 90 SkFractionalInt dx = s.fInvSxFractionalInt;
91 SkFractionalInt dy = s.fInvKyFractionalInt; 91 SkFractionalInt dy = s.fInvKyFractionalInt;
92 int maxX = s.fBitmap->width() - 1; 92 int maxX = s.fPixmap.width() - 1;
93 int maxY = s.fBitmap->height() - 1; 93 int maxY = s.fPixmap.height() - 1;
94 94
95 for (int i = count; i > 0; --i) { 95 for (int i = count; i > 0; --i) {
96 *xy++ = (TileProc::Y(s, SkFractionalIntToFixed(fy), maxY) << 16) | 96 *xy++ = (TileProc::Y(s, SkFractionalIntToFixed(fy), maxY) << 16) |
97 TileProc::X(s, SkFractionalIntToFixed(fx), maxX); 97 TileProc::X(s, SkFractionalIntToFixed(fx), maxX);
98 fx += dx; fy += dy; 98 fx += dx; fy += dy;
99 } 99 }
100 } 100 }
101 101
102 template <typename TileProc> 102 template <typename TileProc>
103 void NoFilterProc_Persp(const SkBitmapProcState& s, uint32_t* SK_RESTRICT xy, 103 void NoFilterProc_Persp(const SkBitmapProcState& s, uint32_t* SK_RESTRICT xy,
104 int count, int x, int y) { 104 int count, int x, int y) {
105 SkASSERT(s.fInvType & SkMatrix::kPerspective_Mask); 105 SkASSERT(s.fInvType & SkMatrix::kPerspective_Mask);
106 106
107 int maxX = s.fBitmap->width() - 1; 107 int maxX = s.fPixmap.width() - 1;
108 int maxY = s.fBitmap->height() - 1; 108 int maxY = s.fPixmap.height() - 1;
109 109
110 SkPerspIter iter(s.fInvMatrix, 110 SkPerspIter iter(s.fInvMatrix,
111 SkIntToScalar(x) + SK_ScalarHalf, 111 SkIntToScalar(x) + SK_ScalarHalf,
112 SkIntToScalar(y) + SK_ScalarHalf, count); 112 SkIntToScalar(y) + SK_ScalarHalf, count);
113 113
114 while ((count = iter.next()) != 0) { 114 while ((count = iter.next()) != 0) {
115 const SkFixed* SK_RESTRICT srcXY = iter.getXY(); 115 const SkFixed* SK_RESTRICT srcXY = iter.getXY();
116 while (--count >= 0) { 116 while (--count >= 0) {
117 *xy++ = (TileProc::Y(s, srcXY[1], maxY) << 16) | 117 *xy++ = (TileProc::Y(s, srcXY[1], maxY) << 16) |
118 TileProc::X(s, srcXY[0], maxX); 118 TileProc::X(s, srcXY[0], maxX);
119 srcXY += 2; 119 srcXY += 2;
120 } 120 }
121 } 121 }
122 } 122 }
123 123
124 #endif 124 #endif
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcState_matrixProcs.cpp ('k') | src/core/SkBitmapProcState_procs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698