Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2434)

Unified Diff: core/fxge/win32/cpsoutput.cpp

Issue 2615703002: Revert postscript code removal. (Closed)
Patch Set: Move files, remove extra class, remove non const refs Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fxge/win32/cpsoutput.h ('k') | core/fxge/win32/fx_win32_print.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxge/win32/cpsoutput.cpp
diff --git a/core/fxge/win32/cpsoutput.cpp b/core/fxge/win32/cpsoutput.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..61dcc918183f0affe12ae7f0627f4a8e0f5ad68e
--- /dev/null
+++ b/core/fxge/win32/cpsoutput.cpp
@@ -0,0 +1,40 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxge/win32/cpsoutput.h"
+
+#include <algorithm>
+
+#include "core/fxcrt/fx_system.h"
+
+CPSOutput::CPSOutput(HDC hDC) {
+ m_hDC = hDC;
+}
+
+CPSOutput::~CPSOutput() {}
+
+void CPSOutput::Release() {
+ delete this;
+}
+
+void CPSOutput::OutputPS(const FX_CHAR* str, int len) {
+ if (len < 0)
+ len = static_cast<int>(FXSYS_strlen(str));
+
+ int sent_len = 0;
+ while (len > 0) {
+ FX_CHAR buffer[1026];
+ int send_len = std::min(len, 1024);
+ *(reinterpret_cast<uint16_t*>(buffer)) = send_len;
+ FXSYS_memcpy(buffer + 2, str + sent_len, send_len);
+
+ // TODO(thestig/rbpotter): Do PASSTHROUGH for non-Chromium usage.
+ // ExtEscape(m_hDC, PASSTHROUGH, send_len + 2, buffer, 0, nullptr);
+ ::GdiComment(m_hDC, send_len + 2, reinterpret_cast<const BYTE*>(buffer));
+ sent_len += send_len;
+ len -= send_len;
+ }
+}
« no previous file with comments | « core/fxge/win32/cpsoutput.h ('k') | core/fxge/win32/fx_win32_print.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698