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 SkSpecialImage_DEFINED | 8 #ifndef SkSpecialImage_DEFINED |
9 #define SkSpecialImage_DEFINED | 9 #define SkSpecialImage_DEFINED |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 class SkSpecialImage : public SkRefCnt { | 43 class SkSpecialImage : public SkRefCnt { |
44 public: | 44 public: |
45 typedef void* ReleaseContext; | 45 typedef void* ReleaseContext; |
46 typedef void(*RasterReleaseProc)(void* pixels, ReleaseContext); | 46 typedef void(*RasterReleaseProc)(void* pixels, ReleaseContext); |
47 | 47 |
48 const SkSurfaceProps& props() const { return fProps; } | 48 const SkSurfaceProps& props() const { return fProps; } |
49 | 49 |
50 int width() const { return fSubset.width(); } | 50 int width() const { return fSubset.width(); } |
51 int height() const { return fSubset.height(); } | 51 int height() const { return fSubset.height(); } |
52 const SkIRect& subset() const { return fSubset; } | 52 const SkIRect& subset() const { return fSubset; } |
| 53 SkColorSpace* getColorSpace() const; |
53 | 54 |
54 uint32_t uniqueID() const { return fUniqueID; } | 55 uint32_t uniqueID() const { return fUniqueID; } |
55 virtual bool isOpaque() const { return false; } | 56 virtual bool isOpaque() const { return false; } |
56 virtual size_t getSize() const = 0; | 57 virtual size_t getSize() const = 0; |
57 | 58 |
58 /** | 59 /** |
59 * Ensures that a special image is backed by a texture (when GrContext is n
on-null). If no | 60 * Ensures that a special image is backed by a texture (when GrContext is n
on-null). If no |
60 * transformation is required, the returned image may be the same as this s
pecial image. | 61 * transformation is required, the returned image may be the same as this s
pecial image. |
61 * If this special image is from a different GrContext, this will fail. | 62 * If this special image is from a different GrContext, this will fail. |
62 */ | 63 */ |
63 sk_sp<SkSpecialImage> makeTextureImage(GrContext*); | 64 sk_sp<SkSpecialImage> makeTextureImage(GrContext*); |
64 | 65 |
65 /** | 66 /** |
66 * Draw this SpecialImage into the canvas. | 67 * Draw this SpecialImage into the canvas. |
67 */ | 68 */ |
68 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const; | 69 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const; |
69 | 70 |
70 static sk_sp<SkSpecialImage> MakeFromImage(const SkIRect& subset, | 71 static sk_sp<SkSpecialImage> MakeFromImage(const SkIRect& subset, |
71 sk_sp<SkImage>, | 72 sk_sp<SkImage>, |
72 const SkSurfaceProps* = nullptr); | 73 const SkSurfaceProps* = nullptr); |
73 static sk_sp<SkSpecialImage> MakeFromRaster(const SkIRect& subset, | 74 static sk_sp<SkSpecialImage> MakeFromRaster(const SkIRect& subset, |
74 const SkBitmap&, | 75 const SkBitmap&, |
75 const SkSurfaceProps* = nullptr)
; | 76 const SkSurfaceProps* = nullptr)
; |
76 #if SK_SUPPORT_GPU | 77 #if SK_SUPPORT_GPU |
77 static sk_sp<SkSpecialImage> MakeFromGpu(const SkIRect& subset, | 78 static sk_sp<SkSpecialImage> MakeFromGpu(const SkIRect& subset, |
78 uint32_t uniqueID, | 79 uint32_t uniqueID, |
79 sk_sp<GrTexture>, | 80 sk_sp<GrTexture>, |
| 81 sk_sp<SkColorSpace>, |
80 const SkSurfaceProps* = nullptr, | 82 const SkSurfaceProps* = nullptr, |
81 SkAlphaType at = kPremul_SkAlphaTyp
e); | 83 SkAlphaType at = kPremul_SkAlphaTyp
e); |
82 #endif | 84 #endif |
83 | 85 |
84 /** | 86 /** |
85 * Create a new special surface with a backend that is compatible with this
special image. | 87 * Create a new special surface with a backend that is compatible with this
special image. |
86 */ | 88 */ |
87 sk_sp<SkSpecialSurface> makeSurface(const SkImageInfo&) const; | 89 sk_sp<SkSpecialSurface> makeSurface(const SkImageInfo&) const; |
88 | 90 |
89 /** | 91 /** |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 140 |
139 private: | 141 private: |
140 const SkSurfaceProps fProps; | 142 const SkSurfaceProps fProps; |
141 const SkIRect fSubset; | 143 const SkIRect fSubset; |
142 const uint32_t fUniqueID; | 144 const uint32_t fUniqueID; |
143 | 145 |
144 typedef SkRefCnt INHERITED; | 146 typedef SkRefCnt INHERITED; |
145 }; | 147 }; |
146 | 148 |
147 #endif | 149 #endif |
OLD | NEW |