| 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 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 // Convert to the Y0 bilerp sample set by shifting by -0.5f. Then ti
le that new y | 360 // Convert to the Y0 bilerp sample set by shifting by -0.5f. Then ti
le that new y |
| 361 // value and shift it back resulting in the working Y0. Do the same
thing with Y1 but | 361 // value and shift it back resulting in the working Y0. Do the same
thing with Y1 but |
| 362 // in the opposite direction. | 362 // in the opposite direction. |
| 363 SkScalar y0 = fYStrategy.tileY(span.startY() - 0.5f) + 0.5f; | 363 SkScalar y0 = fYStrategy.tileY(span.startY() - 0.5f) + 0.5f; |
| 364 SkScalar y1 = fYStrategy.tileY(span.startY() + 0.5f) - 0.5f; | 364 SkScalar y1 = fYStrategy.tileY(span.startY() + 0.5f) - 0.5f; |
| 365 Span newSpan{{span.startX(), y0}, span.length(), span.count()}; | 365 Span newSpan{{span.startX(), y0}, span.length(), span.count()}; |
| 366 fNext->bilerpSpan(newSpan, y1); | 366 fNext->bilerpSpan(newSpan, y1); |
| 367 } | 367 } |
| 368 } | 368 } |
| 369 void breakIntoEdges(Span span) { | 369 void breakIntoEdges(Span span) { |
| 370 if (span.length() == 0) { | 370 if (span.count() == 1) { |
| 371 this->bilerpPoint(span.startX(), span.startY()); |
| 372 } else if (span.length() == 0) { |
| 371 yProcessSpan(span); | 373 yProcessSpan(span); |
| 372 } else { | 374 } else { |
| 373 SkScalar dx = span.length() / (span.count() - 1); | 375 SkScalar dx = span.length() / (span.count() - 1); |
| 374 if (span.length() > 0) { | 376 if (span.length() > 0) { |
| 375 Span leftBorder = span.breakAt(0.5f, dx); | 377 Span leftBorder = span.breakAt(0.5f, dx); |
| 376 if (!leftBorder.isEmpty()) { | 378 if (!leftBorder.isEmpty()) { |
| 377 this->handleEdges(leftBorder, dx); | 379 this->handleEdges(leftBorder, dx); |
| 378 } | 380 } |
| 379 Span center = span.breakAt(fXMax - 0.5f, dx); | 381 Span center = span.breakAt(fXMax - 0.5f, dx); |
| 380 if (!center.isEmpty()) { | 382 if (!center.isEmpty()) { |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 void SkLinearBitmapPipeline::blitSpan(int x, int y, void* dst, int count) { | 963 void SkLinearBitmapPipeline::blitSpan(int x, int y, void* dst, int count) { |
| 962 SkASSERT(count > 0); | 964 SkASSERT(count > 0); |
| 963 fLastStage->setDestination(dst, count); | 965 fLastStage->setDestination(dst, count); |
| 964 | 966 |
| 965 // The count and length arguments start out in a precise relation in order t
o keep the | 967 // The count and length arguments start out in a precise relation in order t
o keep the |
| 966 // math correct through the different stages. Count is the number of pixel t
o produce. | 968 // math correct through the different stages. Count is the number of pixel t
o produce. |
| 967 // Since the code samples at pixel centers, length is the distance from the
center of the | 969 // Since the code samples at pixel centers, length is the distance from the
center of the |
| 968 // first pixel to the center of the last pixel. This implies that length is
count-1. | 970 // first pixel to the center of the last pixel. This implies that length is
count-1. |
| 969 fFirstStage->pointSpan(Span{{x + 0.5f, y + 0.5f}, count - 1.0f, count}); | 971 fFirstStage->pointSpan(Span{{x + 0.5f, y + 0.5f}, count - 1.0f, count}); |
| 970 } | 972 } |
| OLD | NEW |