aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkRectPriv.h
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-01-18 13:46:21 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-18 19:05:18 +0000
commit7b6ea19c9c42a4d24168f80fcfd44de4498604e3 (patch)
tree25ebfbbfedb9e175c378877e4360b2665468b849 /src/core/SkRectPriv.h
parent09a57b935b3e8aad0e96e2a7be91336748837055 (diff)
detect fixed overflow in drawPoints
This particular test this is addressing is: 1. very large device (>32K in a test case) 2. drawPoints has special (fast) case where it converts all of the pts (rects) into fixed point 3. overflows fixed -- assert Paths already don't draw into a device this large (they are limited by 32K I think, smaller if aa) The (theoretical) solution for paths is to tile the draw itself. Perhaps that approach could be applied everywhere in bitmapdevice... This older issue sums up this idea: https://bugs.chromium.org/p/skia/issues/detail?id=2122 Will look into this general solution in a separate CL/effort. Bug: skia:7425 Change-Id: I57f8da92df78127e6b8e42e422c43e50bb5748d6 Reviewed-on: https://skia-review.googlesource.com/96700 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
Diffstat (limited to 'src/core/SkRectPriv.h')
-rw-r--r--src/core/SkRectPriv.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/SkRectPriv.h b/src/core/SkRectPriv.h
index 16c9535cc8..d2a2ce4665 100644
--- a/src/core/SkRectPriv.h
+++ b/src/core/SkRectPriv.h
@@ -9,6 +9,7 @@
#define SkRectPriv_DEFINED
#include "SkRect.h"
+#include "SkMathPriv.h"
class SkRectPriv {
public:
@@ -45,6 +46,12 @@ public:
r->fTop = SkMinScalar(pt.fY, r->fTop);
r->fBottom = SkMaxScalar(pt.fY, r->fBottom);
}
+
+ // conservative check. will return false for very large values that "could" fit
+ static bool FitsInFixed(const SkRect& r) {
+ return SkFitsInFixed(r.fLeft) && SkFitsInFixed(r.fTop) &&
+ SkFitsInFixed(r.fRight) && SkFitsInFixed(r.fBottom);
+ }
};