Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(854)

Unified Diff: skia/ext/bitmap_platform_device.h

Issue 10908266: Add define to limit recommended offscreen allocations. This avoids some failures (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | skia/ext/bitmap_platform_device_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/bitmap_platform_device.h
===================================================================
--- skia/ext/bitmap_platform_device.h (revision 156622)
+++ skia/ext/bitmap_platform_device.h (working copy)
@@ -18,4 +18,19 @@
#include "skia/ext/bitmap_platform_device_linux.h"
#endif
+namespace skia {
+ // Returns true if it is unsafe to attempt to allocate an offscreen buffer
+ // given these dimensions.
+ inline bool RasterDeviceTooBigToAllocate(int width, int height) {
+
+#ifndef SKIA_EXT_RASTER_DEVICE_ALLOCATION_MAX
+#define SKIA_EXT_RASTER_DEVICE_ALLOCATION_MAX (256 * 1024 * 1024)
Stephen White 2012/09/14 21:01:33 Just as a reference, canvas's hardcoded limit is 2
+#endif
+
+ int bytesPerPixel = 4;
+ int64_t bytes = (int64_t)width * height * bytesPerPixel;
+ return bytes > SKIA_EXT_RASTER_DEVICE_ALLOCATION_MAX;
+ }
+}
+
#endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_H_
« no previous file with comments | « no previous file | skia/ext/bitmap_platform_device_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698