Chromium Code Reviews| 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 unsupported |
| 104 * pixel config. | 109 * 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, |
| 107 GrPixelConfig config, | 112 GrPixelConfig config, |
| 113 const SkTArray<SkMipMapLevel>& texels, | |
| 114 uint32_t pixelOpsFlags = 0); | |
| 115 | |
| 116 /** | |
| 117 * This function is a shim which creates a SkTArray<SkMipMapLevel> of size 1 . | |
| 118 * It then calls writePixels() with that SkTArray. | |
| 119 * This is so older code which currently uses this function signature will | |
|
bsalomon
2015/09/15 13:14:10
I'd take off the thing about older code. I expect
cblume
2015/09/16 18:40:46
I've updated all the shim comments. :)
| |
| 120 * continue to work. | |
| 121 */ | |
| 122 bool writePixels(int left, int top, int width, int height, | |
| 123 GrPixelConfig config, | |
| 108 const void* buffer, | 124 const void* buffer, |
| 109 size_t rowBytes = 0, | 125 size_t rowBytes = 0, |
| 110 uint32_t pixelOpsFlags = 0); | 126 uint32_t pixelOpsFlags = 0); |
| 111 | 127 |
| 112 /** | 128 /** |
| 113 * After this returns any pending writes to the surface will be issued to th e backend 3D API. | 129 * After this returns any pending writes to the surface will be issued to th e backend 3D API. |
| 114 */ | 130 */ |
| 115 void flushWrites(); | 131 void flushWrites(); |
| 116 | 132 |
| 117 | 133 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 } | 187 } |
| 172 } | 188 } |
| 173 | 189 |
| 174 ReleaseProc fReleaseProc; | 190 ReleaseProc fReleaseProc; |
| 175 ReleaseCtx fReleaseCtx; | 191 ReleaseCtx fReleaseCtx; |
| 176 | 192 |
| 177 typedef GrGpuResource INHERITED; | 193 typedef GrGpuResource INHERITED; |
| 178 }; | 194 }; |
| 179 | 195 |
| 180 #endif | 196 #endif |
| OLD | NEW |