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 "SkMipMapLevel.h" |
15 #include "SkRect.h" | 16 #include "SkRect.h" |
| 17 #include "SkTArray.h" |
16 | 18 |
17 class GrRenderTarget; | 19 class GrRenderTarget; |
18 class GrSurfacePriv; | 20 class GrSurfacePriv; |
19 class GrTexture; | 21 class GrTexture; |
20 | 22 |
21 class SK_API GrSurface : public GrGpuResource { | 23 class SK_API GrSurface : public GrGpuResource { |
22 public: | 24 public: |
23 /** | 25 /** |
24 * Retrieves the width of the surface. | 26 * Retrieves the width of the surface. |
25 */ | 27 */ |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 uint32_t pixelOpsFlags = 0); | 90 uint32_t pixelOpsFlags = 0); |
89 | 91 |
90 /** | 92 /** |
91 * Copy the src pixels [buffer, rowbytes, pixelconfig] into the surface at t
he specified | 93 * Copy the src pixels [buffer, rowbytes, pixelconfig] into the surface at t
he specified |
92 * rectangle. | 94 * rectangle. |
93 * @param left left edge of the rectangle to write (inclusive) | 95 * @param left left edge of the rectangle to write (inclusive) |
94 * @param top top edge of the rectangle to write (inclusive) | 96 * @param top top edge of the rectangle to write (inclusive) |
95 * @param width width of rectangle to write in pixels. | 97 * @param width width of rectangle to write in pixels. |
96 * @param height height of rectangle to write in pixels. | 98 * @param height height of rectangle to write in pixels. |
97 * @param config the pixel config of the source buffer | 99 * @param config the pixel config of the source buffer |
98 * @param buffer memory to read the rectangle from. | 100 * @param texels array of mipmap levels containing texel data to load
. |
99 * @param rowBytes number of bytes between consecutive rows. Zero means
rows are tightly | 101 * Begins with full-size palette data for paletted text
ures. |
100 * packed. | 102 * For compressed formats it contains the compressed pi
xel data. |
| 103 * Otherwise, it contains width*height texels. If there
is only one |
| 104 * element and it contains nullptr fTexels, texture dat
a is |
| 105 * uninitialized. |
101 * @param pixelOpsFlags See the GrContext::PixelOpsFlags enum. | 106 * @param pixelOpsFlags See the GrContext::PixelOpsFlags enum. |
102 * | 107 * |
103 * @return true if the read succeeded, false if not. The read can fail becau
se of an unsupported | 108 * @return true if the read succeeded, false if not. The read can fail becau
se of an |
104 * pixel config. | 109 * unsupported pixel config. |
105 */ | 110 */ |
106 bool writePixels(int left, int top, int width, int height, | 111 bool writePixels(int left, int top, int width, int height, GrPixelConfig con
fig, |
107 GrPixelConfig config, | 112 const SkTArray<SkMipMapLevel>& texels, uint32_t pixelOpsFla
gs = 0); |
108 const void* buffer, | 113 |
109 size_t rowBytes = 0, | 114 /** |
110 uint32_t pixelOpsFlags = 0); | 115 * This function is a shim which creates a SkTArray<SkMipMapLevel> of size 1
. |
| 116 * It then calls writePixels with that SkTArray. |
| 117 * |
| 118 * @param buffer Pointer to the pixel values (optional). |
| 119 * @param rowBytes The number of bytes between rows of the texture. Zero |
| 120 * implies tightly packed rows. For compressed pixel config
s, this |
| 121 * field is ignored. |
| 122 */ |
| 123 bool writePixels(int left, int top, int width, int height, GrPixelConfig con
fig, |
| 124 const void* buffer, size_t rowBytes = 0, uint32_t pixelOpsF
lags = 0); |
111 | 125 |
112 /** | 126 /** |
113 * After this returns any pending writes to the surface will be issued to th
e backend 3D API. | 127 * After this returns any pending writes to the surface will be issued to th
e backend 3D API. |
114 */ | 128 */ |
115 void flushWrites(); | 129 void flushWrites(); |
116 | 130 |
117 | 131 |
118 /** | 132 /** |
119 * After this returns any pending surface IO will be issued to the backend 3
D API and | 133 * 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. | 134 * if the surface has MSAA it will be resolved. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 } | 185 } |
172 } | 186 } |
173 | 187 |
174 ReleaseProc fReleaseProc; | 188 ReleaseProc fReleaseProc; |
175 ReleaseCtx fReleaseCtx; | 189 ReleaseCtx fReleaseCtx; |
176 | 190 |
177 typedef GrGpuResource INHERITED; | 191 typedef GrGpuResource INHERITED; |
178 }; | 192 }; |
179 | 193 |
180 #endif | 194 #endif |
OLD | NEW |