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 GrContext_DEFINED | 8 #ifndef GrContext_DEFINED |
9 #define GrContext_DEFINED | 9 #define GrContext_DEFINED |
10 | 10 |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 * pixel config or because no render target is currently set and NUL
L was passed for | 623 * pixel config or because no render target is currently set and NUL
L was passed for |
624 * target. | 624 * target. |
625 */ | 625 */ |
626 bool readRenderTargetPixels(GrRenderTarget* target, | 626 bool readRenderTargetPixels(GrRenderTarget* target, |
627 int left, int top, int width, int height, | 627 int left, int top, int width, int height, |
628 GrPixelConfig config, void* buffer, | 628 GrPixelConfig config, void* buffer, |
629 size_t rowBytes = 0, | 629 size_t rowBytes = 0, |
630 uint32_t pixelOpsFlags = 0); | 630 uint32_t pixelOpsFlags = 0); |
631 | 631 |
632 /** | 632 /** |
633 * Copy the src pixels [buffer, row bytes, pixel config] into a render targe
t at the specified | 633 * Writes a rectangle of pixels to a surface. |
634 * rectangle. | 634 * @param surface the surface to write to. |
635 * @param target the render target to write into. NULL means the curr
ent render target. | |
636 * @param left left edge of the rectangle to write (inclusive) | 635 * @param left left edge of the rectangle to write (inclusive) |
637 * @param top top edge of the rectangle to write (inclusive) | 636 * @param top top edge of the rectangle to write (inclusive) |
638 * @param width width of rectangle to write in pixels. | 637 * @param width width of rectangle to write in pixels. |
639 * @param height height of rectangle to write in pixels. | |
640 * @param config the pixel config of the source buffer | |
641 * @param buffer memory to read the rectangle from. | |
642 * @param rowBytes number of bytes between consecutive rows. Zero means
rows are tightly | |
643 * packed. | |
644 * @param pixelOpsFlags see PixelOpsFlags enum above. | |
645 * | |
646 * @return true if the write succeeded, false if not. The write can fail bec
ause of an | |
647 * unsupported combination of target and pixel configs. | |
648 */ | |
649 bool writeRenderTargetPixels(GrRenderTarget* target, | |
650 int left, int top, int width, int height, | |
651 GrPixelConfig config, const void* buffer, | |
652 size_t rowBytes = 0, | |
653 uint32_t pixelOpsFlags = 0); | |
654 | |
655 /** | |
656 * Reads a rectangle of pixels from a texture. | |
657 * @param texture the texture to read from. | |
658 * @param left left edge of the rectangle to read (inclusive) | |
659 * @param top top edge of the rectangle to read (inclusive) | |
660 * @param width width of rectangle to read in pixels. | |
661 * @param height height of rectangle to read in pixels. | |
662 * @param config the pixel config of the destination buffer | |
663 * @param buffer memory to read the rectangle into. | |
664 * @param rowBytes number of bytes between consecutive rows. Zero means
rows are tightly | |
665 * packed. | |
666 * @param pixelOpsFlags see PixelOpsFlags enum above. | |
667 * | |
668 * @return true if the read succeeded, false if not. The read can fail becau
se of an unsupported | |
669 * pixel config. | |
670 */ | |
671 bool readTexturePixels(GrTexture* texture, | |
672 int left, int top, int width, int height, | |
673 GrPixelConfig config, void* buffer, | |
674 size_t rowBytes = 0, | |
675 uint32_t pixelOpsFlags = 0); | |
676 | |
677 /** | |
678 * Writes a rectangle of pixels to a texture. | |
679 * @param texture the render target to read from. | |
680 * @param left left edge of the rectangle to write (inclusive) | |
681 * @param top top edge of the rectangle to write (inclusive) | |
682 * @param width width of rectangle to write in pixels. | |
683 * @param height height of rectangle to write in pixels. | 638 * @param height height of rectangle to write in pixels. |
684 * @param config the pixel config of the source buffer | 639 * @param config the pixel config of the source buffer |
685 * @param buffer memory to read pixels from | 640 * @param buffer memory to read pixels from |
686 * @param rowBytes number of bytes between consecutive rows. Zero | 641 * @param rowBytes number of bytes between consecutive rows. Zero |
687 * means rows are tightly packed. | 642 * means rows are tightly packed. |
688 * @param pixelOpsFlags see PixelOpsFlags enum above. | 643 * @param pixelOpsFlags see PixelOpsFlags enum above. |
689 * @return true if the write succeeded, false if not. The write can fail bec
ause of an | 644 * @return true if the write succeeded, false if not. The write can fail bec
ause of an |
690 * unsupported combination of texture and pixel configs. | 645 * unsupported combination of surface and src configs. |
691 */ | 646 */ |
692 bool writeTexturePixels(GrTexture* texture, | 647 bool writeSurfacePixels(GrSurface* surface, |
693 int left, int top, int width, int height, | 648 int left, int top, int width, int height, |
694 GrPixelConfig config, const void* buffer, | 649 GrPixelConfig config, const void* buffer, |
695 size_t rowBytes, | 650 size_t rowBytes, |
696 uint32_t pixelOpsFlags = 0); | 651 uint32_t pixelOpsFlags = 0); |
697 | 652 |
698 /** | 653 /** |
699 * Copies a rectangle of texels from src to dst. | 654 * Copies a rectangle of texels from src to dst. |
700 * bounds. | 655 * bounds. |
701 * @param dst the surface to copy to. | 656 * @param dst the surface to copy to. |
702 * @param src the surface to copy from. | 657 * @param src the surface to copy from. |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 } | 1103 } |
1149 | 1104 |
1150 GrTexture* texture() { return fTexture; } | 1105 GrTexture* texture() { return fTexture; } |
1151 | 1106 |
1152 private: | 1107 private: |
1153 GrContext* fContext; | 1108 GrContext* fContext; |
1154 GrTexture* fTexture; | 1109 GrTexture* fTexture; |
1155 }; | 1110 }; |
1156 | 1111 |
1157 #endif | 1112 #endif |
OLD | NEW |