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

Unified Diff: src/effects/SkAlphaThresholdFilter.cpp

Issue 101763010: Fix build warnings in SkAlphaThresholdFilter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix another warning Created 6 years, 11 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 | « gm/imagealphathreshold.cpp ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkAlphaThresholdFilter.cpp
diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp
index a53731f3b42183b169cb63945763c553eda7d186..f15a13dd8b1cfcff9583f209053f4364400a9955 100644
--- a/src/effects/SkAlphaThresholdFilter.cpp
+++ b/src/effects/SkAlphaThresholdFilter.cpp
@@ -308,18 +308,18 @@ bool SkAlphaThresholdFilterImpl::onFilterImage(Proxy*, const SkBitmap& src,
SkASSERT(src.config() == SkBitmap::kARGB_8888_Config);
if (src.config() != SkBitmap::kARGB_8888_Config) {
- return false;
+ return false;
}
SkMatrix localInverse;
if (!matrix.invert(&localInverse)) {
- return NULL;
+ return false;
}
SkAutoLockPixels alp(src);
SkASSERT(src.getPixels());
if (!src.getPixels() || src.width() <= 0 || src.height() <= 0) {
- return false;
+ return false;
}
dst->setConfig(src.config(), src.width(), src.height());
@@ -328,8 +328,8 @@ bool SkAlphaThresholdFilterImpl::onFilterImage(Proxy*, const SkBitmap& src,
return false;
}
- U8CPU innerThreshold = fInnerThreshold * 0xFF;
- U8CPU outerThreshold = fOuterThreshold * 0xFF;
+ U8CPU innerThreshold = (U8CPU)(fInnerThreshold * 0xFF);
+ U8CPU outerThreshold = (U8CPU)(fOuterThreshold * 0xFF);
SkColor* sptr = src.getAddr32(0, 0);
SkColor* dptr = dst->getAddr32(0, 0);
int width = src.width(), height = src.height();
@@ -338,25 +338,25 @@ bool SkAlphaThresholdFilterImpl::onFilterImage(Proxy*, const SkBitmap& src,
const SkColor& source = sptr[y * width + x];
SkColor output_color(source);
SkPoint position;
- localInverse.mapXY(x, y, &position);
- if (fRegion.contains(position.x(), position.y())) {
+ localInverse.mapXY((SkScalar)x, (SkScalar)y, &position);
+ if (fRegion.contains((int32_t)position.x(), (int32_t)position.y())) {
if (SkColorGetA(source) < innerThreshold) {
U8CPU alpha = SkColorGetA(source);
if (alpha == 0)
alpha = 1;
float scale = (float)innerThreshold / alpha;
output_color = SkColorSetARGB(innerThreshold,
- SkColorGetR(source) * scale,
- SkColorGetG(source) * scale,
- SkColorGetB(source) * scale);
+ (U8CPU)(SkColorGetR(source) * scale),
+ (U8CPU)(SkColorGetG(source) * scale),
+ (U8CPU)(SkColorGetB(source) * scale));
}
} else {
if (SkColorGetA(source) > outerThreshold) {
float scale = (float)outerThreshold / SkColorGetA(source);
output_color = SkColorSetARGB(outerThreshold,
- SkColorGetR(source) * scale,
- SkColorGetG(source) * scale,
- SkColorGetB(source) * scale);
+ (U8CPU)(SkColorGetR(source) * scale),
+ (U8CPU)(SkColorGetG(source) * scale),
+ (U8CPU)(SkColorGetB(source) * scale));
}
}
dptr[y * dst->width() + x] = output_color;
« no previous file with comments | « gm/imagealphathreshold.cpp ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698