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
;
20 } // namespace mozilla
25 class CanvasImageCache
{
26 typedef mozilla::gfx::SourceSurface SourceSurface
;
30 * Notify that image element aImage was drawn to aCanvas element
31 * using the first frame of aRequest's image. The data for the surface is
32 * in aSurface, and the image size is in aSize. aIntrinsicSize is the size
33 * the surface is intended to be rendered at.
35 static void NotifyDrawImage(dom::Element
* aImage
,
36 dom::HTMLCanvasElement
* aCanvas
,
37 SourceSurface
* aSource
, const gfx::IntSize
& aSize
,
38 const gfx::IntSize
& aIntrinsicSize
);
41 * Check whether aImage has recently been drawn any canvas. If we return
42 * a non-null surface, then the same image was recently drawn into a canvas.
44 static SourceSurface
* LookupAllCanvas(dom::Element
* aImage
);
47 * Like the top above, but restricts the lookup to only aCanvas. This is
48 * required for CORS security.
50 static SourceSurface
* LookupCanvas(dom::Element
* aImage
,
51 dom::HTMLCanvasElement
* aCanvas
,
52 gfx::IntSize
* aSizeOut
,
53 gfx::IntSize
* aIntrinsicSizeOut
);
56 } // namespace mozilla
58 #endif /* CANVASIMAGECACHE_H_ */