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 | 8 |
9 #ifndef GrSurface_DEFINED | 9 #ifndef GrSurface_DEFINED |
10 #define GrSurface_DEFINED | 10 #define GrSurface_DEFINED |
11 | 11 |
12 #include "GrTypes.h" | 12 #include "GrTypes.h" |
13 #include "GrGpuResource.h" | 13 #include "GrGpuResource.h" |
14 #include "SkImageInfo.h" | 14 #include "SkImageInfo.h" |
15 #include "SkRect.h" | 15 #include "SkRect.h" |
16 | 16 |
17 class GrRenderTarget; | 17 class GrRenderTarget; |
18 class GrSurfacePriv; | 18 class GrSurfacePriv; |
19 class GrTexture; | 19 class GrTexture; |
| 20 class SkColorSpace; |
20 | 21 |
21 class SK_API GrSurface : public GrGpuResource { | 22 class SK_API GrSurface : public GrGpuResource { |
22 public: | 23 public: |
23 /** | 24 /** |
24 * Retrieves the width of the surface. | 25 * Retrieves the width of the surface. |
25 */ | 26 */ |
26 int width() const { return fDesc.fWidth; } | 27 int width() const { return fDesc.fWidth; } |
27 | 28 |
28 /** | 29 /** |
29 * Retrieves the height of the surface. | 30 * Retrieves the height of the surface. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 * @param left left edge of the rectangle to write (inclusive) | 94 * @param left left edge of the rectangle to write (inclusive) |
94 * @param top top edge of the rectangle to write (inclusive) | 95 * @param top top edge of the rectangle to write (inclusive) |
95 * @param width width of rectangle to write in pixels. | 96 * @param width width of rectangle to write in pixels. |
96 * @param height height of rectangle to write in pixels. | 97 * @param height height of rectangle to write in pixels. |
97 * @param config the pixel config of the source buffer | 98 * @param config the pixel config of the source buffer |
98 * @param buffer memory to read the rectangle from. | 99 * @param buffer memory to read the rectangle from. |
99 * @param rowBytes number of bytes between consecutive rows. Zero means
rows are tightly | 100 * @param rowBytes number of bytes between consecutive rows. Zero means
rows are tightly |
100 * packed. | 101 * packed. |
101 * @param pixelOpsFlags See the GrContext::PixelOpsFlags enum. | 102 * @param pixelOpsFlags See the GrContext::PixelOpsFlags enum. |
102 * | 103 * |
103 * @return true if the read succeeded, false if not. The read can fail becau
se of an | 104 * @return true if the write succeeded, false if not. The write can fail bec
ause of an |
104 * unsupported pixel config. | 105 * unsupported pixel config. |
105 */ | 106 */ |
106 bool writePixels(int left, int top, int width, int height, | 107 bool writePixels(int left, int top, int width, int height, |
107 GrPixelConfig config, | 108 GrPixelConfig config, |
108 const void* buffer, | 109 const void* buffer, |
109 size_t rowBytes = 0, | 110 size_t rowBytes = 0, |
110 uint32_t pixelOpsFlags = 0); | 111 uint32_t pixelOpsFlags = 0); |
111 | 112 |
112 /** | 113 /** |
| 114 * Copy the src pixels [buffer, rowbytes, pixelconfig] into the surface at th
e specified |
| 115 * rectangle, performing color space conversion. No other conversions are all
owed. |
| 116 * @param left left edge of the rectangle to write (inclusive) |
| 117 * @param top top edge of the rectangle to write (inclusive) |
| 118 * @param width width of rectangle to write in pixels. |
| 119 * @param height height of rectangle to write in pixels. |
| 120 * @param config the pixel config of the source buffer |
| 121 * @param srcColorSpace color space of the source buffer |
| 122 * @param dstColorSpace color space to convert to |
| 123 * @param buffer memory to read the rectangle from. |
| 124 * @param rowBytes number of bytes between consecutive rows. Zero means
rows are tightly |
| 125 * packed. |
| 126 * @param colorSpaceOpsFlags See the GrContext::ColorSpaceOpsFlags enum. |
| 127 * |
| 128 * @return true if the write succeeded, false if not. The write can fail beca
use of an |
| 129 * unsupported pixel config. |
| 130 */ |
| 131 bool writePixelsWithColorSpace(int left, int top, int width, int height, |
| 132 GrPixelConfig config, |
| 133 const SkColorSpace* srcColorSpace, |
| 134 const SkColorSpace* dstColorSpace, |
| 135 const void* buffer, |
| 136 size_t rowBytes = 0, |
| 137 uint32_t colorSpaceOpsFlags = 0); |
| 138 |
| 139 /** |
113 * After this returns any pending writes to the surface will be issued to th
e backend 3D API. | 140 * After this returns any pending writes to the surface will be issued to th
e backend 3D API. |
114 */ | 141 */ |
115 void flushWrites(); | 142 void flushWrites(); |
116 | 143 |
117 | 144 |
118 /** | 145 /** |
119 * After this returns any pending surface IO will be issued to the backend 3
D API and | 146 * After this returns any pending surface IO will be issued to the backend 3
D API and |
120 * if the surface has MSAA it will be resolved. | 147 * if the surface has MSAA it will be resolved. |
121 */ | 148 */ |
122 void prepareForExternalIO(); | 149 void prepareForExternalIO(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 } | 198 } |
172 } | 199 } |
173 | 200 |
174 ReleaseProc fReleaseProc; | 201 ReleaseProc fReleaseProc; |
175 ReleaseCtx fReleaseCtx; | 202 ReleaseCtx fReleaseCtx; |
176 | 203 |
177 typedef GrGpuResource INHERITED; | 204 typedef GrGpuResource INHERITED; |
178 }; | 205 }; |
179 | 206 |
180 #endif | 207 #endif |
OLD | NEW |