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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 #define __STDC_LIMIT_MACROS 7 #define __STDC_LIMIT_MACROS
8 8
9 #include "SkDraw.h" 9 #include "SkDraw.h"
10 #include "SkBlitter.h" 10 #include "SkBlitter.h"
(...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after
1755 return false; 1755 return false;
1756 } 1756 }
1757 fDstToUnit.setConcat(im, ctmInv); 1757 fDstToUnit.setConcat(im, ctmInv);
1758 return true; 1758 return true;
1759 } 1759 }
1760 1760
1761 #include "SkColorPriv.h" 1761 #include "SkColorPriv.h"
1762 #include "SkComposeShader.h" 1762 #include "SkComposeShader.h"
1763 1763
1764 static int ScalarTo256(SkScalar v) { 1764 static int ScalarTo256(SkScalar v) {
1765 return static_cast<int>(SkScalarPin(v, 0, 1) * 256); 1765 return static_cast<int>(SkScalarPin(v, 0, 1) * 256 + 0.5);
1766 } 1766 }
1767 1767
1768 1768
1769 SkTriColorShader::TriColorShaderContext::TriColorShaderContext(const SkTriColorS hader& shader, 1769 SkTriColorShader::TriColorShaderContext::TriColorShaderContext(const SkTriColorS hader& shader,
1770 const ContextRec& rec) 1770 const ContextRec& rec)
1771 : INHERITED(shader, rec) {} 1771 : INHERITED(shader, rec) {}
1772 1772
1773 SkTriColorShader::TriColorShaderContext::~TriColorShaderContext() {} 1773 SkTriColorShader::TriColorShaderContext::~TriColorShaderContext() {}
1774 1774
1775 size_t SkTriColorShader::contextSize(const ContextRec&) const { 1775 size_t SkTriColorShader::contextSize(const ContextRec&) const {
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 mask->fImage = SkMask::AllocImage(size); 2056 mask->fImage = SkMask::AllocImage(size);
2057 memset(mask->fImage, 0, mask->computeImageSize()); 2057 memset(mask->fImage, 0, mask->computeImageSize());
2058 } 2058 }
2059 2059
2060 if (SkMask::kJustComputeBounds_CreateMode != mode) { 2060 if (SkMask::kJustComputeBounds_CreateMode != mode) {
2061 draw_into_mask(*mask, devPath, style); 2061 draw_into_mask(*mask, devPath, style);
2062 } 2062 }
2063 2063
2064 return true; 2064 return true;
2065 } 2065 }
OLDNEW
« 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