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

Unified Diff: src/core/SkLinearBitmapPipeline.cpp

Issue 1915263002: Add guards for edge cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use proper call for trunc. Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkBitmapProcShader.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkLinearBitmapPipeline.cpp
diff --git a/src/core/SkLinearBitmapPipeline.cpp b/src/core/SkLinearBitmapPipeline.cpp
index 415179a0b1683e4ac612bdb3be17bbcb656b6977..d9b4a8d50432d530774802af049a7f7de7920af2 100644
--- a/src/core/SkLinearBitmapPipeline.cpp
+++ b/src/core/SkLinearBitmapPipeline.cpp
@@ -584,18 +584,20 @@ public:
void pointSpan(Span span) override {
SkASSERT(fDest + span.count() <= fEnd);
- int32_t x = (int32_t)span.startX();
- int32_t y = (int32_t)span.startY();
- const uint32_t* src = this->pixelAddress(x, y);
- memmove(fDest, src, span.count() * sizeof(uint32_t));
- fDest += span.count();
+ if (span.length() != 0.0f) {
+ int32_t x = SkScalarTruncToInt(span.startX());
+ int32_t y = SkScalarTruncToInt(span.startY());
+ const uint32_t* src = this->pixelAddress(x, y);
+ memmove(fDest, src, span.count() * sizeof(uint32_t));
+ fDest += span.count();
+ }
}
void repeatSpan(Span span, int32_t repeatCount) override {
SkASSERT(fDest + span.count() * repeatCount <= fEnd);
- int32_t x = (int32_t)span.startX();
- int32_t y = (int32_t)span.startY();
+ int32_t x = SkScalarTruncToInt(span.startX());
+ int32_t y = SkScalarTruncToInt(span.startY());
const uint32_t* src = this->pixelAddress(x, y);
uint32_t* dest = fDest;
while (repeatCount --> 0) {
« no previous file with comments | « src/core/SkBitmapProcShader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698