michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef CANVASIMAGECACHE_H_ michael@0: #define CANVASIMAGECACHE_H_ michael@0: michael@0: #include "nsSize.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: class Element; michael@0: class HTMLCanvasElement; michael@0: } // namespace dom michael@0: namespace gfx { michael@0: class SourceSurface; michael@0: } // namespace gfx michael@0: } // namespace mozilla michael@0: class imgIRequest; michael@0: michael@0: namespace mozilla { michael@0: michael@0: class CanvasImageCache { michael@0: typedef mozilla::gfx::SourceSurface SourceSurface; michael@0: public: michael@0: /** michael@0: * Notify that image element aImage was (or is about to be) drawn to aCanvas michael@0: * using the first frame of aRequest's image. The data for the surface is michael@0: * in aSurface, and the image size is in aSize. michael@0: */ michael@0: static void NotifyDrawImage(dom::Element* aImage, michael@0: dom::HTMLCanvasElement* aCanvas, michael@0: imgIRequest* aRequest, michael@0: SourceSurface* aSource, michael@0: const gfxIntSize& aSize); michael@0: michael@0: /** michael@0: * Check whether aImage has recently been drawn into aCanvas. If we return michael@0: * a non-null surface, then the image was recently drawn into the canvas michael@0: * (with the same image request) and the returned surface contains the image michael@0: * data, and the image size will be returned in aSize. michael@0: */ michael@0: static SourceSurface* Lookup(dom::Element* aImage, michael@0: dom::HTMLCanvasElement* aCanvas, michael@0: gfxIntSize* aSize); michael@0: }; michael@0: michael@0: } michael@0: michael@0: #endif /* CANVASIMAGECACHE_H_ */