| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 | 54 |
| 55 ////////////////////////////////////////////////////////////////////////////// | 55 ////////////////////////////////////////////////////////////////////////////// |
| 56 // Helper functions for dropping src rect constraint in bilerp mode. | 56 // Helper functions for dropping src rect constraint in bilerp mode. |
| 57 | 57 |
| 58 static const SkScalar kColorBleedTolerance = 0.001f; | 58 static const SkScalar kColorBleedTolerance = 0.001f; |
| 59 | 59 |
| 60 static bool has_aligned_samples(const SkRect& srcRect, const SkRect& transformed
Rect) { | 60 static bool has_aligned_samples(const SkRect& srcRect, const SkRect& transformed
Rect) { |
| 61 // detect pixel disalignment | 61 // detect pixel disalignment |
| 62 if (SkScalarAbs(SkScalarFraction(transformedRect.left())) < kColorBleedToler
ance && | 62 if (SkScalarAbs(SkScalarRoundToScalar(transformedRect.left()) - transformedR
ect.left()) < kColorBleedTolerance && |
| 63 SkScalarAbs(SkScalarFraction(transformedRect.top())) < kColorBleedTolera
nce && | 63 SkScalarAbs(SkScalarRoundToScalar(transformedRect.top()) - transformedR
ect.top()) < kColorBleedTolerance && |
| 64 SkScalarAbs(transformedRect.width() - srcRect.width()) < kColorBleedTole
rance && | 64 SkScalarAbs(transformedRect.width() - srcRect.width()) < kColorBleedTo
lerance && |
| 65 SkScalarAbs(transformedRect.height() - srcRect.height()) < kColorBleedTo
lerance) { | 65 SkScalarAbs(transformedRect.height() - srcRect.height()) < kColorBleedTo
lerance) { |
| 66 return true; | 66 return true; |
| 67 } | 67 } |
| 68 return false; | 68 return false; |
| 69 } | 69 } |
| 70 | 70 |
| 71 static bool may_color_bleed(const SkRect& srcRect, | 71 static bool may_color_bleed(const SkRect& srcRect, |
| 72 const SkRect& transformedRect, | 72 const SkRect& transformedRect, |
| 73 const SkMatrix& m, | 73 const SkMatrix& m, |
| 74 bool isMSAA) { | 74 bool isMSAA) { |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 rec, | 260 rec, |
| 261 rrect)) { | 261 rrect)) { |
| 262 return; | 262 return; |
| 263 } | 263 } |
| 264 SkPath rectPath; | 264 SkPath rectPath; |
| 265 rectPath.addRect(clippedDstRect); | 265 rectPath.addRect(clippedDstRect); |
| 266 GrBlurUtils::drawPathWithMaskFilter(this->context(), fDrawContext, fRenderTa
rget, fClip, | 266 GrBlurUtils::drawPathWithMaskFilter(this->context(), fDrawContext, fRenderTa
rget, fClip, |
| 267 rectPath, &grPaint, viewMatrix, mf, pain
t.getPathEffect(), | 267 rectPath, &grPaint, viewMatrix, mf, pain
t.getPathEffect(), |
| 268 GrStrokeInfo::FillInfo()); | 268 GrStrokeInfo::FillInfo()); |
| 269 } | 269 } |
| OLD | NEW |