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

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

Issue 1249543003: Creating functions for uploading a mipmapped texture. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Fixing incorrect rebase. 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 2010 Google Inc. 2 * Copyright 2010 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 GrContext_DEFINED 8 #ifndef GrContext_DEFINED
9 #define GrContext_DEFINED 9 #define GrContext_DEFINED
10 10
11 #include "GrClip.h" 11 #include "GrClip.h"
12 #include "GrColor.h" 12 #include "GrColor.h"
13 #include "GrPaint.h" 13 #include "GrPaint.h"
14 #include "GrPathRendererChain.h" 14 #include "GrPathRendererChain.h"
15 #include "GrRenderTarget.h" 15 #include "GrRenderTarget.h"
16 #include "GrTextureProvider.h" 16 #include "GrTextureProvider.h"
17 #include "SkMatrix.h" 17 #include "SkMatrix.h"
18 #include "SkMutex.h" 18 #include "SkMutex.h"
19 #include "SkMipMapLevel.h"
19 #include "SkPathEffect.h" 20 #include "SkPathEffect.h"
21 #include "SkTArray.h"
20 #include "SkTypes.h" 22 #include "SkTypes.h"
21 23
22 struct GrBatchAtlasConfig; 24 struct GrBatchAtlasConfig;
23 class GrBatchFontCache; 25 class GrBatchFontCache;
24 class GrCaps; 26 class GrCaps;
25 struct GrContextOptions; 27 struct GrContextOptions;
26 class GrDrawContext; 28 class GrDrawContext;
27 class GrDrawTarget; 29 class GrDrawTarget;
28 class GrFragmentProcessor; 30 class GrFragmentProcessor;
29 class GrGpu; 31 class GrGpu;
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 uint32_t pixelOpsFlags = 0); 253 uint32_t pixelOpsFlags = 0);
252 254
253 /** 255 /**
254 * Writes a rectangle of pixels to a surface. 256 * Writes a rectangle of pixels to a surface.
255 * @param surface the surface to write to. 257 * @param surface the surface to write to.
256 * @param left left edge of the rectangle to write (inclusive) 258 * @param left left edge of the rectangle to write (inclusive)
257 * @param top top edge of the rectangle to write (inclusive) 259 * @param top top edge of the rectangle to write (inclusive)
258 * @param width width of rectangle to write in pixels. 260 * @param width width of rectangle to write in pixels.
259 * @param height height of rectangle to write in pixels. 261 * @param height height of rectangle to write in pixels.
260 * @param config the pixel config of the source buffer 262 * @param config the pixel config of the source buffer
261 * @param buffer memory to read pixels from 263 * @param texels array of mipmap levels containing texel data to load .
262 * @param rowBytes number of bytes between consecutive rows. Zero 264 * Begins with full-sized palette data for paletted tex tures.
263 * means rows are tightly packed. 265 * For compressed formats it contains the compressed pi xel data.
266 * Otherwise, it contains width*height texels. If there is only one
267 * element and it contains nullptr fTexels, texture dat a is
bsalomon 2015/09/30 18:01:29 Why one element and not just a 0 element array?
cblume 2015/10/08 09:27:56 Oh. That...is a much better idea. I'll go through
268 * uninitialized.
264 * @param pixelOpsFlags see PixelOpsFlags enum above. 269 * @param pixelOpsFlags see PixelOpsFlags enum above.
270 *
265 * @return true if the write succeeded, false if not. The write can fail bec ause of an 271 * @return true if the write succeeded, false if not. The write can fail bec ause of an
266 * unsupported combination of surface and src configs. 272 * unsupported combination of surface and src configs.
267 */ 273 */
268 bool writeSurfacePixels(GrSurface* surface, 274 bool writeSurfacePixels(GrSurface* surface,
269 int left, int top, int width, int height, 275 int left, int top, int width, int height,
276 GrPixelConfig config, const SkTArray<SkMipMapLevel>& texels,
277 uint32_t pixelOpsFlags = 0);
278
279 /**
280 * This function is a shim which creates a SkTArray<SkMipMapLevel> of size 1 .
281 * It then calls writeSurfacePixels with that SkTArray.
282 *
283 * @param buffer Pointer to the pixel values (optional).
284 * @param rowBytes The number of bytes between rows of the texture. Zero
285 * implies tightly packed rows. For compressed pixel config s, this
286 * field is ignored.
287 */
288 bool writeSurfacePixels(GrSurface* surface,
289 int left, int top, int width, int height,
270 GrPixelConfig config, const void* buffer, 290 GrPixelConfig config, const void* buffer,
271 size_t rowBytes, 291 size_t rowBytes,
272 uint32_t pixelOpsFlags = 0); 292 uint32_t pixelOpsFlags = 0);
273 293
274 /** 294 /**
275 * Copies a rectangle of texels from src to dst. 295 * Copies a rectangle of texels from src to dst.
276 * bounds. 296 * bounds.
277 * @param dst the surface to copy to. 297 * @param dst the surface to copy to.
278 * @param src the surface to copy from. 298 * @param src the surface to copy from.
279 * @param srcRect the rectangle of the src that should be copied. 299 * @param srcRect the rectangle of the src that should be copied.
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 /** 503 /**
484 * A callback similar to the above for use by the TextBlobCache 504 * A callback similar to the above for use by the TextBlobCache
485 * TODO move textblob draw calls below context so we can use the call above. 505 * TODO move textblob draw calls below context so we can use the call above.
486 */ 506 */
487 static void TextBlobCacheOverBudgetCB(void* data); 507 static void TextBlobCacheOverBudgetCB(void* data);
488 508
489 typedef SkRefCnt INHERITED; 509 typedef SkRefCnt INHERITED;
490 }; 510 };
491 511
492 #endif 512 #endif
OLDNEW
« no previous file with comments | « include/core/SkMipMapLevel.h ('k') | include/gpu/GrSurface.h » ('j') | src/gpu/GrContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698