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

Side by Side Diff: include/core/SkCanvas.h

Issue 2309483002: WIP RasterCanvasLayerAllocator experiment 2
Patch Set: vend smart pointers to SkCanvas 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 | « include/core/SkBitmapDevice.h ('k') | include/core/SkDevice.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkCanvas_DEFINED 8 #ifndef SkCanvas_DEFINED
9 #define SkCanvas_DEFINED 9 #define SkCanvas_DEFINED
10 10
11 #include "SkTypes.h" 11 #include "SkTypes.h"
12 #include "SkBitmap.h" 12 #include "SkBitmap.h"
13 #include "SkDeque.h" 13 #include "SkDeque.h"
14 #include "SkImage.h" 14 #include "SkImage.h"
15 #include "SkPaint.h" 15 #include "SkPaint.h"
16 #include "SkRasterCanvasLayerAllocator.h"
16 #include "SkRefCnt.h" 17 #include "SkRefCnt.h"
17 #include "SkRegion.h" 18 #include "SkRegion.h"
18 #include "SkSurfaceProps.h" 19 #include "SkSurfaceProps.h"
19 #include "SkXfermode.h" 20 #include "SkXfermode.h"
20 #include "SkLights.h" 21 #include "SkLights.h"
21 #include "../private/SkShadowParams.h" 22 #include "../private/SkShadowParams.h"
22 23
23 class GrContext; 24 class GrContext;
24 class GrDrawContext; 25 class GrDrawContext;
25 class SkBaseDevice; 26 class SkBaseDevice;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 * the draw calls in some other way. 96 * the draw calls in some other way.
96 */ 97 */
97 SkCanvas(int width, int height, const SkSurfaceProps* = NULL); 98 SkCanvas(int width, int height, const SkSurfaceProps* = NULL);
98 99
99 /** Construct a canvas with the specified device to draw into. 100 /** Construct a canvas with the specified device to draw into.
100 101
101 @param device Specifies a device for the canvas to draw into. 102 @param device Specifies a device for the canvas to draw into.
102 */ 103 */
103 explicit SkCanvas(SkBaseDevice* device); 104 explicit SkCanvas(SkBaseDevice* device);
104 105
106 explicit SkCanvas(SkBaseDevice* device, SkRasterCanvasLayerAllocator*);
107
105 /** Construct a canvas with the specified bitmap to draw into. 108 /** Construct a canvas with the specified bitmap to draw into.
106 @param bitmap Specifies a bitmap for the canvas to draw into. Its 109 @param bitmap Specifies a bitmap for the canvas to draw into. Its
107 structure are copied to the canvas. 110 structure are copied to the canvas.
108 */ 111 */
109 explicit SkCanvas(const SkBitmap& bitmap); 112 explicit SkCanvas(const SkBitmap& bitmap);
110 113
111 /** Construct a canvas with the specified bitmap to draw into. 114 /** Construct a canvas with the specified bitmap to draw into.
112 @param bitmap Specifies a bitmap for the canvas to draw into. Its 115 @param bitmap Specifies a bitmap for the canvas to draw into. Its
113 structure are copied to the canvas. 116 structure are copied to the canvas.
114 @param props New canvas surface properties. 117 @param props New canvas surface properties.
(...skipping 10 matching lines...) Expand all
125 */ 128 */
126 SkImageInfo imageInfo() const; 129 SkImageInfo imageInfo() const;
127 130
128 /** 131 /**
129 * If the canvas is backed by pixels (cpu or gpu), this writes a copy of th e SurfaceProps 132 * If the canvas is backed by pixels (cpu or gpu), this writes a copy of th e SurfaceProps
130 * for the canvas to the location supplied by the caller, and returns true. Otherwise, 133 * for the canvas to the location supplied by the caller, and returns true. Otherwise,
131 * return false and leave the supplied props unchanged. 134 * return false and leave the supplied props unchanged.
132 */ 135 */
133 bool getProps(SkSurfaceProps*) const; 136 bool getProps(SkSurfaceProps*) const;
134 137
138 SkRasterCanvasLayerAllocator* getLayerAllocator() const { return fLayerAlloc ator.get(); }
139
135 /////////////////////////////////////////////////////////////////////////// 140 ///////////////////////////////////////////////////////////////////////////
136 141
137 /** 142 /**
138 * Trigger the immediate execution of all pending draw operations. For the GPU 143 * Trigger the immediate execution of all pending draw operations. For the GPU
139 * backend this will resolve all rendering to the GPU surface backing the 144 * backend this will resolve all rendering to the GPU surface backing the
140 * SkSurface that owns this canvas. 145 * SkSurface that owns this canvas.
141 */ 146 */
142 void flush(); 147 void flush();
143 148
144 /** 149 /**
(...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 private: 1687 private:
1683 const SkCanvas* fCanvas; 1688 const SkCanvas* fCanvas;
1684 }; 1689 };
1685 1690
1686 #ifdef SK_DEBUG 1691 #ifdef SK_DEBUG
1687 void validateClip() const; 1692 void validateClip() const;
1688 #else 1693 #else
1689 void validateClip() const {} 1694 void validateClip() const {}
1690 #endif 1695 #endif
1691 1696
1697 std::unique_ptr<SkRasterCanvasLayerAllocator> fLayerAllocator;
1698
1692 typedef SkRefCnt INHERITED; 1699 typedef SkRefCnt INHERITED;
1693 }; 1700 };
1694 1701
1695 /** Stack helper class to automatically call restoreToCount() on the canvas 1702 /** Stack helper class to automatically call restoreToCount() on the canvas
1696 when this object goes out of scope. Use this to guarantee that the canvas 1703 when this object goes out of scope. Use this to guarantee that the canvas
1697 is restored to a known state. 1704 is restored to a known state.
1698 */ 1705 */
1699 class SkAutoCanvasRestore : SkNoncopyable { 1706 class SkAutoCanvasRestore : SkNoncopyable {
1700 public: 1707 public:
1701 SkAutoCanvasRestore(SkCanvas* canvas, bool doSave) : fCanvas(canvas), fSaveC ount(0) { 1708 SkAutoCanvasRestore(SkCanvas* canvas, bool doSave) : fCanvas(canvas), fSaveC ount(0) {
(...skipping 29 matching lines...) Expand all
1731 1738
1732 class SkCanvasClipVisitor { 1739 class SkCanvasClipVisitor {
1733 public: 1740 public:
1734 virtual ~SkCanvasClipVisitor(); 1741 virtual ~SkCanvasClipVisitor();
1735 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; 1742 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0;
1736 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; 1743 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0;
1737 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; 1744 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0;
1738 }; 1745 };
1739 1746
1740 #endif 1747 #endif
OLDNEW
« no previous file with comments | « include/core/SkBitmapDevice.h ('k') | include/core/SkDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698