Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef CANVASIMAGECACHE_H_ |
michael@0 | 7 | #define CANVASIMAGECACHE_H_ |
michael@0 | 8 | |
michael@0 | 9 | #include "nsSize.h" |
michael@0 | 10 | |
michael@0 | 11 | namespace mozilla { |
michael@0 | 12 | namespace dom { |
michael@0 | 13 | class Element; |
michael@0 | 14 | class HTMLCanvasElement; |
michael@0 | 15 | } // namespace dom |
michael@0 | 16 | namespace gfx { |
michael@0 | 17 | class SourceSurface; |
michael@0 | 18 | } // namespace gfx |
michael@0 | 19 | } // namespace mozilla |
michael@0 | 20 | class imgIRequest; |
michael@0 | 21 | |
michael@0 | 22 | namespace mozilla { |
michael@0 | 23 | |
michael@0 | 24 | class CanvasImageCache { |
michael@0 | 25 | typedef mozilla::gfx::SourceSurface SourceSurface; |
michael@0 | 26 | public: |
michael@0 | 27 | /** |
michael@0 | 28 | * Notify that image element aImage was (or is about to be) drawn to aCanvas |
michael@0 | 29 | * using the first frame of aRequest's image. The data for the surface is |
michael@0 | 30 | * in aSurface, and the image size is in aSize. |
michael@0 | 31 | */ |
michael@0 | 32 | static void NotifyDrawImage(dom::Element* aImage, |
michael@0 | 33 | dom::HTMLCanvasElement* aCanvas, |
michael@0 | 34 | imgIRequest* aRequest, |
michael@0 | 35 | SourceSurface* aSource, |
michael@0 | 36 | const gfxIntSize& aSize); |
michael@0 | 37 | |
michael@0 | 38 | /** |
michael@0 | 39 | * Check whether aImage has recently been drawn into aCanvas. If we return |
michael@0 | 40 | * a non-null surface, then the image was recently drawn into the canvas |
michael@0 | 41 | * (with the same image request) and the returned surface contains the image |
michael@0 | 42 | * data, and the image size will be returned in aSize. |
michael@0 | 43 | */ |
michael@0 | 44 | static SourceSurface* Lookup(dom::Element* aImage, |
michael@0 | 45 | dom::HTMLCanvasElement* aCanvas, |
michael@0 | 46 | gfxIntSize* aSize); |
michael@0 | 47 | }; |
michael@0 | 48 | |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | #endif /* CANVASIMAGECACHE_H_ */ |