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

Unified Diff: src/core/SkDraw.cpp

Issue 1723483004: Round to nearest in ScalarTo256. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkDraw.cpp
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index b041df8f7a64ba74c3f1520eeabcd51354042853..131c2d7cee77f849ce4549efbadd573a2571a5fd 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1762,7 +1762,7 @@ bool SkTriColorShader::TriColorShaderContext::setup(const SkPoint pts[], const S
#include "SkComposeShader.h"
static int ScalarTo256(SkScalar v) {
- return static_cast<int>(SkScalarPin(v, 0, 1) * 256);
+ return static_cast<int>(SkScalarPin(v, 0, 1) * 256 + 0.5);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698