Commits

Lenard Lindstrom committed 147a027

Allow read-only requests on a Surface return BufferProxy object

BufferProxy objects returned by Surface.get_buffer(t) calls would reject a
PyBUF_RECORDS_RO flag when 't' was one of '2', '3', 'r', 'g', 'b', or 'a'.
This was unnecessary. It conflicts with adding new buffer support to the
pixelcopy module functions, since source arrays can be read-only.

Comments (0)

Files changed (1)

     char *format;
 
     view_p->obj = 0;
-    if ((flags & PyBUF_RECORDS) != PyBUF_RECORDS) {
+    if ((flags & PyBUF_RECORDS_RO) != PyBUF_RECORDS_RO) {
         PyErr_SetString (PgExc_BufferError,
-                         "A PyBUF_RECORDS flag is required for a "
+                         "A PyBUF_RECORDS(_RO) flag is required for a "
                          "2D surface view");
         return -1;
     }
     char *startpixel = (char *)surface->pixels;
 
     view_p->obj = 0;
-    if ((flags & PyBUF_RECORDS) != PyBUF_RECORDS) {
+    if ((flags & PyBUF_RECORDS_RO) != PyBUF_RECORDS_RO) {
         PyErr_SetString (PgExc_BufferError,
-                         "A PyBUF_RECORDS flag is required for a "
+                         "A PyBUF_RECORDS(_RO) flag is required for a "
                          "2D surface view");
         return -1;
     }
     char *startpixel = (char *)surface->pixels;
 
     view_p->obj = 0;
-    if ((flags & PyBUF_RECORDS) != PyBUF_RECORDS) {
+    if ((flags & PyBUF_RECORDS_RO) != PyBUF_RECORDS_RO) {
         PyErr_SetString (PgExc_BufferError,
-                         "A PyBUF_RECORDS flag is required for a "
+                         "A PyBUF_RECORDS(_RO) flag is required for a "
                          "surface colorplane view");
         return -1;
     }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.