aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrRectBlurEffect.h
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-05-10 09:42:27 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-10 14:15:05 +0000
commitff6a7cd4d2da9a8c992a20da01cd439bfb008b5c (patch)
tree2efddca95f699efae7fbb3beeafb437737070c42 /src/gpu/effects/GrRectBlurEffect.h
parent333031b921264508ca1869769c1021bc08e4e07a (diff)
Revert "Revert "Don't use GrRRectBlurEffect for large rects when highp is not full float""
This reverts commit 729715298c8af1d2ecc4cbe887eeeb9a1c17c595. Changed std::abs() to SkScalarAbs() and #include "SkScalar.h" Change-Id: I9a02ca1a63eef748f9a11d324e8bb89e14571bc9 Reviewed-on: https://skia-review.googlesource.com/127320 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/effects/GrRectBlurEffect.h')
-rw-r--r--src/gpu/effects/GrRectBlurEffect.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gpu/effects/GrRectBlurEffect.h b/src/gpu/effects/GrRectBlurEffect.h
index 47e9dc3851..8307a49bbe 100644
--- a/src/gpu/effects/GrRectBlurEffect.h
+++ b/src/gpu/effects/GrRectBlurEffect.h
@@ -14,6 +14,7 @@
#include "GrProxyProvider.h"
#include "SkBlurMask.h"
+#include "SkScalar.h"
#include "GrFragmentProcessor.h"
#include "GrCoordTransform.h"
class GrRectBlurEffect : public GrFragmentProcessor {
@@ -63,7 +64,17 @@ public:
float sigma() const { return fSigma; }
static std::unique_ptr<GrFragmentProcessor> Make(GrProxyProvider* proxyProvider,
- const SkRect& rect, float sigma) {
+ const GrShaderCaps& caps, const SkRect& rect,
+ float sigma) {
+ if (!caps.floatIs32Bits()) {
+ // We promote the rect uniform from half to float when it has large values for
+ // precision. If we don't have full float then fail.
+ if (SkScalarAbs(rect.fLeft) > 16000.f || SkScalarAbs(rect.fTop) > 16000.f ||
+ SkScalarAbs(rect.fRight) > 16000.f || SkScalarAbs(rect.fBottom) > 16000.f ||
+ SkScalarAbs(rect.width()) > 16000.f || SkScalarAbs(rect.height()) > 16000.f) {
+ return nullptr;
+ }
+ }
int doubleProfileSize = SkScalarCeilToInt(12 * sigma);
if (doubleProfileSize >= rect.width() || doubleProfileSize >= rect.height()) {