tor-browser

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

PrintTargetCG.h (1616B)


      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_PRINTTARGETCG_H
      7 #define MOZILLA_GFX_PRINTTARGETCG_H
      8 
      9 #include <Carbon/Carbon.h>
     10 #include "PrintTarget.h"
     11 
     12 class nsIOutputStream;
     13 
     14 namespace mozilla::gfx {
     15 
     16 /**
     17 * CoreGraphics printing target.
     18 */
     19 class PrintTargetCG final : public PrintTarget {
     20 public:
     21  static already_AddRefed<PrintTargetCG> CreateOrNull(
     22      nsIOutputStream* aOutputStream, PMPrintSession aPrintSession,
     23      PMPageFormat aPageFormat, PMPrintSettings aPrintSettings,
     24      const IntSize& aSize);
     25 
     26  nsresult BeginPrinting(const nsAString& aTitle,
     27                         const nsAString& aPrintToFileName, int32_t aStartPage,
     28                         int32_t aEndPage) final;
     29  nsresult EndPrinting() final;
     30  nsresult AbortPrinting() final;
     31  nsresult BeginPage(const IntSize& aSizeInPoints) final;
     32  nsresult EndPage() final;
     33 
     34  already_AddRefed<DrawTarget> GetReferenceDrawTarget() final;
     35 
     36 private:
     37  PrintTargetCG(CGContextRef aPrintToStreamContext,
     38                PMPrintSession aPrintSession, PMPageFormat aPageFormat,
     39                PMPrintSettings aPrintSettings, const IntSize& aSize);
     40  ~PrintTargetCG();
     41 
     42  CGContextRef mPrintToStreamContext = nullptr;
     43  PMPrintSession mPrintSession;
     44  PMPageFormat mPageFormat;
     45  PMPrintSettings mPrintSettings;
     46 };
     47 
     48 }  // namespace mozilla::gfx
     49 
     50 #endif /* MOZILLA_GFX_PRINTTARGETCG_H */