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

Side by Side Diff: skia/sgl/SkBitmapProcState_matrix.h

Issue 20386: Fix the Facebook sidebar.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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 | « skia/sgl/SkBitmapProcState.cpp ('k') | skia/sgl/SkBitmapProcState_matrixProcs.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 #define TRANSLATE_NOFILTER_NAME MAKENAME(_nofilter_translate)
2 #define SCALE_NOFILTER_NAME MAKENAME(_nofilter_scale) 3 #define SCALE_NOFILTER_NAME MAKENAME(_nofilter_scale)
3 #define SCALE_FILTER_NAME MAKENAME(_filter_scale) 4 #define SCALE_FILTER_NAME MAKENAME(_filter_scale)
4 #define AFFINE_NOFILTER_NAME MAKENAME(_nofilter_affine) 5 #define AFFINE_NOFILTER_NAME MAKENAME(_nofilter_affine)
5 #define AFFINE_FILTER_NAME MAKENAME(_filter_affine) 6 #define AFFINE_FILTER_NAME MAKENAME(_filter_affine)
6 #define PERSP_NOFILTER_NAME MAKENAME(_nofilter_persp) 7 #define PERSP_NOFILTER_NAME MAKENAME(_nofilter_persp)
7 #define PERSP_FILTER_NAME MAKENAME(_filter_persp) 8 #define PERSP_FILTER_NAME MAKENAME(_filter_persp)
8 9
9 #define PACK_FILTER_X_NAME MAKENAME(_pack_filter_x) 10 #define PACK_FILTER_X_NAME MAKENAME(_pack_filter_x)
10 #define PACK_FILTER_Y_NAME MAKENAME(_pack_filter_y) 11 #define PACK_FILTER_Y_NAME MAKENAME(_pack_filter_y)
11 12
12 #ifndef PREAMBLE 13 #ifndef PREAMBLE
13 #define PREAMBLE(state) 14 #define PREAMBLE(state)
14 #define PREAMBLE_PARAM_X 15 #define PREAMBLE_PARAM_X
15 #define PREAMBLE_PARAM_Y 16 #define PREAMBLE_PARAM_Y
16 #define PREAMBLE_ARG_X 17 #define PREAMBLE_ARG_X
17 #define PREAMBLE_ARG_Y 18 #define PREAMBLE_ARG_Y
18 #endif 19 #endif
19 20
21 #ifndef PREAMBLE_TRANS
22 #define PREAMBLE_TRANS(state)
23 #endif
24
25 static void TRANSLATE_NOFILTER_NAME(const SkBitmapProcState& s,
26 uint32_t xy[], int count, int x, int y)
27 {
28 SkASSERT((s.fInvType & ~SkMatrix::kTranslate_Mask) == 0);
29
30 PREAMBLE_TRANS(s);
31
32 x += SkScalarFloor(s.fInvMatrix->getTranslateX());
33 y += SkScalarFloor(s.fInvMatrix->getTranslateY());
34
35 *xy++ = (uint32_t)TILEY_TRANS(y, (s.fBitmap->height() - 1));
36
37 unsigned maxX = s.fBitmap->width() - 1;
38 int i;
39 uint16_t* xx = (uint16_t*)xy;
40 for (i = (count >> 2); i > 0; --i)
41 {
42 *xx++ = (uint16_t)TILEX_TRANS(x, maxX); x++;
43 *xx++ = (uint16_t)TILEX_TRANS(x, maxX); x++;
44 *xx++ = (uint16_t)TILEX_TRANS(x, maxX); x++;
45 *xx++ = (uint16_t)TILEX_TRANS(x, maxX); x++;
46 }
47 for (i = (count & 3); i > 0; --i)
48 {
49 *xx++ = (uint16_t)TILEX_TRANS(x, maxX); x++;
50 }
51 }
52
20 static void SCALE_NOFILTER_NAME(const SkBitmapProcState& s, 53 static void SCALE_NOFILTER_NAME(const SkBitmapProcState& s,
21 uint32_t xy[], int count, int x, int y) { 54 uint32_t xy[], int count, int x, int y) {
22 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | 55 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
23 SkMatrix::kScale_Mask)) == 0); 56 SkMatrix::kScale_Mask)) == 0);
24 57
25 PREAMBLE(s); 58 PREAMBLE(s);
26 // we store y, x, x, x, x, x 59 // we store y, x, x, x, x, x
27 60
28 // invert x+half, y+half and convert to fixed 61 // invert x+half, y+half and convert to fixed
29 SkFixed fx = s.fInvSy * y + s.fInvTyPlusHalf; 62 SkFixed fx = s.fInvSy * y + s.fInvTyPlusHalf;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 *xy++ = PACK_FILTER_Y_NAME(srcXY[1] - (oneY >> 1), maxY, 267 *xy++ = PACK_FILTER_Y_NAME(srcXY[1] - (oneY >> 1), maxY,
235 oneY PREAMBLE_ARG_Y); 268 oneY PREAMBLE_ARG_Y);
236 *xy++ = PACK_FILTER_X_NAME(srcXY[0] - (oneX >> 1), maxX, 269 *xy++ = PACK_FILTER_X_NAME(srcXY[0] - (oneX >> 1), maxX,
237 oneX PREAMBLE_ARG_X); 270 oneX PREAMBLE_ARG_X);
238 srcXY += 2; 271 srcXY += 2;
239 } while (--count != 0); 272 } while (--count != 0);
240 } 273 }
241 } 274 }
242 275
243 static SkBitmapProcState::MatrixProc MAKENAME(_Procs)[] = { 276 static SkBitmapProcState::MatrixProc MAKENAME(_Procs)[] = {
277 TRANSLATE_NOFILTER_NAME,
278 TRANSLATE_NOFILTER_NAME, // No need to do filtering if the matrix is no
279 // more complex than identity/translate.
244 SCALE_NOFILTER_NAME, 280 SCALE_NOFILTER_NAME,
245 SCALE_FILTER_NAME, 281 SCALE_FILTER_NAME,
246 AFFINE_NOFILTER_NAME, 282 AFFINE_NOFILTER_NAME,
247 AFFINE_FILTER_NAME, 283 AFFINE_FILTER_NAME,
248 PERSP_NOFILTER_NAME, 284 PERSP_NOFILTER_NAME,
249 PERSP_FILTER_NAME 285 PERSP_FILTER_NAME
250 }; 286 };
251 287
252 #undef MAKENAME 288 #undef MAKENAME
253 #undef TILEX_PROCF 289 #undef TILEX_PROCF
254 #undef TILEY_PROCF 290 #undef TILEY_PROCF
255 #ifdef CHECK_FOR_DECAL 291 #ifdef CHECK_FOR_DECAL
256 #undef CHECK_FOR_DECAL 292 #undef CHECK_FOR_DECAL
257 #endif 293 #endif
258 294
295 #undef TILEX_TRANS
296 #undef TILEY_TRANS
297
298 #undef TRANSLATE_NOFILTER_NAME
259 #undef SCALE_NOFILTER_NAME 299 #undef SCALE_NOFILTER_NAME
260 #undef SCALE_FILTER_NAME 300 #undef SCALE_FILTER_NAME
261 #undef AFFINE_NOFILTER_NAME 301 #undef AFFINE_NOFILTER_NAME
262 #undef AFFINE_FILTER_NAME 302 #undef AFFINE_FILTER_NAME
263 #undef PERSP_NOFILTER_NAME 303 #undef PERSP_NOFILTER_NAME
264 #undef PERSP_FILTER_NAME 304 #undef PERSP_FILTER_NAME
265 305
266 #undef PREAMBLE 306 #undef PREAMBLE
267 #undef PREAMBLE_PARAM_X 307 #undef PREAMBLE_PARAM_X
268 #undef PREAMBLE_PARAM_Y 308 #undef PREAMBLE_PARAM_Y
269 #undef PREAMBLE_ARG_X 309 #undef PREAMBLE_ARG_X
270 #undef PREAMBLE_ARG_Y 310 #undef PREAMBLE_ARG_Y
271 311
312 #undef PREAMBLE_TRANS
313
272 #undef TILEX_LOW_BITS 314 #undef TILEX_LOW_BITS
273 #undef TILEY_LOW_BITS 315 #undef TILEY_LOW_BITS
OLDNEW
« no previous file with comments | « skia/sgl/SkBitmapProcState.cpp ('k') | skia/sgl/SkBitmapProcState_matrixProcs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698