| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 SkSpecialSurface_DEFINED | 8 #ifndef SkSpecialSurface_DEFINED |
| 9 #define SkSpecialSurface_DEFINED | 9 #define SkSpecialSurface_DEFINED |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 * Returns an image of the current state of the surface pixels up to this | 45 * Returns an image of the current state of the surface pixels up to this |
| 46 * point. The canvas returned by 'getCanvas' becomes invalidated by this | 46 * point. The canvas returned by 'getCanvas' becomes invalidated by this |
| 47 * call and no more drawing to this surface is allowed. | 47 * call and no more drawing to this surface is allowed. |
| 48 * | 48 * |
| 49 * Note: the caller inherits a ref from this call that must be balanced | 49 * Note: the caller inherits a ref from this call that must be balanced |
| 50 */ | 50 */ |
| 51 sk_sp<SkSpecialImage> makeImageSnapshot(); | 51 sk_sp<SkSpecialImage> makeImageSnapshot(); |
| 52 | 52 |
| 53 #if SK_SUPPORT_GPU | 53 #if SK_SUPPORT_GPU |
| 54 /** | 54 /** |
| 55 * Use an existing (renderTarget-capable) GrTexture as the backing store. | |
| 56 */ | |
| 57 static sk_sp<SkSpecialSurface> MakeFromTexture(const SkIRect& subset, sk_sp<
GrTexture>, | |
| 58 const SkSurfaceProps* = nullp
tr); | |
| 59 | |
| 60 /** | |
| 61 * Allocate a new GPU-backed SkSpecialSurface. If the requested surface can
not | 55 * Allocate a new GPU-backed SkSpecialSurface. If the requested surface can
not |
| 62 * be created, nullptr will be returned. | 56 * be created, nullptr will be returned. |
| 63 */ | 57 */ |
| 64 static sk_sp<SkSpecialSurface> MakeRenderTarget(GrContext*, const GrSurfaceD
esc&, | 58 static sk_sp<SkSpecialSurface> MakeRenderTarget(GrContext*, |
| 65 const SkSurfaceProps* = null
ptr); | 59 int width, int height, |
| 60 GrPixelConfig config); |
| 66 #endif | 61 #endif |
| 67 | 62 |
| 68 /** | 63 /** |
| 69 * Use and existing SkBitmap as the backing store. | 64 * Use and existing SkBitmap as the backing store. |
| 70 */ | 65 */ |
| 71 static sk_sp<SkSpecialSurface> MakeFromBitmap(const SkIRect& subset, SkBitma
p& bm, | 66 static sk_sp<SkSpecialSurface> MakeFromBitmap(const SkIRect& subset, SkBitma
p& bm, |
| 72 const SkSurfaceProps* = nullpt
r); | 67 const SkSurfaceProps* = nullpt
r); |
| 73 | 68 |
| 74 /** | 69 /** |
| 75 * Return a new CPU-backed surface, with the memory for the pixels automati
cally | 70 * Return a new CPU-backed surface, with the memory for the pixels automati
cally |
| (...skipping 13 matching lines...) Expand all Loading... |
| 89 const SkIRect& subset() const { return fSubset; } | 84 const SkIRect& subset() const { return fSubset; } |
| 90 | 85 |
| 91 private: | 86 private: |
| 92 const SkSurfaceProps fProps; | 87 const SkSurfaceProps fProps; |
| 93 const SkIRect fSubset; | 88 const SkIRect fSubset; |
| 94 | 89 |
| 95 typedef SkRefCnt INHERITED; | 90 typedef SkRefCnt INHERITED; |
| 96 }; | 91 }; |
| 97 | 92 |
| 98 #endif | 93 #endif |
| OLD | NEW |