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 SkImage_DEFINED | 8 #ifndef SkImage_DEFINED |
9 #define SkImage_DEFINED | 9 #define SkImage_DEFINED |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 static SkImage* NewFromYUVTexturesCopy(GrContext*, SkYUVColorSpace, | 90 static SkImage* NewFromYUVTexturesCopy(GrContext*, SkYUVColorSpace, |
91 const GrBackendObject yuvTextureHandl
es[3], | 91 const GrBackendObject yuvTextureHandl
es[3], |
92 const SkISize yuvSizes[3], | 92 const SkISize yuvSizes[3], |
93 GrSurfaceOrigin); | 93 GrSurfaceOrigin); |
94 | 94 |
95 int width() const { return fWidth; } | 95 int width() const { return fWidth; } |
96 int height() const { return fHeight; } | 96 int height() const { return fHeight; } |
97 uint32_t uniqueID() const { return fUniqueID; } | 97 uint32_t uniqueID() const { return fUniqueID; } |
98 virtual bool isOpaque() const { return false; } | 98 virtual bool isOpaque() const { return false; } |
99 | 99 |
100 /** | |
101 * Return the GrTexture that stores the image pixels. Calling getTexture | |
102 * does not affect the reference count of the GrTexture object. | |
103 * Will return NULL if the image does not use a texture. | |
104 */ | |
105 GrTexture* getTexture() const; | |
106 | |
107 virtual SkShader* newShader(SkShader::TileMode, | 100 virtual SkShader* newShader(SkShader::TileMode, |
108 SkShader::TileMode, | 101 SkShader::TileMode, |
109 const SkMatrix* localMatrix = NULL) const; | 102 const SkMatrix* localMatrix = NULL) const; |
110 | 103 |
111 /** | 104 /** |
112 * If the image has direct access to its pixels (i.e. they are in local | 105 * If the image has direct access to its pixels (i.e. they are in local |
113 * RAM) return the (const) address of those pixels, and if not null, return | 106 * RAM) return the (const) address of those pixels, and if not null, return |
114 * the ImageInfo and rowBytes. The returned address is only valid while | 107 * the ImageInfo and rowBytes. The returned address is only valid while |
115 * the image object is in scope. | 108 * the image object is in scope. |
116 * | 109 * |
117 * On failure, returns NULL and the info and rowBytes parameters are | 110 * On failure, returns NULL and the info and rowBytes parameters are |
118 * ignored. | 111 * ignored. |
119 */ | 112 */ |
120 const void* peekPixels(SkImageInfo* info, size_t* rowBytes) const; | 113 const void* peekPixels(SkImageInfo* info, size_t* rowBytes) const; |
121 | 114 |
| 115 // DEPRECATED |
| 116 GrTexture* getTexture() const; |
| 117 |
| 118 /** |
| 119 * Returns true if the image is texture backed. |
| 120 */ |
| 121 bool isTextureBacked() const; |
| 122 |
| 123 /** |
| 124 * Retrieves the backend API handle of the texture. If flushPendingGrContex
tReads then the |
| 125 * GrContext will issue to the backend API any deferred read operations on
the texture before |
| 126 * returning. |
| 127 */ |
| 128 GrBackendObject getTextureHandle(bool flushPendingGrContextReads) const; |
| 129 |
122 /** | 130 /** |
123 * Copy the pixels from the image into the specified buffer (pixels + rowBy
tes), | 131 * Copy the pixels from the image into the specified buffer (pixels + rowBy
tes), |
124 * converting them into the requested format (dstInfo). The image pixels ar
e read | 132 * converting them into the requested format (dstInfo). The image pixels ar
e read |
125 * starting at the specified (srcX,srcY) location. | 133 * starting at the specified (srcX,srcY) location. |
126 * | 134 * |
127 * The specified ImageInfo and (srcX,srcY) offset specifies a source rectan
gle | 135 * The specified ImageInfo and (srcX,srcY) offset specifies a source rectan
gle |
128 * | 136 * |
129 * srcR.setXYWH(srcX, srcY, dstInfo.width(), dstInfo.height()); | 137 * srcR.setXYWH(srcX, srcY, dstInfo.width(), dstInfo.height()); |
130 * | 138 * |
131 * srcR is intersected with the bounds of the image. If this intersection i
s not empty, | 139 * srcR is intersected with the bounds of the image. If this intersection i
s not empty, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 const int fWidth; | 204 const int fWidth; |
197 const int fHeight; | 205 const int fHeight; |
198 const uint32_t fUniqueID; | 206 const uint32_t fUniqueID; |
199 | 207 |
200 static uint32_t NextUniqueID(); | 208 static uint32_t NextUniqueID(); |
201 | 209 |
202 typedef SkRefCnt INHERITED; | 210 typedef SkRefCnt INHERITED; |
203 }; | 211 }; |
204 | 212 |
205 #endif | 213 #endif |
OLD | NEW |