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

Unified Diff: skia/ext/layer_allocator_win.h

Issue 2304273002: WIP RasterCanvasLayerAllocator experiment 2
Patch Set: update to Skia patchset 13 Created 4 years, 3 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/layer_allocator_cairo.cc ('k') | skia/ext/layer_allocator_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/layer_allocator_win.h
diff --git a/skia/ext/layer_allocator_win.h b/skia/ext/layer_allocator_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..46da090ab4e9f2304b75bbcb962e427b7b17291d
--- /dev/null
+++ b/skia/ext/layer_allocator_win.h
@@ -0,0 +1,49 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SKIA_EXT_LAYER_ALLOCATOR_WIN_H_
+#define SKIA_EXT_LAYER_ALLOCATOR_WIN_H_
+
+#include "skia/ext/platform_surface.h"
+
+#include "third_party/skia/include/core/SkRasterCanvasLayerAllocator.h"
+
+#include <unordered_map>
+
+namespace skia {
+
+/*
+ * On Windows, a PlatformCanvas is backed by a CreateDIBSection()-allocated
+ * bitmap; a PlatformSurface is an HDC.
+ */
+class LayerAllocator : public SkRasterCanvasLayerAllocator {
+ public:
+ LayerAllocator();
+ ~LayerAllocator() override;
+
+ /// Returns HDC.
+ void* getNativeContext(void* buffer,
+ const SkMatrix& transform,
+ const SkIRect& clip_bounds) override;
+
+ protected:
+ /// Expects a HANDLE to a Windows shared section as (optional) initialData.
+ /// Returns the data pointer from an HBITMAP.
+ /// |deallocator| will ...() and ...()
+ /// the layer.
+ void* allocateLayer(const SkImageInfo& info, size_t* rowBytes,
+ void (**deallocator)(void*),
+ void** deallocatorPayload,
+ void* initialData) override;
+
+ private:
+ typedef std::unordered_map<void*, HDC> context_map_t;
+ context_map_t contexts_;
+
+ friend class BitmapPlatformDevice;
+};
+
+}
+
+#endif // SKIA_EXT_LAYER_ALLOCATOR_WIN_H_
« no previous file with comments | « skia/ext/layer_allocator_cairo.cc ('k') | skia/ext/layer_allocator_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698