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

Side by Side Diff: src/gpu/GrSoftwarePathRenderer.cpp

Issue 913693002: Clean up clipping code a bit (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix assert Created 5 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
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 #include "GrSoftwarePathRenderer.h" 9 #include "GrSoftwarePathRenderer.h"
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 const GrPipelineBuilder* pipelineBuilder, 42 const GrPipelineBuilder* pipelineBuilder,
43 const SkPath& path, 43 const SkPath& path,
44 const SkMatrix& matrix, 44 const SkMatrix& matrix,
45 SkIRect* devPathBounds, 45 SkIRect* devPathBounds,
46 SkIRect* devClipBounds) { 46 SkIRect* devClipBounds) {
47 // compute bounds as intersection of rt size, clip, and path 47 // compute bounds as intersection of rt size, clip, and path
48 const GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); 48 const GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
49 if (NULL == rt) { 49 if (NULL == rt) {
50 return false; 50 return false;
51 } 51 }
52 *devPathBounds = SkIRect::MakeWH(rt->width(), rt->height());
53 52
54 target->getClip()->getConservativeBounds(rt, devClipBounds); 53 target->getClip()->getConservativeBounds(rt, devClipBounds);
55 54
56 // TODO: getConservativeBounds already intersects with the 55 if (devClipBounds->isEmpty()) {
57 // render target's bounding box. Remove this next line 56 *devPathBounds = SkIRect::MakeWH(rt->width(), rt->height());
58 if (!devPathBounds->intersect(*devClipBounds)) {
59 return false; 57 return false;
60 } 58 }
61 59
62 if (!path.getBounds().isEmpty()) { 60 if (!path.getBounds().isEmpty()) {
63 SkRect pathSBounds; 61 SkRect pathSBounds;
64 matrix.mapRect(&pathSBounds, path.getBounds()); 62 matrix.mapRect(&pathSBounds, path.getBounds());
65 SkIRect pathIBounds; 63 SkIRect pathIBounds;
66 pathSBounds.roundOut(&pathIBounds); 64 pathSBounds.roundOut(&pathIBounds);
65 *devPathBounds = *devClipBounds;
67 if (!devPathBounds->intersect(pathIBounds)) { 66 if (!devPathBounds->intersect(pathIBounds)) {
68 // set the correct path bounds, as this would be used later. 67 // set the correct path bounds, as this would be used later.
69 *devPathBounds = pathIBounds; 68 *devPathBounds = pathIBounds;
70 return false; 69 return false;
71 } 70 }
72 } else { 71 } else {
73 *devPathBounds = SkIRect::EmptyIRect(); 72 *devPathBounds = SkIRect::EmptyIRect();
74 return false; 73 return false;
75 } 74 }
76 return true; 75 return true;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, &copy, color, view Matrix, 148 GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, &copy, color, view Matrix,
150 devPathBounds); 149 devPathBounds);
151 150
152 if (path.isInverseFillType()) { 151 if (path.isInverseFillType()) {
153 draw_around_inv_path(target, pipelineBuilder, color, viewMatrix, devClip Bounds, 152 draw_around_inv_path(target, pipelineBuilder, color, viewMatrix, devClip Bounds,
154 devPathBounds); 153 devPathBounds);
155 } 154 }
156 155
157 return true; 156 return true;
158 } 157 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698