Changeset 60914 in webkit


Ignore:
Timestamp:
Jun 9, 2010 2:39:42 PM (14 years ago)
Author:
kbr@google.com
Message:

2010-06-09 Kenneth Russell <kbr@google.com>

Reviewed by Dimitri Glazkov.

Update readPixels to take ArrayBufferView rather than returning it
https://bugs.webkit.org/show_bug.cgi?id=40322

No new tests; covered by existing tests, which have been modified.

  • html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::readPixels):
  • html/canvas/WebGLRenderingContext.h:
  • html/canvas/WebGLRenderingContext.idl:

2010-06-09 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Test how XML directives get attached to the DOM
https://bugs.webkit.org/show_bug.cgi?id=40384

In the old parser, the XML directive doesn't get added to the DOM. In
new parser (and in Minefield), it gets added as a comment, which shows
up in this test.

This behavior was tested more obliquely by
fast/css-generated-content/hover-style-change.html in some
DumpRenderTree output. I've removed that coverage from the CSS test
and moved it to a new parser test that can actually be run in other
browsers.

  • fast/css-generated-content/hover-style-change.html:
    • Remove XML directive that was causing this test to depend on out-of-spec parser behavior w.r.t. whether to attach the XML directive to the DOM.
  • fast/parser/xml-directive-in-dom-expected.txt: Added.
  • fast/parser/xml-directive-in-dom.html: Added.
