1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef CANVASIMAGECACHE_H_
7 #define CANVASIMAGECACHE_H_
9 #include "mozilla/RefPtr.h"
15 class HTMLCanvasElement
;
21 } // namespace mozilla
26 class CanvasImageCache
{
27 using SourceSurface
= mozilla::gfx::SourceSurface
;
31 * Notify that image element aImage was drawn to aCanvas element
32 * using the first frame of aRequest's image. The data for the surface is
33 * in aSurface, and the image size is in aSize. aIntrinsicSize is the size
34 * the surface is intended to be rendered at.
36 static void NotifyDrawImage(dom::Element
* aImage
,
37 dom::HTMLCanvasElement
* aCanvas
,
38 gfx::DrawTarget
* aTarget
, SourceSurface
* aSource
,
39 const gfx::IntSize
& aSize
,
40 const gfx::IntSize
& aIntrinsicSize
);
43 * Check whether aImage has recently been drawn any canvas. If we return
44 * a non-null surface, then the same image was recently drawn into a canvas.
46 static SourceSurface
* LookupAllCanvas(dom::Element
* aImage
,
47 gfx::DrawTarget
* aTarget
);
50 * Like the top above, but restricts the lookup to only aCanvas. This is
51 * required for CORS security.
53 static SourceSurface
* LookupCanvas(dom::Element
* aImage
,
54 dom::HTMLCanvasElement
* aCanvas
,
55 gfx::DrawTarget
* aTarget
,
56 gfx::IntSize
* aSizeOut
,
57 gfx::IntSize
* aIntrinsicSizeOut
);
60 } // namespace mozilla
62 #endif /* CANVASIMAGECACHE_H_ */