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

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

Issue 1656833002: Sampler bias for all nofilter flavors (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 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
« no previous file with comments | « src/opts/SkBitmapProcState_matrix_neon.h ('k') | no next file » | 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 #include <emmintrin.h> 8 #include <emmintrin.h>
9 #include "SkBitmapProcState_opts_SSE2.h" 9 #include "SkBitmapProcState_opts_SSE2.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 /* SSE version of ClampX_ClampY_nofilter_scale() 367 /* SSE version of ClampX_ClampY_nofilter_scale()
368 * portable version is in core/SkBitmapProcState_matrix.h 368 * portable version is in core/SkBitmapProcState_matrix.h
369 */ 369 */
370 void ClampX_ClampY_nofilter_scale_SSE2(const SkBitmapProcState& s, 370 void ClampX_ClampY_nofilter_scale_SSE2(const SkBitmapProcState& s,
371 uint32_t xy[], int count, int x, int y) { 371 uint32_t xy[], int count, int x, int y) {
372 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | 372 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
373 SkMatrix::kScale_Mask)) == 0); 373 SkMatrix::kScale_Mask)) == 0);
374 374
375 // we store y, x, x, x, x, x 375 // we store y, x, x, x, x, x
376 const unsigned maxX = s.fPixmap.width() - 1; 376 const unsigned maxX = s.fPixmap.width() - 1;
377 SkFixed fx; 377 const SkBitmapProcStateAutoMapper mapper(s, x, y);
378 SkPoint pt;
379 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf,
380 SkIntToScalar(y) + SK_ScalarHalf, &pt);
381 fx = SkScalarToFixed(pt.fY);
382 const unsigned maxY = s.fPixmap.height() - 1; 378 const unsigned maxY = s.fPixmap.height() - 1;
383 *xy++ = SkClampMax(fx >> 16, maxY); 379 *xy++ = SkClampMax(SkFractionalIntToInt(mapper.y()), maxY);
384 fx = SkScalarToFixed(pt.fX); 380 SkFixed fx = SkFractionalIntToFixed(mapper.x());
385 381
386 if (0 == maxX) { 382 if (0 == maxX) {
387 // all of the following X values must be 0 383 // all of the following X values must be 0
388 memset(xy, 0, count * sizeof(uint16_t)); 384 memset(xy, 0, count * sizeof(uint16_t));
389 return; 385 return;
390 } 386 }
391 387
392 const SkFixed dx = s.fInvSx; 388 const SkFixed dx = s.fInvSx;
393 389
394 // test if we don't need to apply the tile proc 390 // test if we don't need to apply the tile proc
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 /* SSE version of ClampX_ClampY_nofilter_affine() 554 /* SSE version of ClampX_ClampY_nofilter_affine()
559 * portable version is in core/SkBitmapProcState_matrix.h 555 * portable version is in core/SkBitmapProcState_matrix.h
560 */ 556 */
561 void ClampX_ClampY_nofilter_affine_SSE2(const SkBitmapProcState& s, 557 void ClampX_ClampY_nofilter_affine_SSE2(const SkBitmapProcState& s,
562 uint32_t xy[], int count, int x, int y) { 558 uint32_t xy[], int count, int x, int y) {
563 SkASSERT(s.fInvType & SkMatrix::kAffine_Mask); 559 SkASSERT(s.fInvType & SkMatrix::kAffine_Mask);
564 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | 560 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
565 SkMatrix::kScale_Mask | 561 SkMatrix::kScale_Mask |
566 SkMatrix::kAffine_Mask)) == 0); 562 SkMatrix::kAffine_Mask)) == 0);
567 563
568 SkPoint srcPt; 564 const SkBitmapProcStateAutoMapper mapper(s, x, y);
569 s.fInvProc(s.fInvMatrix,
570 SkIntToScalar(x) + SK_ScalarHalf,
571 SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
572 565
573 SkFixed fx = SkScalarToFixed(srcPt.fX); 566 SkFixed fx = SkFractionalIntToFixed(mapper.x());
574 SkFixed fy = SkScalarToFixed(srcPt.fY); 567 SkFixed fy = SkFractionalIntToFixed(mapper.y());
575 SkFixed dx = s.fInvSx; 568 SkFixed dx = s.fInvSx;
576 SkFixed dy = s.fInvKy; 569 SkFixed dy = s.fInvKy;
577 int maxX = s.fPixmap.width() - 1; 570 int maxX = s.fPixmap.width() - 1;
578 int maxY = s.fPixmap.height() - 1; 571 int maxY = s.fPixmap.height() - 1;
579 572
580 if (count >= 4 && (maxX <= 0xFFFF)) { 573 if (count >= 4 && (maxX <= 0xFFFF)) {
581 while (((size_t)xy & 0x0F) != 0) { 574 while (((size_t)xy & 0x0F) != 0) {
582 *xy++ = (SkClampMax(fy >> 16, maxY) << 16) | 575 *xy++ = (SkClampMax(fy >> 16, maxY) << 16) |
583 SkClampMax(fx >> 16, maxX); 576 SkClampMax(fx >> 16, maxX);
584 fx += dx; 577 fx += dx;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 } // while count >= 4 618 } // while count >= 4
626 } // if count >= 4 619 } // if count >= 4
627 620
628 while (count-- > 0) { 621 while (count-- > 0) {
629 *xy++ = (SkClampMax(fy >> 16, maxY) << 16) | 622 *xy++ = (SkClampMax(fy >> 16, maxY) << 16) |
630 SkClampMax(fx >> 16, maxX); 623 SkClampMax(fx >> 16, maxX);
631 fx += dx; 624 fx += dx;
632 fy += dy; 625 fy += dy;
633 } 626 }
634 } 627 }
OLDNEW
« no previous file with comments | « src/opts/SkBitmapProcState_matrix_neon.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698