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

Side by Side Diff: src/core/SkScalerContext.cpp

Issue 742663002: add roundOut that returns its result (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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 | « src/core/SkRasterClip.cpp ('k') | src/core/SkScan_Antihair.cpp » ('j') | 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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkScalerContext.h" 10 #include "SkScalerContext.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 SkMask::kJustComputeBounds_CreateMode)) { 160 SkMask::kJustComputeBounds_CreateMode)) {
161 glyph->fLeft = mask.fBounds.fLeft; 161 glyph->fLeft = mask.fBounds.fLeft;
162 glyph->fTop = mask.fBounds.fTop; 162 glyph->fTop = mask.fBounds.fTop;
163 glyph->fWidth = SkToU16(mask.fBounds.width()); 163 glyph->fWidth = SkToU16(mask.fBounds.width());
164 glyph->fHeight = SkToU16(mask.fBounds.height()); 164 glyph->fHeight = SkToU16(mask.fBounds.height());
165 } else { 165 } else {
166 goto SK_ERROR; 166 goto SK_ERROR;
167 } 167 }
168 } else { 168 } else {
169 // just use devPath 169 // just use devPath
170 SkIRect ir; 170 const SkIRect ir = devPath.getBounds().roundOut();
171 devPath.getBounds().roundOut(&ir);
172 171
173 if (ir.isEmpty() || !ir.is16Bit()) { 172 if (ir.isEmpty() || !ir.is16Bit()) {
174 goto SK_ERROR; 173 goto SK_ERROR;
175 } 174 }
176 glyph->fLeft = ir.fLeft; 175 glyph->fLeft = ir.fLeft;
177 glyph->fTop = ir.fTop; 176 glyph->fTop = ir.fTop;
178 glyph->fWidth = SkToU16(ir.width()); 177 glyph->fWidth = SkToU16(ir.width());
179 glyph->fHeight = SkToU16(ir.height()); 178 glyph->fHeight = SkToU16(ir.height());
180 179
181 if (glyph->fWidth > 0) { 180 if (glyph->fWidth > 0) {
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, 757 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc,
759 bool allowFailure) const { 758 bool allowFailure) const {
760 SkScalerContext* c = this->onCreateScalerContext(desc); 759 SkScalerContext* c = this->onCreateScalerContext(desc);
761 760
762 if (!c && !allowFailure) { 761 if (!c && !allowFailure) {
763 c = SkNEW_ARGS(SkScalerContext_Empty, 762 c = SkNEW_ARGS(SkScalerContext_Empty,
764 (const_cast<SkTypeface*>(this), desc)); 763 (const_cast<SkTypeface*>(this), desc));
765 } 764 }
766 return c; 765 return c;
767 } 766 }
OLDNEW
« no previous file with comments | « src/core/SkRasterClip.cpp ('k') | src/core/SkScan_Antihair.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698