Bug 1700051: part 26) Correct typo in comment of `mozInlineSpellWordUtil::BuildSoftTe...
[gecko.git] / dom / canvas / CanvasImageCache.h
blobeb619abcaffdca228bd6a45645c9dc5f1d12bce8
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"
10 #include "nsSize.h"
12 namespace mozilla {
13 namespace dom {
14 class Element;
15 class HTMLCanvasElement;
16 } // namespace dom
17 namespace gfx {
18 class SourceSurface;
19 } // namespace gfx
20 } // namespace mozilla
21 class imgIContainer;
23 namespace mozilla {
25 class CanvasImageCache {
26 typedef mozilla::gfx::SourceSurface SourceSurface;
28 public:
29 /**
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);
40 /**
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);
46 /**
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_ */