OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
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 SkSurface_DEFINED | 8 #ifndef SkSurface_DEFINED |
9 #define SkSurface_DEFINED | 9 #define SkSurface_DEFINED |
10 | 10 |
11 #include "SkRefCnt.h" | 11 #include "SkRefCnt.h" |
12 #include "SkImage.h" | 12 #include "SkImage.h" |
13 | 13 |
14 class SkCanvas; | 14 class SkCanvas; |
15 class SkPaint; | 15 class SkPaint; |
16 class GrContext; | 16 class GrContext; |
17 class GrRenderTarget; | 17 class GrRenderTarget; |
18 | 18 |
19 //#define SK_SUPPORT_LEGACY_NEWRENDERTARGETDIRECT | |
20 | |
21 /** | 19 /** |
22 * SkSurface represents the backend/results of drawing to a canvas. For raster | 20 * SkSurface represents the backend/results of drawing to a canvas. For raster |
23 * drawing, the surface will be pixels, but (for example) when drawing into | 21 * drawing, the surface will be pixels, but (for example) when drawing into |
24 * a PDF or Picture canvas, the surface stores the recorded commands. | 22 * a PDF or Picture canvas, the surface stores the recorded commands. |
25 * | 23 * |
26 * To draw into a canvas, first create the appropriate type of Surface, and | 24 * To draw into a canvas, first create the appropriate type of Surface, and |
27 * then request the canvas from the surface. | 25 * then request the canvas from the surface. |
28 */ | 26 */ |
29 class SK_API SkSurface : public SkRefCnt { | 27 class SK_API SkSurface : public SkRefCnt { |
30 public: | 28 public: |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 * When this surface is drawn into another canvas, its contents will be | 63 * When this surface is drawn into another canvas, its contents will be |
66 * "replayed" into that canvas. | 64 * "replayed" into that canvas. |
67 */ | 65 */ |
68 static SkSurface* NewPicture(int width, int height); | 66 static SkSurface* NewPicture(int width, int height); |
69 | 67 |
70 /** | 68 /** |
71 * Return a new surface using the specified render target. | 69 * Return a new surface using the specified render target. |
72 */ | 70 */ |
73 static SkSurface* NewRenderTargetDirect(GrRenderTarget*); | 71 static SkSurface* NewRenderTargetDirect(GrRenderTarget*); |
74 | 72 |
75 #ifdef SK_SUPPORT_LEGACY_NEWRENDERTARGETDIRECT | |
76 /** | |
77 * DEPRECATED -- call the single argument version (just rendertarget) | |
78 * Return a new surface using the specified render target. | |
79 */ | |
80 static SkSurface* NewRenderTargetDirect(GrContext*, GrRenderTarget*); | |
81 #endif | |
82 | |
83 /** | 73 /** |
84 * Return a new surface whose contents will be drawn to an offscreen | 74 * Return a new surface whose contents will be drawn to an offscreen |
85 * render target, allocated by the surface. | 75 * render target, allocated by the surface. |
86 */ | 76 */ |
87 static SkSurface* NewRenderTarget(GrContext*, const SkImageInfo&, int sample
Count = 0); | 77 static SkSurface* NewRenderTarget(GrContext*, const SkImageInfo&, int sample
Count = 0); |
88 | 78 |
89 int width() const { return fWidth; } | 79 int width() const { return fWidth; } |
90 int height() const { return fHeight; } | 80 int height() const { return fHeight; } |
91 | 81 |
92 /** | 82 /** |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 162 |
173 private: | 163 private: |
174 const int fWidth; | 164 const int fWidth; |
175 const int fHeight; | 165 const int fHeight; |
176 uint32_t fGenerationID; | 166 uint32_t fGenerationID; |
177 | 167 |
178 typedef SkRefCnt INHERITED; | 168 typedef SkRefCnt INHERITED; |
179 }; | 169 }; |
180 | 170 |
181 #endif | 171 #endif |
OLD | NEW |