| 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_
|
|
|