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

Unified Diff: skia/ext/skia_utils_base.cc

Issue 2653963002: [Experimental] Supporting OOPIF printing
Patch Set: Rename service, fix for webview, and connect to DiscardableMemoryManager Created 3 years, 9 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 | « skia/ext/skia_utils_base.h ('k') | third_party/WebKit/Source/core/frame/LocalFrame.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/skia_utils_base.cc
diff --git a/skia/ext/skia_utils_base.cc b/skia/ext/skia_utils_base.cc
index c56730bd9bc8f0b1c294617d2ab4e1829aca11d4..01ed5de6d06a48c1f2c9648b91775053abff4ba9 100644
--- a/skia/ext/skia_utils_base.cc
+++ b/skia/ext/skia_utils_base.cc
@@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "skia/ext/skia_utils_base.h"
+
#include <stdint.h>
-#include "skia/ext/skia_utils_base.h"
#include "third_party/skia/include/core/SkFontLCDConfig.h"
+#include "third_party/skia/src/core/SkReadBuffer.h"
namespace skia {
@@ -101,5 +103,25 @@ SkPixelGeometry ComputeDefaultPixelGeometry() {
return gGeo[index];
}
+std::unique_ptr<SkDrawable> ReadDrawable(const char* buffer, size_t size) {
+ SkReadBuffer rBuffer(buffer, size);
+ rBuffer.setCustomFactory(SkString(SkFutureDrawable::kTypeName),
+ SkFutureDrawable::CreateProc);
+
+ std::unique_ptr<SkDrawable> drawable(
+ (SkDrawable*)rBuffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
+ return drawable;
+}
+
+std::vector<char> WriteDrawable(SkDrawable* drawable) {
+ SkBinaryWriteBuffer wBuffer;
+ wBuffer.writeFlattenable(drawable);
+ size_t size = wBuffer.bytesWritten();
+ std::vector<char> data;
+ data.resize(size);
+ wBuffer.writeToMemory(data.data());
+ return data;
+}
+
} // namespace skia
« no previous file with comments | « skia/ext/skia_utils_base.h ('k') | third_party/WebKit/Source/core/frame/LocalFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698