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

Side by Side Diff: skia/ext/layer_allocator_cairo.h

Issue 2304273002: WIP RasterCanvasLayerAllocator experiment 2
Patch Set: update to Skia patchset 13 Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « skia/ext/layer_allocator.h ('k') | skia/ext/layer_allocator_cairo.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SKIA_EXT_LAYER_ALLOCATOR_CAIRO_H_
6 #define SKIA_EXT_LAYER_ALLOCATOR_CAIRO_H_
7
8 #include "skia/ext/platform_surface.h"
9
10 #include "third_party/skia/include/core/SkRasterCanvasLayerAllocator.h"
11
12 #include <unordered_map>
13
14 namespace skia {
15
16 /*
17 * On a stock Linux build, a PlatformCanvas is backed by a Cairo image
18 * surface; a PlatformSurface is a pointer to a Cairo context.
19 */
20 class LayerAllocator : public SkRasterCanvasLayerAllocator {
21 public:
22 LayerAllocator();
23 ~LayerAllocator() override;
24
25 /// Returns cairo_t*.
26 void* getNativeContext(void* buffer,
27 const SkMatrix& transform,
28 const SkIRect& clip_bounds) override;
29
30 protected:
31 /// Expects a cairo_surface_t* as (optional) initialData.
32 /// Returns the data pointer from a cairo_image_surface.
33 /// |deallocator| will cairo_surface_destroy() and cairo_destroy()
34 /// the layer.
35 void* allocateLayer(const SkImageInfo& info, size_t* rowBytes,
36 void (**deallocator)(void*),
37 void** deallocatorPayload,
38 void* initialData) override;
39
40 private:
41 typedef std::unordered_map<void*, cairo_t*> context_map_t;
42 context_map_t contexts_;
43 };
44
45 }
46
47 #endif // SKIA_EXT_LAYER_ALLOCATOR_CAIRO_H_
OLDNEW
« no previous file with comments | « skia/ext/layer_allocator.h ('k') | skia/ext/layer_allocator_cairo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698