OLD | NEW |
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 |
| 11 #include "SkMath.h" |
11 #include "SkTypes.h" | 12 #include "SkTypes.h" |
12 #include "GrConfig.h" | 13 #include "GrConfig.h" |
13 #include "SkMath.h" | |
14 | 14 |
15 //////////////////////////////////////////////////////////////////////////////// | 15 //////////////////////////////////////////////////////////////////////////////// |
16 | 16 |
17 /** | 17 /** |
18 * Defines overloaded bitwise operators to make it easier to use an enum as a | 18 * Defines overloaded bitwise operators to make it easier to use an enum as a |
19 * bitfield. | 19 * bitfield. |
20 */ | 20 */ |
21 #define GR_MAKE_BITFIELD_OPS(X) \ | 21 #define GR_MAKE_BITFIELD_OPS(X) \ |
22 inline X operator | (X a, X b) { \ | 22 inline X operator | (X a, X b) { \ |
23 return (X) (+a | +b); \ | 23 return (X) (+a | +b); \ |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 * the origin. kDefault_GrSurfaceOrigin sets textures to TopLeft, and render tar
gets | 418 * the origin. kDefault_GrSurfaceOrigin sets textures to TopLeft, and render tar
gets |
419 * to BottomLeft. | 419 * to BottomLeft. |
420 */ | 420 */ |
421 | 421 |
422 enum GrSurfaceOrigin { | 422 enum GrSurfaceOrigin { |
423 kDefault_GrSurfaceOrigin, // DEPRECATED; to be removed | 423 kDefault_GrSurfaceOrigin, // DEPRECATED; to be removed |
424 kTopLeft_GrSurfaceOrigin, | 424 kTopLeft_GrSurfaceOrigin, |
425 kBottomLeft_GrSurfaceOrigin, | 425 kBottomLeft_GrSurfaceOrigin, |
426 }; | 426 }; |
427 | 427 |
| 428 struct GrMipLevel { |
| 429 const void* fPixels; |
| 430 size_t fRowBytes; |
| 431 }; |
| 432 |
428 /** | 433 /** |
429 * An container of function pointers which consumers of Skia can fill in and | 434 * 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 | 435 * 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 | 436 * API texture creation function. Either all of the function pointers should be |
432 * filled in, or they should all be nullptr. | 437 * filled in, or they should all be nullptr. |
433 */ | 438 */ |
434 struct GrTextureStorageAllocator { | 439 struct GrTextureStorageAllocator { |
435 GrTextureStorageAllocator() | 440 GrTextureStorageAllocator() |
436 : fAllocateTextureStorage(nullptr) | 441 : fAllocateTextureStorage(nullptr) |
437 , fDeallocateTextureStorage(nullptr) { | 442 , fDeallocateTextureStorage(nullptr) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 /** | 485 /** |
481 * Describes a surface to be created. | 486 * Describes a surface to be created. |
482 */ | 487 */ |
483 struct GrSurfaceDesc { | 488 struct GrSurfaceDesc { |
484 GrSurfaceDesc() | 489 GrSurfaceDesc() |
485 : fFlags(kNone_GrSurfaceFlags) | 490 : fFlags(kNone_GrSurfaceFlags) |
486 , fOrigin(kDefault_GrSurfaceOrigin) | 491 , fOrigin(kDefault_GrSurfaceOrigin) |
487 , fWidth(0) | 492 , fWidth(0) |
488 , fHeight(0) | 493 , fHeight(0) |
489 , fConfig(kUnknown_GrPixelConfig) | 494 , fConfig(kUnknown_GrPixelConfig) |
490 , fSampleCnt(0) { | 495 , fSampleCnt(0) |
| 496 , fIsMipMapped(false) { |
491 } | 497 } |
492 | 498 |
493 GrSurfaceFlags fFlags; //!< bitfield of TextureFlags | 499 GrSurfaceFlags fFlags; //!< bitfield of TextureFlags |
494 GrSurfaceOrigin fOrigin; //!< origin of the texture | 500 GrSurfaceOrigin fOrigin; //!< origin of the texture |
495 int fWidth; //!< Width of the texture | 501 int fWidth; //!< Width of the texture |
496 int fHeight; //!< Height of the texture | 502 int fHeight; //!< Height of the texture |
497 | 503 |
498 /** | 504 /** |
499 * Format of source data of the texture. Not guaranteed to be the same as | 505 * Format of source data of the texture. Not guaranteed to be the same as |
500 * internal format used by 3D API. | 506 * internal format used by 3D API. |
501 */ | 507 */ |
502 GrPixelConfig fConfig; | 508 GrPixelConfig fConfig; |
503 | 509 |
504 /** | 510 /** |
505 * The number of samples per pixel or 0 to disable full scene AA. This only | 511 * 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 | 512 * applies if the kRenderTarget_GrSurfaceFlag is set. The actual number |
507 * of samples may not exactly match the request. The request will be rounded | 513 * 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 | 514 * up to the next supported sample count, or down if it is larger than the |
509 * max supported count. | 515 * max supported count. |
510 */ | 516 */ |
511 int fSampleCnt; | 517 int fSampleCnt; |
512 | 518 |
513 /** | 519 /** |
514 * A custom platform-specific allocator to use in place of the backend APIs | 520 * A custom platform-specific allocator to use in place of the backend APIs |
515 * usual texture creation method (e.g. TexImage2D in OpenGL). | 521 * usual texture creation method (e.g. TexImage2D in OpenGL). |
516 */ | 522 */ |
517 GrTextureStorageAllocator fTextureStorageAllocator; | 523 GrTextureStorageAllocator fTextureStorageAllocator; |
| 524 |
| 525 bool fIsMipMapped; //!< Indicates if the texture has mipma
ps |
518 }; | 526 }; |
519 | 527 |
520 // Legacy alias | 528 // Legacy alias |
521 typedef GrSurfaceDesc GrTextureDesc; | 529 typedef GrSurfaceDesc GrTextureDesc; |
522 | 530 |
523 /** | 531 /** |
524 * Clips are composed from these objects. | 532 * Clips are composed from these objects. |
525 */ | 533 */ |
526 enum GrClipType { | 534 enum GrClipType { |
527 kRect_ClipType, | 535 kRect_ClipType, |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 return 4 * width * height; | 684 return 4 * width * height; |
677 } | 685 } |
678 } | 686 } |
679 | 687 |
680 /** | 688 /** |
681 * This value translates to reseting all the context state for any backend. | 689 * This value translates to reseting all the context state for any backend. |
682 */ | 690 */ |
683 static const uint32_t kAll_GrBackendState = 0xffffffff; | 691 static const uint32_t kAll_GrBackendState = 0xffffffff; |
684 | 692 |
685 #endif | 693 #endif |
OLD | NEW |