| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkLinearBitmapPipeline.h" | 8 #include "SkLinearBitmapPipeline.h" |
| 9 #include "SkPM4f.h" | 9 #include "SkPM4f.h" |
| 10 | 10 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 namespace { | 171 namespace { |
| 172 template <typename Stage> | 172 template <typename Stage> |
| 173 void span_fallback(Span span, Stage* stage) { | 173 void span_fallback(Span span, Stage* stage) { |
| 174 SkPoint start; | 174 SkPoint start; |
| 175 SkScalar length; | 175 SkScalar length; |
| 176 int count; | 176 int count; |
| 177 std::tie(start, length, count) = span; | 177 std::tie(start, length, count) = span; |
| 178 Sk4f xs{X(start)}; | 178 Sk4f xs{X(start)}; |
| 179 Sk4f ys{Y(start)}; | 179 Sk4f ys{Y(start)}; |
| 180 Sk4s fourDx; | 180 |
| 181 // Initializing this is not needed, but some compilers can't figure this out
. |
| 182 Sk4s fourDx{0.0f}; |
| 181 if (count > 1) { | 183 if (count > 1) { |
| 182 SkScalar dx = length / (count - 1); | 184 SkScalar dx = length / (count - 1); |
| 183 xs = xs + Sk4f{0.0f, 1.0f, 2.0f, 3.0f} * dx; | 185 xs = xs + Sk4f{0.0f, 1.0f, 2.0f, 3.0f} * dx; |
| 184 // Only used if count is >= 4. | 186 // Only used if count is >= 4. |
| 185 fourDx = Sk4f{4.0f * dx}; | 187 fourDx = Sk4f{4.0f * dx}; |
| 186 } | 188 } |
| 187 | 189 |
| 188 while (count >= 4) { | 190 while (count >= 4) { |
| 189 stage->pointList4(xs, ys); | 191 stage->pointList4(xs, ys); |
| 190 xs = xs + fourDx; | 192 xs = xs + fourDx; |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 | 934 |
| 933 void SkLinearBitmapPipeline::shadeSpan4f(int x, int y, SkPM4f* dst, int count) { | 935 void SkLinearBitmapPipeline::shadeSpan4f(int x, int y, SkPM4f* dst, int count) { |
| 934 SkASSERT(count > 0); | 936 SkASSERT(count > 0); |
| 935 fPixelStage->setDestination(dst); | 937 fPixelStage->setDestination(dst); |
| 936 // The count and length arguments start out in a precise relation in order t
o keep the | 938 // The count and length arguments start out in a precise relation in order t
o keep the |
| 937 // math correct through the different stages. Count is the number of pixel t
o produce. | 939 // math correct through the different stages. Count is the number of pixel t
o produce. |
| 938 // Since the code samples at pixel centers, length is the distance from the
center of the | 940 // Since the code samples at pixel centers, length is the distance from the
center of the |
| 939 // first pixel to the center of the last pixel. This implies that length is
count-1. | 941 // first pixel to the center of the last pixel. This implies that length is
count-1. |
| 940 fFirstStage->pointSpan(Span{SkPoint{x + 0.5f, y + 0.5f}, count - 1.0f, count
}); | 942 fFirstStage->pointSpan(Span{SkPoint{x + 0.5f, y + 0.5f}, count - 1.0f, count
}); |
| 941 } | 943 } |
| OLD | NEW |