OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
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 "SkGpuDevice.h" | 8 #include "SkGpuDevice.h" |
9 | 9 |
10 #include "GrBlurUtils.h" | 10 #include "GrBlurUtils.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 fDrawContext->fillRectToRect(clip, grPaint, viewMatrix, clippedDstRect,
clippedSrcRect); | 218 fDrawContext->fillRectToRect(clip, grPaint, viewMatrix, clippedDstRect,
clippedSrcRect); |
219 return; | 219 return; |
220 } | 220 } |
221 | 221 |
222 if (!mf) { | 222 if (!mf) { |
223 fDrawContext->drawRect(clip, grPaint, viewMatrix, clippedDstRect); | 223 fDrawContext->drawRect(clip, grPaint, viewMatrix, clippedDstRect); |
224 return; | 224 return; |
225 } | 225 } |
226 | 226 |
227 // First see if we can do the draw + mask filter direct to the dst. | 227 // First see if we can do the draw + mask filter direct to the dst. |
228 SkStrokeRec rec(SkStrokeRec::kFill_InitStyle); | 228 if (viewMatrix.isScaleTranslate()) { |
229 if (mf->directFilterRRectMaskGPU(fContext, | 229 SkRect devClippedDstRect; |
230 fDrawContext.get(), | 230 viewMatrix.mapRectScaleTranslate(&devClippedDstRect, clippedDstRect); |
231 &grPaint, | 231 |
232 clip, | 232 SkStrokeRec rec(SkStrokeRec::kFill_InitStyle); |
233 viewMatrix, | 233 if (mf->directFilterRRectMaskGPU(fContext, |
234 rec, | 234 fDrawContext.get(), |
235 SkRRect::MakeRect(clippedSrcRect), | 235 &grPaint, |
236 SkRRect::MakeRect(clippedDstRect))) { | 236 clip, |
237 return; | 237 viewMatrix, |
| 238 rec, |
| 239 SkRRect::MakeRect(clippedDstRect), |
| 240 SkRRect::MakeRect(devClippedDstRect)))
{ |
| 241 return; |
| 242 } |
238 } | 243 } |
| 244 |
239 SkPath rectPath; | 245 SkPath rectPath; |
240 rectPath.addRect(clippedDstRect); | 246 rectPath.addRect(clippedDstRect); |
241 rectPath.setIsVolatile(true); | 247 rectPath.setIsVolatile(true); |
242 GrBlurUtils::drawPathWithMaskFilter(this->context(), fDrawContext.get(), fCl
ip, | 248 GrBlurUtils::drawPathWithMaskFilter(this->context(), fDrawContext.get(), fCl
ip, |
243 rectPath, &grPaint, viewMatrix, mf, GrSt
yle::SimpleFill(), | 249 rectPath, &grPaint, viewMatrix, mf, GrSt
yle::SimpleFill(), |
244 true); | 250 true); |
245 } | 251 } |
OLD | NEW |