Location:
trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r60913 r60914  
    3232        * platform/mac/Skipped: Unskip the test that is passing now.
    3333        * platform/qt/Skipped: Unskip the test that is passing now.
     34
     352010-06-09  Kenneth Russell  <kbr@google.com>
     36
     37        Reviewed by Dimitri Glazkov.
     38
     39        Update readPixels to take ArrayBufferView rather than returning it
     40        https://bugs.webkit.org/show_bug.cgi?id=40322
     41
     42        No new tests; covered by existing tests, which have been modified.
     43
     44        * fast/canvas/webgl/bug-32888.html:
     45        * fast/canvas/webgl/context-attributes-alpha-depth-stencil-antialias.html:
     46        * fast/canvas/webgl/copy-tex-image-and-sub-image-2d.html:
     47        * fast/canvas/webgl/point-size.html:
     48        * fast/canvas/webgl/read-pixels-expected.txt:
     49        * fast/canvas/webgl/read-pixels.html:
     50        * fast/canvas/webgl/renderbuffer-initialization.html:
     51        * fast/canvas/webgl/tex-image-and-sub-image-2d-with-image-data.html:
     52        * fast/canvas/webgl/tex-image-and-sub-image-2d-with-image.html:
     53        * fast/canvas/webgl/tex-sub-image-2d.html:
     54        * fast/canvas/webgl/texImage2DImageDataTest.html:
     55        * fast/canvas/webgl/texture-npot.html:
     56        * fast/canvas/webgl/triangle.html:
     57        * fast/canvas/webgl/viewport-unchanged-upon-resize.html:
    3458
    35592010-06-09  Kenneth Russell  <kbr@google.com>
  • trunk/LayoutTests/fast/canvas/webgl/bug-32888.html

    r55282 r60914  
    113113    var width = 32;
    114114    var height = 32;
    115     buf = gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE);
     115    buf = new Uint8Array(width * height * 4);
     116    gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf);
    116117    // Spot check a couple of 2x2 regions in the upper and lower left
    117118    // corners; they should be the background color rather than
  • trunk/LayoutTests/fast/canvas/webgl/context-attributes-alpha-depth-stencil-antialias.html

    r56886 r60914  
    131131    gl.drawArrays(gl.TRIANGLES, 0, vertices.length / 3);
    132132
    133     return gl.readPixels(x, y, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE);
     133    var buf = new Uint8Array(1 * 1 * 4);
     134    gl.readPixels(x, y, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, buf);
     135    return buf;
    134136}
    135137
     
    148150    shouldBe("contextAttribs.premultipliedAlpha", "true");
    149151
    150     var buf = webGL.readPixels(0, 0, 1, 1, webGL.RGBA, webGL.UNSIGNED_BYTE);
     152    var buf = new Uint8Array(1 * 1 * 4);
     153    webGL.readPixels(0, 0, 1, 1, webGL.RGBA, webGL.UNSIGNED_BYTE, buf);
    151154    pixel[0] = buf[0];
    152155    pixel[1] = buf[1];
  • trunk/LayoutTests/fast/canvas/webgl/copy-tex-image-and-sub-image-2d.html

    r57322 r60914  
    117117
    118118    // Read back the rendering results, should be red
    119     var buf = gl.readPixels(0, 0, 2, 2, gl.RGBA, gl.UNSIGNED_BYTE);
     119    var buf = new Uint8Array(2 * 2 * 4);
     120    gl.readPixels(0, 0, 2, 2, gl.RGBA, gl.UNSIGNED_BYTE, buf);
    120121    var idx = 0;
    121122    correctColor = [255, 0, 0];
     
    148149
    149150    // Read back the rendering results, should be green
    150     buf = gl.readPixels(0, 0, 2, 2, gl.RGBA, gl.UNSIGNED_BYTE);
     151    gl.readPixels(0, 0, 2, 2, gl.RGBA, gl.UNSIGNED_BYTE, buf);
    151152    correctColor = [0, 255, 0];
    152153    for (var y = 0; y < 2; y++) {
  • trunk/LayoutTests/fast/canvas/webgl/point-size.html

    r57694 r60914  
    6666    gl.uniform1f(locPointSize, 1.0);
    6767    gl.drawArrays(gl.POINTS, 0, vertices.length / 3);
    68     var buf = gl.readPixels(0, 0, 2, 2, gl.RGBA, gl.UNSIGNED_BYTE);
     68    var buf = new Uint8Array(2 * 2 * 4);
     69    gl.readPixels(0, 0, 2, 2, gl.RGBA, gl.UNSIGNED_BYTE, buf);
    6970    var index = 0;
    7071    for (var y = 0; y < 2; ++y) {
     
    9091    gl.uniform1f(locPointSize, 2.0);
    9192    gl.drawArrays(gl.POINTS, 0, vertices.length / 3);
    92     buf = gl.readPixels(0, 0, 2, 2, gl.RGBA, gl.UNSIGNED_BYTE);
     93    gl.readPixels(0, 0, 2, 2, gl.RGBA, gl.UNSIGNED_BYTE, buf);
    9394    index = 0;
    9495    for (var y = 0; y < 2; ++y) {
  • trunk/LayoutTests/fast/canvas/webgl/read-pixels-expected.txt

    r58102 r60914  
    1212PASS gl.getError() is gl.NO_ERROR
    1313PASS gl.getError() is gl.NO_ERROR
    14 PASS array.length is expectedSize
    1514PASS 255,102,0,255 is non-null.
    1615PASS pixel is expectedColor
     
    1817PASS gl.getError() is gl.NO_ERROR
    1918PASS gl.getError() is gl.NO_ERROR
    20 PASS array.length is expectedSize
    2119PASS 255,102,0,255 is non-null.
    2220PASS pixel is expectedColor
     
    2422PASS gl.getError() is gl.NO_ERROR
    2523PASS gl.getError() is gl.NO_ERROR
    26 PASS array.length is expectedSize
    2724PASS 255,102,0,255 is non-null.
    2825PASS pixel is expectedColor
     
    3027PASS gl.getError() is gl.NO_ERROR
    3128PASS gl.getError() is gl.NO_ERROR
    32 PASS array.length is expectedSize
    3329PASS 255,102,0,255 is non-null.
    3430PASS pixel is expectedColor
     
    3632PASS gl.getError() is gl.NO_ERROR
    3733PASS gl.getError() is gl.NO_ERROR
    38 PASS array.length is expectedSize
    3934PASS 255,102,0,255 is non-null.
    4035PASS pixel is expectedColor
     
    4237PASS gl.getError() is gl.NO_ERROR
    4338PASS gl.getError() is gl.NO_ERROR
    44 PASS array.length is expectedSize
    4539PASS 255,102,0,255 is non-null.
    4640PASS pixel is expectedColor
     
    4842PASS gl.getError() is gl.NO_ERROR
    4943PASS gl.getError() is gl.NO_ERROR
    50 PASS array.length is expectedSize
    5144PASS 255,102,0,255 is non-null.
    5245PASS pixel is expectedColor
     
    5447PASS gl.getError() is gl.NO_ERROR
    5548PASS gl.getError() is gl.NO_ERROR
    56 PASS array.length is expectedSize
    5749PASS 255,102,0,255 is non-null.
    5850PASS pixel is expectedColor
     
    6052PASS gl.getError() is gl.NO_ERROR
    6153PASS gl.getError() is gl.NO_ERROR
    62 PASS array.length is expectedSize
    6354PASS 255,102,0,255 is non-null.
    6455PASS pixel is expectedColor
     
    6657PASS gl.getError() is gl.NO_ERROR
    6758PASS gl.getError() is gl.NO_ERROR
    68 PASS array.length is expectedSize
    6959PASS 255,102,0,255 is non-null.
    7060PASS pixel is expectedColor
     
    7262PASS gl.getError() is gl.NO_ERROR
    7363PASS gl.getError() is gl.NO_ERROR
    74 PASS array.length is expectedSize
    7564PASS 255,102,0,255 is non-null.
    7665PASS pixel is expectedColor
     
    7867PASS gl.getError() is gl.NO_ERROR
    7968PASS gl.getError() is gl.NO_ERROR
    80 PASS array.length is expectedSize
    8169PASS 255,102,0,255 is non-null.
    8270PASS pixel is expectedColor
     
    8472PASS gl.getError() is gl.NO_ERROR
    8573PASS gl.getError() is gl.NO_ERROR
    86 PASS array.length is expectedSize
    8774PASS 255,102,0,255 is non-null.
    8875PASS pixel is expectedColor
     
    9077PASS gl.getError() is gl.NO_ERROR
    9178PASS gl.getError() is gl.NO_ERROR
    92 PASS array.length is expectedSize
    9379PASS 255,102,0,255 is non-null.
    9480PASS pixel is expectedColor
     
    9682PASS gl.getError() is gl.NO_ERROR
    9783PASS gl.getError() is gl.NO_ERROR
    98 PASS array.length is expectedSize
    9984PASS 255,102,0,255 is non-null.
    10085PASS pixel is expectedColor
     
    10287PASS gl.getError() is gl.NO_ERROR
    10388PASS gl.getError() is gl.NO_ERROR
    104 PASS array.length is expectedSize
    10589PASS 255,102,0,255 is non-null.
    10690PASS pixel is expectedColor
     
    10993PASS gl.getError() is gl.NO_ERROR
    11094PASS gl.getError() is gl.NO_ERROR
    111 PASS array.length is expectedSize
    11295PASS 255,102,0,0 is non-null.
    11396PASS pixel is expectedColor
     
    11598PASS gl.getError() is gl.NO_ERROR
    11699PASS gl.getError() is gl.NO_ERROR
    117 PASS array.length is expectedSize
    118100PASS 255,102,0,0 is non-null.
    119101PASS pixel is expectedColor
     
    121103PASS gl.getError() is gl.NO_ERROR
    122104PASS gl.getError() is gl.NO_ERROR
    123 PASS array.length is expectedSize
    124105PASS 255,102,0,0 is non-null.
    125106PASS pixel is expectedColor
     
    127108PASS gl.getError() is gl.NO_ERROR
    128109PASS gl.getError() is gl.NO_ERROR
    129 PASS array.length is expectedSize
    130110PASS 255,102,0,0 is non-null.
    131111PASS pixel is expectedColor
     
    133113PASS gl.getError() is gl.NO_ERROR
    134114PASS gl.getError() is gl.NO_ERROR
    135 PASS array.length is expectedSize
    136115PASS 255,102,0,0 is non-null.
    137116PASS pixel is expectedColor
     
    139118PASS gl.getError() is gl.NO_ERROR
    140119PASS gl.getError() is gl.NO_ERROR
    141 PASS array.length is expectedSize
    142120PASS 255,102,0,0 is non-null.
    143121PASS pixel is expectedColor
     
    145123PASS gl.getError() is gl.NO_ERROR
    146124PASS gl.getError() is gl.NO_ERROR
    147 PASS array.length is expectedSize
    148125PASS 255,102,0,0 is non-null.
    149126PASS pixel is expectedColor
     
    151128PASS gl.getError() is gl.NO_ERROR
    152129PASS gl.getError() is gl.NO_ERROR
    153 PASS array.length is expectedSize
    154130PASS 255,102,0,0 is non-null.
    155131PASS pixel is expectedColor
     
    157133PASS gl.getError() is gl.NO_ERROR
    158134PASS gl.getError() is gl.NO_ERROR
    159 PASS array.length is expectedSize
    160135PASS 255,102,0,0 is non-null.
    161136PASS pixel is expectedColor
     
    163138PASS gl.getError() is gl.NO_ERROR
    164139PASS gl.getError() is gl.NO_ERROR
    165 PASS array.length is expectedSize
    166140PASS 255,102,0,0 is non-null.
    167141PASS pixel is expectedColor
     
    169143PASS gl.getError() is gl.NO_ERROR
    170144PASS gl.getError() is gl.NO_ERROR
    171 PASS array.length is expectedSize
    172145PASS 255,102,0,0 is non-null.
    173146PASS pixel is expectedColor
     
    175148PASS gl.getError() is gl.NO_ERROR
    176149PASS gl.getError() is gl.NO_ERROR
    177 PASS array.length is expectedSize
    178150PASS 255,102,0,0 is non-null.
    179151PASS pixel is expectedColor
     
    181153PASS gl.getError() is gl.NO_ERROR
    182154PASS gl.getError() is gl.NO_ERROR
    183 PASS array.length is expectedSize
    184155PASS 255,102,0,0 is non-null.
    185156PASS pixel is expectedColor
     
    187158PASS gl.getError() is gl.NO_ERROR
    188159PASS gl.getError() is gl.NO_ERROR
    189 PASS array.length is expectedSize
    190160PASS 255,102,0,0 is non-null.
    191161PASS pixel is expectedColor
     
    193163PASS gl.getError() is gl.NO_ERROR
    194164PASS gl.getError() is gl.NO_ERROR
    195 PASS array.length is expectedSize
    196165PASS 255,102,0,0 is non-null.
    197166PASS pixel is expectedColor
     
    199168PASS gl.getError() is gl.NO_ERROR
    200169PASS gl.getError() is gl.NO_ERROR
    201 PASS array.length is expectedSize
    202170PASS 255,102,0,0 is non-null.
    203171PASS pixel is expectedColor
  • trunk/LayoutTests/fast/canvas/webgl/read-pixels.html

    r58102 r60914  
    3636var gl = null;
    3737var array = null;
    38 var expectedSize = 0;
    3938var pixel = [ 0, 0, 0, 0 ];
    4039var expectedColor = [ 0, 0, 0, 0 ];
     
    160159    gl.pixelStorei(gl.PACK_ALIGNMENT, packAlignment);
    161160    shouldBe("gl.getError()", "gl.NO_ERROR");
    162     array = gl.readPixels(0, 0, width, height, format, type);
    163     shouldBe("gl.getError()", "gl.NO_ERROR");
    164161    var bytesPerPixel = calculatePixelBytes(format, type);
    165162    var padding = calculatePaddingBytes(bytesPerPixel, packAlignment, width);
    166     expectedSize = bytesPerPixel * width * height + padding * (height - 1);
     163    var size = bytesPerPixel * width * height + padding * (height - 1);
    167164    var isShort = false;
    168165    switch (type) {
     
    173170    }
    174171    if (isShort)
    175         expectedSize /= 2;
    176     shouldBe("array.length", "expectedSize");
     172        size /= 2;
     173    if (type == gl.UNSIGNED_BYTE)
     174        array = new Uint8Array(size);
     175    else
     176        array = new Uint16Array(size);
     177    gl.readPixels(0, 0, width, height, format, type, array);
     178    shouldBe("gl.getError()", "gl.NO_ERROR");
    177179    // Check the last pixel of the last row.
    178180    var bytesPerRow = width * bytesPerPixel + padding;
  • trunk/LayoutTests/fast/canvas/webgl/renderbuffer-initialization.html

    r60290 r60914  
    1616
    1717    debug('Test whether the WebGL internal buffers have been initialized to 0.');
    18     var buf = gl.readPixels(0, 0, 500, 500, gl.RGBA, gl.UNSIGNED_BYTE);
     18    var buf = new Uint8Array(500 * 500 * 4);
     19    gl.readPixels(0, 0, 500, 500, gl.RGBA, gl.UNSIGNED_BYTE, buf);
    1920    if (gl.getError() != gl.NO_ERROR) {
    2021        testFailed('GL error detected after readPixels().');
     
    4546        return false;
    4647    }
    47     buf = gl.readPixels(0, 0, 500, 500, gl.RGBA, gl.UNSIGNED_BYTE);
     48    gl.readPixels(0, 0, 500, 500, gl.RGBA, gl.UNSIGNED_BYTE, buf);
    4849    if (gl.getError() != gl.NO_ERROR) {
    4950        testFailed('GL error detected after readPixels().');
  • trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-image-data.html

    r55283 r60914  
    134134
    135135    // Read back the rendering results
    136     buf = gl.readPixels(0, 0, 1, 2, gl.RGBA, gl.UNSIGNED_BYTE);
     136    buf = new Uint8Array(1 * 2 * 4);
     137    gl.readPixels(0, 0, 1, 2, gl.RGBA, gl.UNSIGNED_BYTE, buf);
    137138    // Check the top pixel and bottom pixel and make sure they have
    138139    // the right color.
  • trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-image.html

    r60874 r60914  
    132132    var width = 32;
    133133    var height = 32;
    134     buf = gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE);
     134    buf = new Uint8Array(width * height * 4);
     135    gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, buf);
    135136    // Check a few pixels near the top and bottom and make sure they have
    136137    // the right color.
  • trunk/LayoutTests/fast/canvas/webgl/tex-sub-image-2d.html

    r55282 r60914  
    9898
    9999// Read back the frame buffer
    100 var buf = gl.readPixels(0, 0, textureWidth, textureHeight, gl.RGBA, gl.UNSIGNED_BYTE);
     100var buf = new Uint8Array(textureWidth * textureHeight * 4);
     101gl.readPixels(0, 0, textureWidth, textureHeight, gl.RGBA, gl.UNSIGNED_BYTE, buf);
    101102
    102103// Verify the frame buffer's contents
  • trunk/LayoutTests/fast/canvas/webgl/texImage2DImageDataTest.html

    r55282 r60914  
    107107            // Test several locations
    108108            // Each line should be all red
    109             var buf = gl.readPixels(0, 0, 64, 64, gl.RGBA, gl.UNSIGNED_BYTE);
     109            var buf = new Uint8Array(64 * 64 * 4);
     110            gl.readPixels(0, 0, 64, 64, gl.RGBA, gl.UNSIGNED_BYTE, buf);
    110111           
    111112            var offset15 = 3840; // (15*64) * 4
  • trunk/LayoutTests/fast/canvas/webgl/texture-npot.html

    r59899 r60914  
    128128              gl.drawArrays(gl.TRIANGLES, 0, 6);
    129129              gl.flush();
    130               var buf = gl.readPixels(0, 0, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE);
     130              var buf = new Uint8Array(4 * 4 * 4);
     131              gl.readPixels(0, 0, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE, buf);
    131132              for (var i = 0; i < 4 * 4; ++i) {
    132133                var offset = i * 4;
  • trunk/LayoutTests/fast/canvas/webgl/triangle.html

    r55282 r60914  
    5050            gl.drawArrays(gl.TRIANGLES, 0, 3);
    5151           
    52             var buf = gl.readPixels(0, 0, 50, 50, gl.RGBA, gl.UNSIGNED_BYTE);
     52            var buf = new Uint8Array(50 * 50 * 4);
     53            gl.readPixels(0, 0, 50, 50, gl.RGBA, gl.UNSIGNED_BYTE, buf);
    5354           
    5455            // Test several locations
  • trunk/LayoutTests/fast/canvas/webgl/viewport-unchanged-upon-resize.html

    r55282 r60914  
    5454
    5555// Ensure that the frame buffer is red at the sampled pixel
    56 var buf = gl.readPixels(2, 2, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE);
     56var buf = new Uint8Array(1 * 1 * 4);
     57gl.readPixels(2, 2, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, buf);
    5758var passed = true;
    5859if (buf[0] != 255 ||
     
    7677  // still be (0, 0, 4, 4), so only the lower-left quadrant should
    7778  // have been filled.
    78   var buf = gl.readPixels(6, 6, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE);
     79  var buf = new Uint8Array(1 * 1 * 4);
     80  gl.readPixels(6, 6, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, buf);
    7981  var passed = true;
    8082  if (buf[0] != 0 ||
  • trunk/WebCore/ChangeLog

    r60911 r60914  
     12010-06-09  Kenneth Russell  <kbr@google.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        Update readPixels to take ArrayBufferView rather than returning it
     6        https://bugs.webkit.org/show_bug.cgi?id=40322
     7
     8        No new tests; covered by existing tests, which have been modified.
     9
     10        * html/canvas/WebGLRenderingContext.cpp:
     11        (WebCore::WebGLRenderingContext::readPixels):
     12        * html/canvas/WebGLRenderingContext.h:
     13        * html/canvas/WebGLRenderingContext.idl:
     14
    1152010-06-09  Enrico Ros  <eros@codeaurora.org>
    216
  • trunk/WebCore/html/canvas/WebGLRenderingContext.cpp

    r60902 r60914  
    16651665}
    16661666
    1667 PassRefPtr<ArrayBufferView> WebGLRenderingContext::readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type)
     1667void WebGLRenderingContext::readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type, ArrayBufferView* pixels)
    16681668{
    16691669    // Validate enums.
     
    16811681    default:
    16821682        m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
    1683         return 0;
     1683        return;
    16841684    }
    16851685    unsigned long bytesPerComponent = 0;
     
    16961696    default:
    16971697        m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
    1698         return 0;
     1698        return;
     1699    }
     1700    if (!pixels) {
     1701        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
     1702        return;
    16991703    }
    17001704    if (!((format == GraphicsContext3D::RGBA && type == GraphicsContext3D::UNSIGNED_BYTE) || (format == m_implementationColorReadFormat && type == m_implementationColorReadType))) {
    17011705        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
    1702         return 0;
     1706        return;
     1707    }
     1708    // Validate array type against pixel type.
     1709    if (type == GraphicsContext3D::UNSIGNED_BYTE && !pixels->isUnsignedByteArray()
     1710        || type != GraphicsContext3D::UNSIGNED_BYTE && !pixels->isUnsignedShortArray()) {
     1711        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
     1712        return;
    17031713    }
    17041714    // Calculate array size, taking into consideration of PACK_ALIGNMENT.
     
    17131723    unsigned long totalBytes = bytesPerRow * height - padding;
    17141724    unsigned long num = totalBytes / bytesPerComponent;
    1715     RefPtr<ArrayBufferView> array;
    1716     if (type == GraphicsContext3D::UNSIGNED_BYTE)
    1717         array = Uint8Array::create(num);
    1718     else
    1719         array = Uint16Array::create(num);
    1720     void* data = array->baseAddress();
     1725    if (pixels->length() < num) {
     1726        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
     1727        return;
     1728    }
     1729    void* data = pixels->baseAddress();
    17211730    m_context->readPixels(x, y, width, height, format, type, data);
    17221731#if PLATFORM(CG)
     
    17381747#endif
    17391748    cleanupAfterGraphicsCall(false);
    1740     return array;
    17411749}
    17421750
  • trunk/WebCore/html/canvas/WebGLRenderingContext.h

    r60902 r60914  
    183183        void polygonOffset(double factor, double units);
    184184       
    185         PassRefPtr<ArrayBufferView> readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type);
     185        void readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type, ArrayBufferView* pixels);
    186186       
    187187        void releaseShaderCompiler();
  • trunk/WebCore/html/canvas/WebGLRenderingContext.idl

    r60902 r60914  
    596596        void         polygonOffset(in double factor, in double units);
    597597
    598         ArrayBufferView readPixels(in long x, in long y, in unsigned long width, in unsigned long height, in unsigned long format, in unsigned long type);
     598        void         readPixels(in long x, in long y, in unsigned long width, in unsigned long height, in unsigned long format, in unsigned long type, in ArrayBufferView pixels);
    599599       
    600600        void         releaseShaderCompiler();
Note: See TracChangeset for help on using the changeset viewer.