From 1a0126f61a9867a97a1c05972e6142c296d3e7de Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Fri, 1 Feb 2019 08:28:36 -0500 Subject: [PATCH] skip huge allocation in test on 32bit devices Bug: skia: Change-Id: I931e02bab8b876e3d4ba699231178decd19697d5 Reviewed-on: https://skia-review.googlesource.com/c/188621 Commit-Queue: Mike Reed Reviewed-by: Mike Reed Auto-Submit: Mike Reed --- tests/RectTest.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/tests/RectTest.cpp b/tests/RectTest.cpp index 43301ce9e3..72adc9ab88 100644 --- a/tests/RectTest.cpp +++ b/tests/RectTest.cpp @@ -165,17 +165,22 @@ DEF_TEST(Rect_center, reporter) { // Before the fix, this sequence would trigger a release_assert in the Tiler // in SkBitmapDevice.cpp DEF_TEST(big_tiled_rect_crbug_927075, reporter) { - const int w = 67108863; - const int h = 1; - const auto info = SkImageInfo::MakeN32Premul(w, h); + // since part of the regression test allocates a huge buffer, don't bother trying on + // 32-bit devices (e.g. chromecast) so we avoid them failing to allocated. - auto surf = SkSurface::MakeRaster(info); - auto canvas = surf->getCanvas(); + if (sizeof(void*) == 8) { + const int w = 67108863; + const int h = 1; + const auto info = SkImageInfo::MakeN32Premul(w, h); - const SkRect r = { 257, 213, 67109120, 214 }; - SkPaint paint; - paint.setAntiAlias(true); + auto surf = SkSurface::MakeRaster(info); + auto canvas = surf->getCanvas(); - canvas->translate(-r.fLeft, -r.fTop); - canvas->drawRect(r, paint); + const SkRect r = { 257, 213, 67109120, 214 }; + SkPaint paint; + paint.setAntiAlias(true); + + canvas->translate(-r.fLeft, -r.fTop); + canvas->drawRect(r, paint); + } }