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