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

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

Issue 1669213002: Revert of skia: Add support for CHROMIUM_image backed textures. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « include/core/SkSurface.h ('k') | src/gpu/GrTexture.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 GrTypes_DEFINED 8 #ifndef GrTypes_DEFINED
9 #define GrTypes_DEFINED 9 #define GrTypes_DEFINED
10 10
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 kZeroCopy_GrSurfaceFlag = 0x2, 402 kZeroCopy_GrSurfaceFlag = 0x2,
403 /** 403 /**
404 * Indicates that all allocations (color buffer, FBO completeness, etc) 404 * Indicates that all allocations (color buffer, FBO completeness, etc)
405 * should be verified. 405 * should be verified.
406 */ 406 */
407 kCheckAllocation_GrSurfaceFlag = 0x4, 407 kCheckAllocation_GrSurfaceFlag = 0x4,
408 }; 408 };
409 409
410 GR_MAKE_BITFIELD_OPS(GrSurfaceFlags) 410 GR_MAKE_BITFIELD_OPS(GrSurfaceFlags)
411 411
412 // opaque type for 3D API object handles
413 typedef intptr_t GrBackendObject;
414
415 /** 412 /**
416 * Some textures will be stored such that the upper and left edges of the conten t meet at the 413 * Some textures will be stored such that the upper and left edges of the conten t meet at the
417 * the origin (in texture coord space) and for other textures the lower and left edges meet at 414 * the origin (in texture coord space) and for other textures the lower and left edges meet at
418 * the origin. kDefault_GrSurfaceOrigin sets textures to TopLeft, and render tar gets 415 * the origin. kDefault_GrSurfaceOrigin sets textures to TopLeft, and render tar gets
419 * to BottomLeft. 416 * to BottomLeft.
420 */ 417 */
421 418
422 enum GrSurfaceOrigin { 419 enum GrSurfaceOrigin {
423 kDefault_GrSurfaceOrigin, // DEPRECATED; to be removed 420 kDefault_GrSurfaceOrigin, // DEPRECATED; to be removed
424 kTopLeft_GrSurfaceOrigin, 421 kTopLeft_GrSurfaceOrigin,
425 kBottomLeft_GrSurfaceOrigin, 422 kBottomLeft_GrSurfaceOrigin,
426 }; 423 };
427 424
428 /** 425 /**
429 * An container of function pointers which consumers of Skia can fill in and
430 * pass to Skia. Skia will use these function pointers in place of its backend
431 * API texture creation function. Either all of the function pointers should be
432 * filled in, or they should all be nullptr.
433 */
434 struct GrTextureStorageAllocator {
435 GrTextureStorageAllocator()
436 : fAllocateTextureStorage(nullptr)
437 , fDeallocateTextureStorage(nullptr) {
438 }
439
440 enum class Result {
441 kSucceededAndUploaded,
442 kSucceededWithoutUpload,
443 kFailed
444 };
445 typedef Result (*AllocateTextureStorageProc)(
446 void* ctx, GrBackendObject texture, unsigned width,
447 unsigned height, GrPixelConfig config, const void* srcData, GrSurfac eOrigin);
448 typedef void (*DeallocateTextureStorageProc)(void* ctx, GrBackendObject text ure);
449
450 /*
451 * Generates and binds a texture to |textureStorageTarget()|. Allocates
452 * storage for the texture.
453 *
454 * In OpenGL, the MIN and MAX filters for the created texture must be
455 * GL_LINEAR. The WRAP_S and WRAP_T must be GL_CLAMP_TO_EDGE.
456 *
457 * If |srcData| is not nullptr, then the implementation of this function
458 * may attempt to upload the data into the texture. On successful upload,
459 * or if |srcData| is nullptr, returns kSucceededAndUploaded.
460 */
461 AllocateTextureStorageProc fAllocateTextureStorage;
462
463 /*
464 * Deallocate the storage for the given texture.
465 *
466 * Skia does not always destroy its outstanding textures. See
467 * GrContext::abandonContext() for more details. The consumer of Skia is
468 * responsible for making sure that all textures are destroyed, even if this
469 * callback is not invoked.
470 */
471 DeallocateTextureStorageProc fDeallocateTextureStorage;
472
473 /*
474 * The context to use when invoking fAllocateTextureStorage and
475 * fDeallocateTextureStorage.
476 */
477 void* fCtx;
478 };
479
480 /**
481 * Describes a surface to be created. 426 * Describes a surface to be created.
482 */ 427 */
483 struct GrSurfaceDesc { 428 struct GrSurfaceDesc {
484 GrSurfaceDesc() 429 GrSurfaceDesc()
485 : fFlags(kNone_GrSurfaceFlags) 430 : fFlags(kNone_GrSurfaceFlags)
486 , fOrigin(kDefault_GrSurfaceOrigin) 431 , fOrigin(kDefault_GrSurfaceOrigin)
487 , fWidth(0) 432 , fWidth(0)
488 , fHeight(0) 433 , fHeight(0)
489 , fConfig(kUnknown_GrPixelConfig) 434 , fConfig(kUnknown_GrPixelConfig)
490 , fSampleCnt(0) { 435 , fSampleCnt(0) {
(...skipping 11 matching lines...) Expand all
502 GrPixelConfig fConfig; 447 GrPixelConfig fConfig;
503 448
504 /** 449 /**
505 * The number of samples per pixel or 0 to disable full scene AA. This only 450 * The number of samples per pixel or 0 to disable full scene AA. This only
506 * applies if the kRenderTarget_GrSurfaceFlag is set. The actual number 451 * applies if the kRenderTarget_GrSurfaceFlag is set. The actual number
507 * of samples may not exactly match the request. The request will be rounded 452 * of samples may not exactly match the request. The request will be rounded
508 * up to the next supported sample count, or down if it is larger than the 453 * up to the next supported sample count, or down if it is larger than the
509 * max supported count. 454 * max supported count.
510 */ 455 */
511 int fSampleCnt; 456 int fSampleCnt;
512
513 /**
514 * A custom platform-specific allocator to use in place of the backend APIs
515 * usual texture creation method (e.g. TexImage2D in OpenGL).
516 */
517 GrTextureStorageAllocator fTextureStorageAllocator;
518 }; 457 };
519 458
520 // Legacy alias 459 // Legacy alias
521 typedef GrSurfaceDesc GrTextureDesc; 460 typedef GrSurfaceDesc GrTextureDesc;
522 461
523 /** 462 /**
524 * Clips are composed from these objects. 463 * Clips are composed from these objects.
525 */ 464 */
526 enum GrClipType { 465 enum GrClipType {
527 kRect_ClipType, 466 kRect_ClipType,
528 kPath_ClipType 467 kPath_ClipType
529 }; 468 };
530 469
531 /////////////////////////////////////////////////////////////////////////////// 470 ///////////////////////////////////////////////////////////////////////////////
532 471
472 // opaque type for 3D API object handles
473 typedef intptr_t GrBackendObject;
474
533 475
534 /** Ownership rules for external GPU resources imported into Skia. */ 476 /** Ownership rules for external GPU resources imported into Skia. */
535 enum GrWrapOwnership { 477 enum GrWrapOwnership {
536 /** Skia will assume the client will keep the resource alive and Skia will n ot free it. */ 478 /** Skia will assume the client will keep the resource alive and Skia will n ot free it. */
537 kBorrow_GrWrapOwnership, 479 kBorrow_GrWrapOwnership,
538 480
539 /** Skia will assume ownership of the resource and free it. */ 481 /** Skia will assume ownership of the resource and free it. */
540 kAdopt_GrWrapOwnership, 482 kAdopt_GrWrapOwnership,
541 }; 483 };
542 484
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 return 4 * width * height; 618 return 4 * width * height;
677 } 619 }
678 } 620 }
679 621
680 /** 622 /**
681 * This value translates to reseting all the context state for any backend. 623 * This value translates to reseting all the context state for any backend.
682 */ 624 */
683 static const uint32_t kAll_GrBackendState = 0xffffffff; 625 static const uint32_t kAll_GrBackendState = 0xffffffff;
684 626
685 #endif 627 #endif
OLDNEW
« no previous file with comments | « include/core/SkSurface.h ('k') | src/gpu/GrTexture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698