content/canvas/src/CanvasImageCache.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/canvas/src/CanvasImageCache.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef CANVASIMAGECACHE_H_
    1.10 +#define CANVASIMAGECACHE_H_
    1.11 +
    1.12 +#include "nsSize.h"
    1.13 +
    1.14 +namespace mozilla {
    1.15 +namespace dom {
    1.16 +class Element;
    1.17 +class HTMLCanvasElement;
    1.18 +} // namespace dom
    1.19 +namespace gfx {
    1.20 +class SourceSurface;
    1.21 +} // namespace gfx
    1.22 +} // namespace mozilla
    1.23 +class imgIRequest;
    1.24 +
    1.25 +namespace mozilla {
    1.26 +
    1.27 +class CanvasImageCache {
    1.28 +  typedef mozilla::gfx::SourceSurface SourceSurface;
    1.29 +public:
    1.30 +  /**
    1.31 +   * Notify that image element aImage was (or is about to be) drawn to aCanvas
    1.32 +   * using the first frame of aRequest's image. The data for the surface is
    1.33 +   * in aSurface, and the image size is in aSize.
    1.34 +   */
    1.35 +  static void NotifyDrawImage(dom::Element* aImage,
    1.36 +                              dom::HTMLCanvasElement* aCanvas,
    1.37 +                              imgIRequest* aRequest,
    1.38 +                              SourceSurface* aSource,
    1.39 +                              const gfxIntSize& aSize);
    1.40 +
    1.41 +  /**
    1.42 +   * Check whether aImage has recently been drawn into aCanvas. If we return
    1.43 +   * a non-null surface, then the image was recently drawn into the canvas
    1.44 +   * (with the same image request) and the returned surface contains the image
    1.45 +   * data, and the image size will be returned in aSize.
    1.46 +   */
    1.47 +  static SourceSurface* Lookup(dom::Element* aImage,
    1.48 +                               dom::HTMLCanvasElement* aCanvas,
    1.49 +                               gfxIntSize* aSize);
    1.50 +};
    1.51 +
    1.52 +}
    1.53 +
    1.54 +#endif /* CANVASIMAGECACHE_H_ */

mercurial