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

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

Issue 552743004: Outset the stroke width when computing the bounds for drawing a stroked rect, or 1 if it's a hairli… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SkScalarHalf Created 6 years, 3 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 | « gyp/gmslides.gypi ('k') | 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 7
8 #include "SkDraw.h" 8 #include "SkDraw.h"
9 #include "SkBlitter.h" 9 #include "SkBlitter.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 810
811 // transform rect into devRect 811 // transform rect into devRect
812 matrix.mapPoints(rect_points(devRect), rect_points(rect), 2); 812 matrix.mapPoints(rect_points(devRect), rect_points(rect), 2);
813 devRect.sort(); 813 devRect.sort();
814 814
815 // look for the quick exit, before we build a blitter 815 // look for the quick exit, before we build a blitter
816 SkIRect ir; 816 SkIRect ir;
817 devRect.roundOut(&ir); 817 devRect.roundOut(&ir);
818 if (paint.getStyle() != SkPaint::kFill_Style) { 818 if (paint.getStyle() != SkPaint::kFill_Style) {
819 // extra space for hairlines 819 // extra space for hairlines
820 ir.inset(-1, -1); 820 if (paint.getStrokeWidth() == 0) {
821 ir.outset(1, 1);
822 } else {
823 SkScalar radius = SkScalarHalf(paint.getStrokeWidth());
824 ir.outset(radius, radius);
825 }
821 } 826 }
822 if (fRC->quickReject(ir)) { 827 if (fRC->quickReject(ir)) {
823 return; 828 return;
824 } 829 }
825 830
826 SkDeviceLooper looper(*fBitmap, *fRC, ir, paint.isAntiAlias()); 831 SkDeviceLooper looper(*fBitmap, *fRC, ir, paint.isAntiAlias());
827 while (looper.next()) { 832 while (looper.next()) {
828 SkRect localDevRect; 833 SkRect localDevRect;
829 looper.mapRect(&localDevRect, devRect); 834 looper.mapRect(&localDevRect, devRect);
830 SkMatrix localMatrix; 835 SkMatrix localMatrix;
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after
2373 mask->fImage = SkMask::AllocImage(size); 2378 mask->fImage = SkMask::AllocImage(size);
2374 memset(mask->fImage, 0, mask->computeImageSize()); 2379 memset(mask->fImage, 0, mask->computeImageSize());
2375 } 2380 }
2376 2381
2377 if (SkMask::kJustComputeBounds_CreateMode != mode) { 2382 if (SkMask::kJustComputeBounds_CreateMode != mode) {
2378 draw_into_mask(*mask, devPath, style); 2383 draw_into_mask(*mask, devPath, style);
2379 } 2384 }
2380 2385
2381 return true; 2386 return true;
2382 } 2387 }
OLDNEW
« no previous file with comments | « gyp/gmslides.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698