tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

PrintTargetThebes.h (1709B)


      1 /* -*- Mode: C++; tab-width: 20; 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 MOZILLA_GFX_PRINTTARGETTHEBES_H
      7 #define MOZILLA_GFX_PRINTTARGETTHEBES_H
      8 
      9 #include "mozilla/gfx/PrintTarget.h"
     10 
     11 class gfxASurface;
     12 
     13 namespace mozilla {
     14 namespace gfx {
     15 
     16 /**
     17 * XXX Remove this class.
     18 *
     19 * This class should go away once all the logic from the gfxASurface subclasses
     20 * has been moved to new PrintTarget subclasses and we no longer need to
     21 * wrap a gfxASurface.
     22 *
     23 * When removing this class, be sure to make PrintTarget::MakeDrawTarget
     24 * non-virtual!
     25 */
     26 class PrintTargetThebes final : public PrintTarget {
     27 public:
     28  static already_AddRefed<PrintTargetThebes> CreateOrNull(
     29      gfxASurface* aSurface);
     30 
     31  nsresult BeginPrinting(const nsAString& aTitle,
     32                         const nsAString& aPrintToFileName, int32_t aStartPage,
     33                         int32_t aEndPage) override;
     34  nsresult EndPrinting() override;
     35  nsresult AbortPrinting() override;
     36  nsresult BeginPage(const IntSize& aSizeInPoints) override;
     37  nsresult EndPage() override;
     38  void Finish() override;
     39 
     40  already_AddRefed<DrawTarget> MakeDrawTarget(
     41      const IntSize& aSize, DrawEventRecorder* aRecorder = nullptr) override;
     42 
     43  already_AddRefed<DrawTarget> GetReferenceDrawTarget() final;
     44 
     45 private:
     46  // Only created via CreateOrNull
     47  explicit PrintTargetThebes(gfxASurface* aSurface);
     48 
     49  RefPtr<gfxASurface> mGfxSurface;
     50 };
     51 
     52 }  // namespace gfx
     53 }  // namespace mozilla
     54 
     55 #endif /* MOZILLA_GFX_PRINTTARGETTHEBES_H */