OLD | NEW |
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 74 } |
75 return true; | 75 return true; |
76 } | 76 } |
77 | 77 |
78 //////////////////////////////////////////////////////////////////////////////// | 78 //////////////////////////////////////////////////////////////////////////////// |
79 void draw_around_inv_path(GrDrawTarget* target, | 79 void draw_around_inv_path(GrDrawTarget* target, |
80 GrDrawState* drawState, | 80 GrDrawState* drawState, |
81 GrColor color, | 81 GrColor color, |
82 const SkIRect& devClipBounds, | 82 const SkIRect& devClipBounds, |
83 const SkIRect& devPathBounds) { | 83 const SkIRect& devPathBounds) { |
84 GrDrawState::AutoViewMatrixRestore avmr; | 84 const SkMatrix& matrix = drawState->getViewMatrix(); |
85 if (!avmr.setIdentity(drawState)) { | 85 SkMatrix invert; |
| 86 if (!matrix.invert(&invert)) { |
86 return; | 87 return; |
87 } | 88 } |
| 89 |
| 90 GrDrawState::AutoViewMatrixRestore avmr(drawState); |
| 91 |
88 SkRect rect; | 92 SkRect rect; |
89 if (devClipBounds.fTop < devPathBounds.fTop) { | 93 if (devClipBounds.fTop < devPathBounds.fTop) { |
90 rect.iset(devClipBounds.fLeft, devClipBounds.fTop, | 94 rect.iset(devClipBounds.fLeft, devClipBounds.fTop, |
91 devClipBounds.fRight, devPathBounds.fTop); | 95 devClipBounds.fRight, devPathBounds.fTop); |
92 target->drawSimpleRect(drawState, color, rect); | 96 target->drawRect(drawState, color, rect, NULL, &invert); |
93 } | 97 } |
94 if (devClipBounds.fLeft < devPathBounds.fLeft) { | 98 if (devClipBounds.fLeft < devPathBounds.fLeft) { |
95 rect.iset(devClipBounds.fLeft, devPathBounds.fTop, | 99 rect.iset(devClipBounds.fLeft, devPathBounds.fTop, |
96 devPathBounds.fLeft, devPathBounds.fBottom); | 100 devPathBounds.fLeft, devPathBounds.fBottom); |
97 target->drawSimpleRect(drawState, color, rect); | 101 target->drawRect(drawState, color, rect, NULL, &invert); |
98 } | 102 } |
99 if (devClipBounds.fRight > devPathBounds.fRight) { | 103 if (devClipBounds.fRight > devPathBounds.fRight) { |
100 rect.iset(devPathBounds.fRight, devPathBounds.fTop, | 104 rect.iset(devPathBounds.fRight, devPathBounds.fTop, |
101 devClipBounds.fRight, devPathBounds.fBottom); | 105 devClipBounds.fRight, devPathBounds.fBottom); |
102 target->drawSimpleRect(drawState, color, rect); | 106 target->drawRect(drawState, color, rect, NULL, &invert); |
103 } | 107 } |
104 if (devClipBounds.fBottom > devPathBounds.fBottom) { | 108 if (devClipBounds.fBottom > devPathBounds.fBottom) { |
105 rect.iset(devClipBounds.fLeft, devPathBounds.fBottom, | 109 rect.iset(devClipBounds.fLeft, devPathBounds.fBottom, |
106 devClipBounds.fRight, devClipBounds.fBottom); | 110 devClipBounds.fRight, devClipBounds.fBottom); |
107 target->drawSimpleRect(drawState, color, rect); | 111 target->drawRect(drawState, color, rect, NULL, &invert); |
108 } | 112 } |
109 } | 113 } |
110 | 114 |
111 } | 115 } |
112 | 116 |
113 //////////////////////////////////////////////////////////////////////////////// | 117 //////////////////////////////////////////////////////////////////////////////// |
114 // return true on success; false on failure | 118 // return true on success; false on failure |
115 bool GrSoftwarePathRenderer::onDrawPath(GrDrawTarget* target, | 119 bool GrSoftwarePathRenderer::onDrawPath(GrDrawTarget* target, |
116 GrDrawState* drawState, | 120 GrDrawState* drawState, |
117 GrColor color, | 121 GrColor color, |
(...skipping 26 matching lines...) Expand all Loading... |
144 | 148 |
145 GrDrawState copy = *drawState; | 149 GrDrawState copy = *drawState; |
146 GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, ©, color, devP
athBounds); | 150 GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, ©, color, devP
athBounds); |
147 | 151 |
148 if (path.isInverseFillType()) { | 152 if (path.isInverseFillType()) { |
149 draw_around_inv_path(target, drawState, color, devClipBounds, devPathBou
nds); | 153 draw_around_inv_path(target, drawState, color, devClipBounds, devPathBou
nds); |
150 } | 154 } |
151 | 155 |
152 return true; | 156 return true; |
153 } | 157 } |
OLD | NEW |