// don't call
GrRenderTarget* internal_private_accessTopLayerRenderTarget();
+ // don't call
+ static void Internal_Private_SetIgnoreSaveLayerBounds(bool);
+ static bool Internal_Private_GetIgnoreSaveLayerBounds();
+
protected:
// default impl defers to getDevice()->newSurface(info)
virtual SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&);
#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
}
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);
}
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);
}
// Now test out the SaveLayer extraction
- {
+ if (!SkCanvas::Internal_Private_GetIgnoreSaveLayerBounds()) {
SkPicture::AccelData::Key key = SkLayerInfo::ComputeKey();
const SkPicture::AccelData* data = pict->EXPERIMENTAL_getAccelData(key);
TestBBH bbh;
SkRecordFillBounds(SkRect::MakeWH(50, 50), record, &bbh);
REPORTER_ASSERT(r, bbh.fEntries.count() == 3);
- REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[0].bounds, SkRect::MakeLTRB(10, 10, 40, 40)));
- REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[1].bounds, SkRect::MakeLTRB(20, 20, 30, 30)));
- REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[2].bounds, SkRect::MakeLTRB(10, 10, 40, 40)));
+ if (!SkCanvas::Internal_Private_GetIgnoreSaveLayerBounds()) {
+ REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[0].bounds, SkRect::MakeLTRB(10, 10, 40, 40)));
+ REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[1].bounds, SkRect::MakeLTRB(20, 20, 30, 30)));
+ REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[2].bounds, SkRect::MakeLTRB(10, 10, 40, 40)));
+ }
}
DEF_TEST(RecordDraw_drawImage, r){
recorder.saveLayer(&bounds, NULL);
recorder.drawRect(draw, goodDrawPaint);
recorder.restore();
- assert_savelayer_restore(r, &record, 0, false);
+ if (!SkCanvas::Internal_Private_GetIgnoreSaveLayerBounds()) {
+ assert_savelayer_restore(r, &record, 0, false);
+ }
// SaveLayer/Restore removed: no bounds + no paint = no point.
recorder.saveLayer(NULL, NULL);