OLD | NEW |
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 #include "SkBitmapProcState.h" | 8 #include "SkBitmapProcState.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkColor.h" | 10 #include "SkColor.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 static inline void print128f(__m128 value) { | 39 static inline void print128f(__m128 value) { |
40 float *f = (float*) &value; | 40 float *f = (float*) &value; |
41 printf("%3.4f %3.4f %3.4f %3.4f\n", f[0], f[1], f[2], f[3]); | 41 printf("%3.4f %3.4f %3.4f %3.4f\n", f[0], f[1], f[2], f[3]); |
42 } | 42 } |
43 #endif | 43 #endif |
44 | 44 |
45 // because the border is handled specially, this is guaranteed to have all 16 pi
xels | 45 // because the border is handled specially, this is guaranteed to have all 16 pi
xels |
46 // available to it without running off the bitmap's edge. | 46 // available to it without running off the bitmap's edge. |
47 | 47 |
48 int debug_x = 20; | |
49 int debug_y = 255; | |
50 | |
51 void highQualityFilter_SSE2(const SkBitmapProcState& s, int x, int y, | 48 void highQualityFilter_SSE2(const SkBitmapProcState& s, int x, int y, |
52 SkPMColor* SK_RESTRICT colors, int count) { | 49 SkPMColor* SK_RESTRICT colors, int count) { |
53 | 50 |
54 const int maxX = s.fBitmap->width() - 1; | 51 const int maxX = s.fBitmap->width() - 1; |
55 const int maxY = s.fBitmap->height() - 1; | 52 const int maxY = s.fBitmap->height() - 1; |
56 | 53 |
57 while (count-- > 0) { | 54 while (count-- > 0) { |
58 SkPoint srcPt; | 55 SkPoint srcPt; |
59 s.fInvProc(s.fInvMatrix, SkIntToScalar(x), | 56 s.fInvProc(s.fInvMatrix, SkIntToScalar(x), |
60 SkIntToScalar(y), &srcPt); | 57 SkIntToScalar(y), &srcPt); |
61 srcPt.fX -= SK_ScalarHalf; | 58 srcPt.fX -= SK_ScalarHalf; |
62 srcPt.fY -= SK_ScalarHalf; | 59 srcPt.fY -= SK_ScalarHalf; |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 void applySIMDPadding_SSE2(SkConvolutionFilter1D *filter) { | 624 void applySIMDPadding_SSE2(SkConvolutionFilter1D *filter) { |
628 // Padding |paddingCount| of more dummy coefficients after the coefficients | 625 // Padding |paddingCount| of more dummy coefficients after the coefficients |
629 // of last filter to prevent SIMD instructions which load 8 or 16 bytes | 626 // of last filter to prevent SIMD instructions which load 8 or 16 bytes |
630 // together to access invalid memory areas. We are not trying to align the | 627 // together to access invalid memory areas. We are not trying to align the |
631 // coefficients right now due to the opaqueness of <vector> implementation. | 628 // coefficients right now due to the opaqueness of <vector> implementation. |
632 // This has to be done after all |AddFilter| calls. | 629 // This has to be done after all |AddFilter| calls. |
633 for (int i = 0; i < 8; ++i) { | 630 for (int i = 0; i < 8; ++i) { |
634 filter->addFilterValue(static_cast<SkConvolutionFilter1D::ConvolutionFix
ed>(0)); | 631 filter->addFilterValue(static_cast<SkConvolutionFilter1D::ConvolutionFix
ed>(0)); |
635 } | 632 } |
636 } | 633 } |
OLD | NEW |