|
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/. */ |
|
5 |
|
6 #ifndef CANVASIMAGECACHE_H_ |
|
7 #define CANVASIMAGECACHE_H_ |
|
8 |
|
9 #include "nsSize.h" |
|
10 |
|
11 namespace mozilla { |
|
12 namespace dom { |
|
13 class Element; |
|
14 class HTMLCanvasElement; |
|
15 } // namespace dom |
|
16 namespace gfx { |
|
17 class SourceSurface; |
|
18 } // namespace gfx |
|
19 } // namespace mozilla |
|
20 class imgIRequest; |
|
21 |
|
22 namespace mozilla { |
|
23 |
|
24 class CanvasImageCache { |
|
25 typedef mozilla::gfx::SourceSurface SourceSurface; |
|
26 public: |
|
27 /** |
|
28 * Notify that image element aImage was (or is about to be) drawn to aCanvas |
|
29 * using the first frame of aRequest's image. The data for the surface is |
|
30 * in aSurface, and the image size is in aSize. |
|
31 */ |
|
32 static void NotifyDrawImage(dom::Element* aImage, |
|
33 dom::HTMLCanvasElement* aCanvas, |
|
34 imgIRequest* aRequest, |
|
35 SourceSurface* aSource, |
|
36 const gfxIntSize& aSize); |
|
37 |
|
38 /** |
|
39 * Check whether aImage has recently been drawn into aCanvas. If we return |
|
40 * a non-null surface, then the image was recently drawn into the canvas |
|
41 * (with the same image request) and the returned surface contains the image |
|
42 * data, and the image size will be returned in aSize. |
|
43 */ |
|
44 static SourceSurface* Lookup(dom::Element* aImage, |
|
45 dom::HTMLCanvasElement* aCanvas, |
|
46 gfxIntSize* aSize); |
|
47 }; |
|
48 |
|
49 } |
|
50 |
|
51 #endif /* CANVASIMAGECACHE_H_ */ |