Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(885)

Side by Side Diff: include/gpu/GrSurface.h

Issue 1249543003: Creating functions for uploading a mipmapped texture. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Fixing merge mistakes Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 the a rray is empty,
104 * texture data is uninitialized.
101 * @param pixelOpsFlags See the GrContext::PixelOpsFlags enum. 105 * @param pixelOpsFlags See the GrContext::PixelOpsFlags enum.
102 * 106 *
103 * @return true if the read succeeded, false if not. The read can fail becau se of an unsupported 107 * @return true if the read succeeded, false if not. The read can fail becau se of an
104 * pixel config. 108 * unsupported pixel config.
105 */ 109 */
106 bool writePixels(int left, int top, int width, int height, 110 bool writePixels(int left, int top, int width, int height, GrPixelConfig con fig,
107 GrPixelConfig config, 111 const SkTArray<SkMipMapLevel>& texels, uint32_t pixelOpsFla gs = 0);
108 const void* buffer, 112
109 size_t rowBytes = 0, 113 /**
110 uint32_t pixelOpsFlags = 0); 114 * This function is a shim which creates a SkTArray<SkMipMapLevel> of size 1 .
115 * It then calls writePixels with that SkTArray.
116 *
117 * @param buffer Pointer to the pixel values (optional).
118 * @param rowBytes The number of bytes between rows of the texture. Zero
119 * implies tightly packed rows. For compressed pixel config s, this
120 * field is ignored.
121 */
122 bool writePixels(int left, int top, int width, int height, GrPixelConfig con fig,
123 const void* buffer, size_t rowBytes = 0, uint32_t pixelOpsF lags = 0);
111 124
112 /** 125 /**
113 * After this returns any pending writes to the surface will be issued to th e backend 3D API. 126 * After this returns any pending writes to the surface will be issued to th e backend 3D API.
114 */ 127 */
115 void flushWrites(); 128 void flushWrites();
116 129
117 130
118 /** 131 /**
119 * After this returns any pending surface IO will be issued to the backend 3 D API and 132 * 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. 133 * if the surface has MSAA it will be resolved.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } 184 }
172 } 185 }
173 186
174 ReleaseProc fReleaseProc; 187 ReleaseProc fReleaseProc;
175 ReleaseCtx fReleaseCtx; 188 ReleaseCtx fReleaseCtx;
176 189
177 typedef GrGpuResource INHERITED; 190 typedef GrGpuResource INHERITED;
178 }; 191 };
179 192
180 #endif 193 #endif
OLDNEW
« include/gpu/GrContext.h ('K') | « include/gpu/GrContext.h ('k') | include/gpu/GrTexture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698