add testing flag to ignore saveLayer bounds
BUG=skia:
Review URL: https://codereview.chromium.org/819123003
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 751fabd..c7fb2dd 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -34,6 +34,14 @@
#include "GrRenderTarget.h"
#endif
+static bool gIgnoreSaveLayerBounds;
+void SkCanvas::Internal_Private_SetIgnoreSaveLayerBounds(bool ignore) {
+ gIgnoreSaveLayerBounds = ignore;
+}
+bool SkCanvas::Internal_Private_GetIgnoreSaveLayerBounds() {
+ return gIgnoreSaveLayerBounds;
+}
+
// experimental for faster tiled drawing...
//#define SK_ENABLE_CLIP_QUICKREJECT
@@ -909,6 +917,9 @@
}
int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint) {
+ if (gIgnoreSaveLayerBounds) {
+ bounds = NULL;
+ }
SaveLayerStrategy strategy = this->willSaveLayer(bounds, paint, kARGB_ClipLayer_SaveFlag);
fSaveCount += 1;
this->internalSaveLayer(bounds, paint, kARGB_ClipLayer_SaveFlag, false, strategy);
@@ -916,6 +927,9 @@
}
int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags) {
+ if (gIgnoreSaveLayerBounds) {
+ bounds = NULL;
+ }
SaveLayerStrategy strategy = this->willSaveLayer(bounds, paint, flags);
fSaveCount += 1;
this->internalSaveLayer(bounds, paint, flags, false, strategy);