Changeset 256505 in webkit


Ignore:
Timestamp:
Feb 13, 2020 7:51:50 AM (4 years ago)
Author:
commit-queue@webkit.org
Message:

Implement OffscreenCanvas.copiedImage
https://bugs.webkit.org/show_bug.cgi?id=206220

Patch by Chris Lord <Chris Lord> on 2020-02-13
Reviewed by Žan Doberšek.

Source/WebCore:

No new tests. Covered by existing tests.

  • html/OffscreenCanvas.cpp:

(WebCore::OffscreenCanvas::didDraw):
(WebCore::OffscreenCanvas::copiedImage const):
(WebCore::OffscreenCanvas::clearCopiedImage const):
(WebCore::OffscreenCanvas::takeImageBuffer const):
(WebCore::OffscreenCanvas::reset):

  • html/OffscreenCanvas.h:

LayoutTests:

  • platform/gtk/TestExpectations:
  • platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt:
  • platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-flipY-expected.txt:
  • platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt:
  • platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-serializable-expected.txt:
  • platform/wpe/TestExpectations:
  • platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt:
  • platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-flipY-expected.txt:
  • platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt:
  • platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-serializable-expected.txt:
  • platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-transfer-expected.txt:
Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r256504 r256505  
     12020-02-13  Chris Lord  <clord@igalia.com>
     2
     3        Implement OffscreenCanvas.copiedImage
     4        https://bugs.webkit.org/show_bug.cgi?id=206220
     5
     6        Reviewed by Žan Doberšek.
     7
     8        * platform/gtk/TestExpectations:
     9        * platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt:
     10        * platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-flipY-expected.txt:
     11        * platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt:
     12        * platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-serializable-expected.txt:
     13        * platform/wpe/TestExpectations:
     14        * platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt:
     15        * platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-flipY-expected.txt:
     16        * platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt:
     17        * platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-serializable-expected.txt:
     18        * platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-transfer-expected.txt:
     19
    1202020-02-13  Diego Pino Garcia  <dpino@igalia.com>
    221
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r256504 r256505  
    41284128webkit.org/b/206264 imported/w3c/web-platform-tests/css/css-multicol/multicol-gap-percentage-001.html [ Failure ]
    41294129
    4130 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/compositing/2d.composite.globalAlpha.canvaspattern.html [ Failure ]
    4131 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/compositing/2d.composite.globalAlpha.canvaspattern.worker.html [ Failure ]
    4132 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.basic.canvas.html [ Failure ]
    4133 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.basic.canvas.worker.html [ Failure ]
    4134 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.basic.nocontext.html [ Failure ]
    4135 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.basic.nocontext.worker.html [ Failure ]
    4136 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.modify.canvas1.html [ Failure ]
    4137 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.modify.canvas1.worker.html [ Failure ]
    4138 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.modify.canvas2.html [ Failure ]
    4139 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.modify.canvas2.worker.html [ Failure ]
    4140 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.paint.orientation.canvas.html [ Failure ]
    4141 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.paint.orientation.canvas.worker.html [ Failure ]
    4142 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.repeat.null.html [ Failure ]
    4143 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.repeat.null.worker.html [ Failure ]
    4144 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/image-smoothing/image.smoothing.html [ Failure ]
    4145 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/image-smoothing/image.smoothing.worker.html [ Failure ]
    4146 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/the-offscreen-canvas/initial.reset.pattern.html [ Failure ]
    4147 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/the-offscreen-canvas/initial.reset.pattern.worker.html [ Failure ]
     4130webkit.org/b/207016 http/tests/misc/form-submit-file-cross-site-redirect.html [ Failure ]
    41484131
    41494132webkit.org/b/206692 fast/canvas/canvas-fillPath-shadow.html [ Failure ]
  • trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt

    r254513 r256505  
    3535FAIL createImageBitmap from a vector SVGImageElement resized, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
    3636FAIL createImageBitmap from a vector SVGImageElement with negative sw/sh, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
    37 FAIL createImageBitmap from an OffscreenCanvas, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
    38 FAIL createImageBitmap from an OffscreenCanvas scaled down, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
    39 FAIL createImageBitmap from an OffscreenCanvas scaled up, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
    40 FAIL createImageBitmap from an OffscreenCanvas resized, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
    41 FAIL createImageBitmap from an OffscreenCanvas with negative sw/sh, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
     37PASS createImageBitmap from an OffscreenCanvas, and drawImage on the created ImageBitmap
     38PASS createImageBitmap from an OffscreenCanvas scaled down, and drawImage on the created ImageBitmap
     39PASS createImageBitmap from an OffscreenCanvas scaled up, and drawImage on the created ImageBitmap
     40PASS createImageBitmap from an OffscreenCanvas resized, and drawImage on the created ImageBitmap
     41PASS createImageBitmap from an OffscreenCanvas with negative sw/sh, and drawImage on the created ImageBitmap
    4242FAIL createImageBitmap from an ImageData, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
    4343FAIL createImageBitmap from an ImageData scaled down, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
  • trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-flipY-expected.txt

    r254513 r256505  
    1414FAIL createImageBitmap from a vector SVGImageElement imageOrientation: "none", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
    1515FAIL createImageBitmap from a vector SVGImageElement imageOrientation: "flipY", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
    16 FAIL createImageBitmap from an OffscreenCanvas imageOrientation: "none", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
    17 FAIL createImageBitmap from an OffscreenCanvas imageOrientation: "flipY", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
     16PASS createImageBitmap from an OffscreenCanvas imageOrientation: "none", and drawImage on the created ImageBitmap
     17FAIL createImageBitmap from an OffscreenCanvas imageOrientation: "flipY", and drawImage on the created ImageBitmap assert_approx_equals: Red channel of the pixel at (5, 15) expected 255 +/- 10 but got 0
    1818FAIL createImageBitmap from an ImageData imageOrientation: "none", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
    1919FAIL createImageBitmap from an ImageData imageOrientation: "flipY", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
  • trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt

    r254513 r256505  
    3232PASS createImageBitmap with an OffscreenCanvas source and sw set to 0
    3333PASS createImageBitmap with an OffscreenCanvas source and sh set to 0
    34 PASS createImageBitmap with an OffscreenCanvas source and oversized (unallocatable) crop region
     34FAIL createImageBitmap with an OffscreenCanvas source and oversized (unallocatable) crop region assert_equals: expected 100000000 but got 20
    3535PASS createImageBitmap with an ImageData source and sw set to 0
    3636PASS createImageBitmap with an ImageData source and sh set to 0
  • trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-serializable-expected.txt

    r254399 r256505  
    77FAIL Serialize ImageBitmap created from a bitmap SVGImageElement promise_test: Unhandled rejection with value: object "TypeError: Type error"
    88FAIL Serialize ImageBitmap created from a vector SVGImageElement promise_test: Unhandled rejection with value: object "TypeError: Type error"
    9 FAIL Serialize ImageBitmap created from an OffscreenCanvas promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
     9PASS Serialize ImageBitmap created from an OffscreenCanvas
    1010FAIL Serialize ImageBitmap created from an ImageData promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
    1111PASS Serialize ImageBitmap created from an ImageBitmap
  • trunk/LayoutTests/platform/wpe/TestExpectations

    r256502 r256505  
    22162216webkit.org/b/203677 svg/W3C-SVG-1.1/painting-fill-05-b.svg [ Failure ]
    22172217
    2218 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/compositing/2d.composite.globalAlpha.canvaspattern.html [ Failure ]
    2219 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/compositing/2d.composite.globalAlpha.canvaspattern.worker.html [ Failure ]
    2220 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/convert-to-blob/offscreencanvas.convert.to.blob.w.html [ Failure ]
    2221 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.basic.canvas.html [ Failure ]
    2222 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.basic.canvas.worker.html [ Failure ]
    2223 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.basic.nocontext.html [ Failure ]
    2224 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.basic.nocontext.worker.html [ Failure ]
    2225 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.modify.canvas1.html [ Failure ]
    2226 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.modify.canvas1.worker.html [ Failure ]
    2227 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.modify.canvas2.html [ Failure ]
    2228 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.modify.canvas2.worker.html [ Failure ]
    2229 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.paint.orientation.canvas.html [ Failure ]
    2230 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.paint.orientation.canvas.worker.html [ Failure ]
    2231 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.repeat.null.html [ Failure ]
    2232 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/fill-and-stroke-styles/2d.pattern.repeat.null.worker.html [ Failure ]
    2233 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/image-smoothing/image.smoothing.html [ Failure ]
    2234 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/image-smoothing/image.smoothing.worker.html [ Failure ]
    2235 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/the-offscreen-canvas/initial.reset.pattern.html [ Failure ]
    2236 webkit.org/b/204675 imported/w3c/web-platform-tests/offscreen-canvas/the-offscreen-canvas/initial.reset.pattern.worker.html [ Failure ]
    2237 
    22382218webkit.org/b/194933 http/tests/cookies/same-site/user-load-cross-site-redirect.php [ Failure ]
    22392219
  • trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage-expected.txt

    r254513 r256505  
    3535FAIL createImageBitmap from a vector SVGImageElement resized, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
    3636FAIL createImageBitmap from a vector SVGImageElement with negative sw/sh, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
    37 FAIL createImageBitmap from an OffscreenCanvas, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
    38 FAIL createImageBitmap from an OffscreenCanvas scaled down, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
    39 FAIL createImageBitmap from an OffscreenCanvas scaled up, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
    40 FAIL createImageBitmap from an OffscreenCanvas resized, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
    41 FAIL createImageBitmap from an OffscreenCanvas with negative sw/sh, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
     37PASS createImageBitmap from an OffscreenCanvas, and drawImage on the created ImageBitmap
     38PASS createImageBitmap from an OffscreenCanvas scaled down, and drawImage on the created ImageBitmap
     39PASS createImageBitmap from an OffscreenCanvas scaled up, and drawImage on the created ImageBitmap
     40PASS createImageBitmap from an OffscreenCanvas resized, and drawImage on the created ImageBitmap
     41PASS createImageBitmap from an OffscreenCanvas with negative sw/sh, and drawImage on the created ImageBitmap
    4242FAIL createImageBitmap from an ImageData, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
    4343FAIL createImageBitmap from an ImageData scaled down, and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
  • trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-flipY-expected.txt

    r254513 r256505  
    1414FAIL createImageBitmap from a vector SVGImageElement imageOrientation: "none", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
    1515FAIL createImageBitmap from a vector SVGImageElement imageOrientation: "flipY", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error"
    16 FAIL createImageBitmap from an OffscreenCanvas imageOrientation: "none", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
    17 FAIL createImageBitmap from an OffscreenCanvas imageOrientation: "flipY", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
     16PASS createImageBitmap from an OffscreenCanvas imageOrientation: "none", and drawImage on the created ImageBitmap
     17FAIL createImageBitmap from an OffscreenCanvas imageOrientation: "flipY", and drawImage on the created ImageBitmap assert_approx_equals: Red channel of the pixel at (5, 15) expected 255 +/- 10 but got 0
    1818FAIL createImageBitmap from an ImageData imageOrientation: "none", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
    1919FAIL createImageBitmap from an ImageData imageOrientation: "flipY", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
  • trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt

    r254513 r256505  
    3232PASS createImageBitmap with an OffscreenCanvas source and sw set to 0
    3333PASS createImageBitmap with an OffscreenCanvas source and sh set to 0
    34 PASS createImageBitmap with an OffscreenCanvas source and oversized (unallocatable) crop region
     34FAIL createImageBitmap with an OffscreenCanvas source and oversized (unallocatable) crop region assert_equals: expected 100000000 but got 20
    3535PASS createImageBitmap with an ImageData source and sw set to 0
    3636PASS createImageBitmap with an ImageData source and sh set to 0
  • trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-serializable-expected.txt

    r254399 r256505  
    77FAIL Serialize ImageBitmap created from a bitmap SVGImageElement promise_test: Unhandled rejection with value: object "TypeError: Type error"
    88FAIL Serialize ImageBitmap created from a vector SVGImageElement promise_test: Unhandled rejection with value: object "TypeError: Type error"
    9 FAIL Serialize ImageBitmap created from an OffscreenCanvas promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
     9PASS Serialize ImageBitmap created from an OffscreenCanvas
    1010FAIL Serialize ImageBitmap created from an ImageData promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
    1111PASS Serialize ImageBitmap created from an ImageBitmap
  • trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-transfer-expected.txt

    r254399 r256505  
    77FAIL Transfer ImageBitmap created from a bitmap SVGImageElement promise_test: Unhandled rejection with value: object "TypeError: Type error"
    88FAIL Transfer ImageBitmap created from a vector SVGImageElement promise_test: Unhandled rejection with value: object "TypeError: Type error"
    9 FAIL Transfer ImageBitmap created from an OffscreenCanvas promise_test: Unhandled rejection with value: object "InvalidStateError: Cannot create ImageBitmap from canvas that can't be rendered"
     9PASS Transfer ImageBitmap created from an OffscreenCanvas
    1010FAIL Transfer ImageBitmap created from an ImageData promise_test: Unhandled rejection with value: object "TypeError: createImageBitmap with ImageData is not implemented"
    1111PASS Transfer ImageBitmap created from an ImageBitmap
  • trunk/Source/WebCore/ChangeLog

    r256503 r256505  
     12020-02-13  Chris Lord  <clord@igalia.com>
     2
     3        Implement OffscreenCanvas.copiedImage
     4        https://bugs.webkit.org/show_bug.cgi?id=206220
     5
     6        Reviewed by Žan Doberšek.
     7
     8        No new tests. Covered by existing tests.
     9
     10        * html/OffscreenCanvas.cpp:
     11        (WebCore::OffscreenCanvas::didDraw):
     12        (WebCore::OffscreenCanvas::copiedImage const):
     13        (WebCore::OffscreenCanvas::clearCopiedImage const):
     14        (WebCore::OffscreenCanvas::takeImageBuffer const):
     15        (WebCore::OffscreenCanvas::reset):
     16        * html/OffscreenCanvas.h:
     17
    1182020-02-12  Yoshiaki Jitsukawa  <yoshiaki.jitsukawa@sony.com>
    219
  • trunk/Source/WebCore/html/OffscreenCanvas.cpp

    r255315 r256505  
    258258void OffscreenCanvas::didDraw(const FloatRect& rect)
    259259{
     260    clearCopiedImage();
    260261    notifyObserversCanvasChanged(rect);
     262}
     263
     264Image* OffscreenCanvas::copiedImage() const
     265{
     266    if (m_detached)
     267        return nullptr;
     268
     269    if (!m_copiedImage && buffer()) {
     270        if (m_context)
     271            m_context->paintRenderingResultsToCanvas();
     272        m_copiedImage = buffer()->copyImage(CopyBackingStore, PreserveResolution::Yes);
     273    }
     274    return m_copiedImage.get();
     275}
     276
     277void OffscreenCanvas::clearCopiedImage() const
     278{
     279    m_copiedImage = nullptr;
    261280}
    262281
     
    317336        return nullptr;
    318337
     338    clearCopiedImage();
    319339    return setImageBuffer(m_detached ? nullptr : ImageBuffer::create(size(), RenderingMode::Unaccelerated));
    320340}
     
    328348    m_hasCreatedImageBuffer = false;
    329349    setImageBuffer(nullptr);
     350    clearCopiedImage();
    330351
    331352    notifyObserversCanvasResized();
  • trunk/Source/WebCore/html/OffscreenCanvas.h

    r255315 r256505  
    104104    void didDraw(const FloatRect&) final;
    105105
    106     Image* copiedImage() const final { return nullptr; }
     106    Image* copiedImage() const final;
    107107    bool hasCreatedImageBuffer() const final { return m_hasCreatedImageBuffer; }
    108108
     
    139139    void reset();
    140140
     141    void clearCopiedImage() const;
     142
    141143    std::unique_ptr<CanvasRenderingContext> m_context;
    142144
     
    145147
    146148    bool m_detached { false };
     149
     150    mutable RefPtr<Image> m_copiedImage;
    147151};
    148152
Note: See TracChangeset for help on using the changeset viewer.