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

Side by Side Diff: src/core/SkBitmapProcState_matrixProcs.cpp

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/core/SkBitmapProcState_matrix.h ('k') | src/core/SkBitmapProcState_sample.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 #include "SkBitmapProcState.h" 7 #include "SkBitmapProcState.h"
8 #include "SkPerspIter.h" 8 #include "SkPerspIter.h"
9 #include "SkShader.h" 9 #include "SkShader.h"
10 #include "SkUtils.h" 10 #include "SkUtils.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 #else 304 #else
305 for (int i = 0; i < count; i++) { 305 for (int i = 0; i < count; i++) {
306 *xptr++ = start++; 306 *xptr++ = start++;
307 } 307 }
308 #endif 308 #endif
309 } 309 }
310 310
311 static int nofilter_trans_preamble(const SkBitmapProcState& s, uint32_t** xy, 311 static int nofilter_trans_preamble(const SkBitmapProcState& s, uint32_t** xy,
312 int x, int y) { 312 int x, int y) {
313 SkPoint pt; 313 SkPoint pt;
314 s.fInvProc(*s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, 314 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf,
315 SkIntToScalar(y) + SK_ScalarHalf, &pt); 315 SkIntToScalar(y) + SK_ScalarHalf, &pt);
316 **xy = s.fIntTileProcY(SkScalarToFixed(pt.fY) >> 16, 316 **xy = s.fIntTileProcY(SkScalarToFixed(pt.fY) >> 16,
317 s.fBitmap->height()); 317 s.fBitmap->height());
318 *xy += 1; // bump the ptr 318 *xy += 1; // bump the ptr
319 // return our starting X position 319 // return our starting X position
320 return SkScalarToFixed(pt.fX) >> 16; 320 return SkScalarToFixed(pt.fX) >> 16;
321 } 321 }
322 322
323 static void clampx_nofilter_trans(const SkBitmapProcState& s, 323 static void clampx_nofilter_trans(const SkBitmapProcState& s,
324 uint32_t xy[], int count, int x, int y) { 324 uint32_t xy[], int count, int x, int y) {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 } 465 }
466 } 466 }
467 467
468 /////////////////////////////////////////////////////////////////////////////// 468 ///////////////////////////////////////////////////////////////////////////////
469 469
470 SkBitmapProcState::MatrixProc 470 SkBitmapProcState::MatrixProc
471 SkBitmapProcState::chooseMatrixProc(bool trivial_matrix) { 471 SkBitmapProcState::chooseMatrixProc(bool trivial_matrix) {
472 // test_int_tileprocs(); 472 // test_int_tileprocs();
473 // check for our special case when there is no scale/affine/perspective 473 // check for our special case when there is no scale/affine/perspective
474 if (trivial_matrix) { 474 if (trivial_matrix) {
475 SkASSERT(!fDoFilter); 475 SkASSERT(kNone_BitmapFilter == fFilterQuality);
476 fIntTileProcY = choose_int_tile_proc(fTileModeY); 476 fIntTileProcY = choose_int_tile_proc(fTileModeY);
477 switch (fTileModeX) { 477 switch (fTileModeX) {
478 case SkShader::kClamp_TileMode: 478 case SkShader::kClamp_TileMode:
479 return clampx_nofilter_trans; 479 return clampx_nofilter_trans;
480 case SkShader::kRepeat_TileMode: 480 case SkShader::kRepeat_TileMode:
481 return repeatx_nofilter_trans; 481 return repeatx_nofilter_trans;
482 case SkShader::kMirror_TileMode: 482 case SkShader::kMirror_TileMode:
483 return mirrorx_nofilter_trans; 483 return mirrorx_nofilter_trans;
484 } 484 }
485 } 485 }
486 486
487 int index = 0; 487 int index = 0;
488 if (fDoFilter) { 488 if (fFilterQuality != kNone_BitmapFilter) {
489 index = 1; 489 index = 1;
490 } 490 }
491 if (fInvType & SkMatrix::kPerspective_Mask) { 491 if (fInvType & SkMatrix::kPerspective_Mask) {
492 index += 4; 492 index += 4;
493 } else if (fInvType & SkMatrix::kAffine_Mask) { 493 } else if (fInvType & SkMatrix::kAffine_Mask) {
494 index += 2; 494 index += 2;
495 } 495 }
496 496
497 if (SkShader::kClamp_TileMode == fTileModeX && 497 if (SkShader::kClamp_TileMode == fTileModeX &&
498 SkShader::kClamp_TileMode == fTileModeY) 498 SkShader::kClamp_TileMode == fTileModeY)
(...skipping 13 matching lines...) Expand all
512 { 512 {
513 return SK_ARM_NEON_WRAP(RepeatX_RepeatY_Procs)[index]; 513 return SK_ARM_NEON_WRAP(RepeatX_RepeatY_Procs)[index];
514 } 514 }
515 515
516 fTileProcX = choose_tile_proc(fTileModeX); 516 fTileProcX = choose_tile_proc(fTileModeX);
517 fTileProcY = choose_tile_proc(fTileModeY); 517 fTileProcY = choose_tile_proc(fTileModeY);
518 fTileLowBitsProcX = choose_tile_lowbits_proc(fTileModeX); 518 fTileLowBitsProcX = choose_tile_lowbits_proc(fTileModeX);
519 fTileLowBitsProcY = choose_tile_lowbits_proc(fTileModeY); 519 fTileLowBitsProcY = choose_tile_lowbits_proc(fTileModeY);
520 return GeneralXY_Procs[index]; 520 return GeneralXY_Procs[index];
521 } 521 }
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcState_matrix.h ('k') | src/core/SkBitmapProcState_sample.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698