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

Side by Side Diff: Source/platform/graphics/GraphicsContext3D.cpp

Issue 106503003: Changed GL enums from GraphicsContext3D to standard versions (Take 2) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2010 Google Inc. All rights reserved.
4 * Copyright (C) 2010 Mozilla Corporation. All rights reserved. 4 * Copyright (C) 2010 Mozilla Corporation. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 DELEGATE_TO_WEBCONTEXT_1R(isFramebuffer, Platform3DObject, GC3Dboolean) 422 DELEGATE_TO_WEBCONTEXT_1R(isFramebuffer, Platform3DObject, GC3Dboolean)
423 DELEGATE_TO_WEBCONTEXT_1R(isProgram, Platform3DObject, GC3Dboolean) 423 DELEGATE_TO_WEBCONTEXT_1R(isProgram, Platform3DObject, GC3Dboolean)
424 DELEGATE_TO_WEBCONTEXT_1R(isRenderbuffer, Platform3DObject, GC3Dboolean) 424 DELEGATE_TO_WEBCONTEXT_1R(isRenderbuffer, Platform3DObject, GC3Dboolean)
425 DELEGATE_TO_WEBCONTEXT_1R(isShader, Platform3DObject, GC3Dboolean) 425 DELEGATE_TO_WEBCONTEXT_1R(isShader, Platform3DObject, GC3Dboolean)
426 DELEGATE_TO_WEBCONTEXT_1R(isTexture, Platform3DObject, GC3Dboolean) 426 DELEGATE_TO_WEBCONTEXT_1R(isTexture, Platform3DObject, GC3Dboolean)
427 DELEGATE_TO_WEBCONTEXT_1(lineWidth, GC3Dfloat) 427 DELEGATE_TO_WEBCONTEXT_1(lineWidth, GC3Dfloat)
428 DELEGATE_TO_WEBCONTEXT_1(linkProgram, Platform3DObject) 428 DELEGATE_TO_WEBCONTEXT_1(linkProgram, Platform3DObject)
429 429
430 void GraphicsContext3D::pixelStorei(GC3Denum pname, GC3Dint param) 430 void GraphicsContext3D::pixelStorei(GC3Denum pname, GC3Dint param)
431 { 431 {
432 if (pname == PACK_ALIGNMENT) 432 if (pname == GL_PACK_ALIGNMENT)
433 m_packAlignment = param; 433 m_packAlignment = param;
434 m_impl->pixelStorei(pname, param); 434 m_impl->pixelStorei(pname, param);
435 } 435 }
436 436
437 DELEGATE_TO_WEBCONTEXT_2(polygonOffset, GC3Dfloat, GC3Dfloat) 437 DELEGATE_TO_WEBCONTEXT_2(polygonOffset, GC3Dfloat, GC3Dfloat)
438 438
439 DELEGATE_TO_WEBCONTEXT_7(readPixels, GC3Dint, GC3Dint, GC3Dsizei, GC3Dsizei, GC3 Denum, GC3Denum, void*) 439 DELEGATE_TO_WEBCONTEXT_7(readPixels, GC3Dint, GC3Dint, GC3Dsizei, GC3Dsizei, GC3 Denum, GC3Denum, void*)
440 440
441 DELEGATE_TO_WEBCONTEXT(releaseShaderCompiler) 441 DELEGATE_TO_WEBCONTEXT(releaseShaderCompiler)
442 DELEGATE_TO_WEBCONTEXT_4(renderbufferStorage, GC3Denum, GC3Denum, GC3Dsizei, GC3 Dsizei) 442 DELEGATE_TO_WEBCONTEXT_4(renderbufferStorage, GC3Denum, GC3Denum, GC3Dsizei, GC3 Dsizei)
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 getDrawingParameters(drawingBuffer, m_impl, &framebufferId, &width, &height) ; 527 getDrawingParameters(drawingBuffer, m_impl, &framebufferId, &width, &height) ;
528 528
529 Checked<int, RecordOverflow> dataSize = 4; 529 Checked<int, RecordOverflow> dataSize = 4;
530 dataSize *= width; 530 dataSize *= width;
531 dataSize *= height; 531 dataSize *= height;
532 if (dataSize.hasOverflowed()) 532 if (dataSize.hasOverflowed())
533 return 0; 533 return 0;
534 534
535 RefPtr<Uint8ClampedArray> pixels = Uint8ClampedArray::createUninitialized(wi dth * height * 4); 535 RefPtr<Uint8ClampedArray> pixels = Uint8ClampedArray::createUninitialized(wi dth * height * 4);
536 536
537 m_impl->bindFramebuffer(FRAMEBUFFER, framebufferId); 537 m_impl->bindFramebuffer(GL_FRAMEBUFFER, framebufferId);
538 readBackFramebuffer(pixels->data(), width, height, ReadbackRGBA, AlphaDoNoth ing); 538 readBackFramebuffer(pixels->data(), width, height, ReadbackRGBA, AlphaDoNoth ing);
539 flipVertically(pixels->data(), width, height); 539 flipVertically(pixels->data(), width, height);
540 540
541 return pixels.release(); 541 return pixels.release();
542 } 542 }
543 543
544 void GraphicsContext3D::readBackFramebuffer(unsigned char* pixels, int width, in t height, ReadbackOrder readbackOrder, AlphaOp op) 544 void GraphicsContext3D::readBackFramebuffer(unsigned char* pixels, int width, in t height, ReadbackOrder readbackOrder, AlphaOp op)
545 { 545 {
546 if (m_packAlignment > 4) 546 if (m_packAlignment > 4)
547 m_impl->pixelStorei(PACK_ALIGNMENT, 1); 547 m_impl->pixelStorei(GL_PACK_ALIGNMENT, 1);
548 m_impl->readPixels(0, 0, width, height, RGBA, UNSIGNED_BYTE, pixels); 548 m_impl->readPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
549 if (m_packAlignment > 4) 549 if (m_packAlignment > 4)
550 m_impl->pixelStorei(PACK_ALIGNMENT, m_packAlignment); 550 m_impl->pixelStorei(GL_PACK_ALIGNMENT, m_packAlignment);
551 551
552 size_t bufferSize = 4 * width * height; 552 size_t bufferSize = 4 * width * height;
553 553
554 if (readbackOrder == ReadbackSkia) { 554 if (readbackOrder == ReadbackSkia) {
555 #if (SK_R32_SHIFT == 16) && !SK_B32_SHIFT 555 #if (SK_R32_SHIFT == 16) && !SK_B32_SHIFT
556 // Swizzle red and blue channels to match SkBitmap's byte ordering. 556 // Swizzle red and blue channels to match SkBitmap's byte ordering.
557 // TODO(kbr): expose GL_BGRA as extension. 557 // TODO(kbr): expose GL_BGRA as extension.
558 for (size_t i = 0; i < bufferSize; i += 4) { 558 for (size_t i = 0; i < bufferSize; i += 4) {
559 std::swap(pixels[i], pixels[i + 2]); 559 std::swap(pixels[i], pixels[i + 2]);
560 } 560 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 texImage2D(target, level, internalformat, width, height, border, format, typ e, 0); 601 texImage2D(target, level, internalformat, width, height, border, format, typ e, 0);
602 return true; 602 return true;
603 } 603 }
604 604
605 bool GraphicsContext3D::computeFormatAndTypeParameters(GC3Denum format, 605 bool GraphicsContext3D::computeFormatAndTypeParameters(GC3Denum format,
606 GC3Denum type, 606 GC3Denum type,
607 unsigned int* componentsP erPixel, 607 unsigned int* componentsP erPixel,
608 unsigned int* bytesPerCom ponent) 608 unsigned int* bytesPerCom ponent)
609 { 609 {
610 switch (format) { 610 switch (format) {
611 case GraphicsContext3D::ALPHA: 611 case GL_ALPHA:
612 case GraphicsContext3D::LUMINANCE: 612 case GL_LUMINANCE:
613 case GraphicsContext3D::DEPTH_COMPONENT: 613 case GL_DEPTH_COMPONENT:
614 case GraphicsContext3D::DEPTH_STENCIL: 614 case GL_DEPTH_STENCIL_OES:
615 *componentsPerPixel = 1; 615 *componentsPerPixel = 1;
616 break; 616 break;
617 case GraphicsContext3D::LUMINANCE_ALPHA: 617 case GL_LUMINANCE_ALPHA:
618 *componentsPerPixel = 2; 618 *componentsPerPixel = 2;
619 break; 619 break;
620 case GraphicsContext3D::RGB: 620 case GL_RGB:
621 *componentsPerPixel = 3; 621 *componentsPerPixel = 3;
622 break; 622 break;
623 case GraphicsContext3D::RGBA: 623 case GL_RGBA:
624 case Extensions3D::BGRA_EXT: // GL_EXT_texture_format_BGRA8888 624 case Extensions3D::BGRA_EXT: // GL_EXT_texture_format_BGRA8888
625 *componentsPerPixel = 4; 625 *componentsPerPixel = 4;
626 break; 626 break;
627 default: 627 default:
628 return false; 628 return false;
629 } 629 }
630 switch (type) { 630 switch (type) {
631 case GraphicsContext3D::UNSIGNED_BYTE: 631 case GL_UNSIGNED_BYTE:
632 *bytesPerComponent = sizeof(GC3Dubyte); 632 *bytesPerComponent = sizeof(GC3Dubyte);
633 break; 633 break;
634 case GraphicsContext3D::UNSIGNED_SHORT: 634 case GL_UNSIGNED_SHORT:
635 *bytesPerComponent = sizeof(GC3Dushort); 635 *bytesPerComponent = sizeof(GC3Dushort);
636 break; 636 break;
637 case GraphicsContext3D::UNSIGNED_SHORT_5_6_5: 637 case GL_UNSIGNED_SHORT_5_6_5:
638 case GraphicsContext3D::UNSIGNED_SHORT_4_4_4_4: 638 case GL_UNSIGNED_SHORT_4_4_4_4:
639 case GraphicsContext3D::UNSIGNED_SHORT_5_5_5_1: 639 case GL_UNSIGNED_SHORT_5_5_5_1:
640 *componentsPerPixel = 1; 640 *componentsPerPixel = 1;
641 *bytesPerComponent = sizeof(GC3Dushort); 641 *bytesPerComponent = sizeof(GC3Dushort);
642 break; 642 break;
643 case GraphicsContext3D::UNSIGNED_INT_24_8: 643 case GL_UNSIGNED_INT_24_8_OES:
644 case GraphicsContext3D::UNSIGNED_INT: 644 case GL_UNSIGNED_INT:
645 *bytesPerComponent = sizeof(GC3Duint); 645 *bytesPerComponent = sizeof(GC3Duint);
646 break; 646 break;
647 case GraphicsContext3D::FLOAT: // OES_texture_float 647 case GL_FLOAT: // OES_texture_float
648 *bytesPerComponent = sizeof(GC3Dfloat); 648 *bytesPerComponent = sizeof(GC3Dfloat);
649 break; 649 break;
650 case GraphicsContext3D::HALF_FLOAT_OES: // OES_texture_half_float 650 case GL_HALF_FLOAT_OES: // OES_texture_half_float
651 *bytesPerComponent = sizeof(GC3Dhalffloat); 651 *bytesPerComponent = sizeof(GC3Dhalffloat);
652 break; 652 break;
653 default: 653 default:
654 return false; 654 return false;
655 } 655 }
656 return true; 656 return true;
657 } 657 }
658 658
659 GC3Denum GraphicsContext3D::computeImageSizeInBytes(GC3Denum format, GC3Denum ty pe, GC3Dsizei width, GC3Dsizei height, GC3Dint alignment, 659 GC3Denum GraphicsContext3D::computeImageSizeInBytes(GC3Denum format, GC3Denum ty pe, GC3Dsizei width, GC3Dsizei height, GC3Dint alignment,
660 unsigned int* imageSizeInByt es, unsigned int* paddingInBytes) 660 unsigned int* imageSizeInByt es, unsigned int* paddingInBytes)
661 { 661 {
662 ASSERT(imageSizeInBytes); 662 ASSERT(imageSizeInBytes);
663 ASSERT(alignment == 1 || alignment == 2 || alignment == 4 || alignment == 8) ; 663 ASSERT(alignment == 1 || alignment == 2 || alignment == 4 || alignment == 8) ;
664 if (width < 0 || height < 0) 664 if (width < 0 || height < 0)
665 return GraphicsContext3D::INVALID_VALUE; 665 return GL_INVALID_VALUE;
666 unsigned int bytesPerComponent, componentsPerPixel; 666 unsigned int bytesPerComponent, componentsPerPixel;
667 if (!computeFormatAndTypeParameters(format, type, &bytesPerComponent, &compo nentsPerPixel)) 667 if (!computeFormatAndTypeParameters(format, type, &bytesPerComponent, &compo nentsPerPixel))
668 return GraphicsContext3D::INVALID_ENUM; 668 return GL_INVALID_ENUM;
669 if (!width || !height) { 669 if (!width || !height) {
670 *imageSizeInBytes = 0; 670 *imageSizeInBytes = 0;
671 if (paddingInBytes) 671 if (paddingInBytes)
672 *paddingInBytes = 0; 672 *paddingInBytes = 0;
673 return GraphicsContext3D::NO_ERROR; 673 return GL_NO_ERROR;
674 } 674 }
675 CheckedInt<uint32_t> checkedValue(bytesPerComponent * componentsPerPixel); 675 CheckedInt<uint32_t> checkedValue(bytesPerComponent * componentsPerPixel);
676 checkedValue *= width; 676 checkedValue *= width;
677 if (!checkedValue.isValid()) 677 if (!checkedValue.isValid())
678 return GraphicsContext3D::INVALID_VALUE; 678 return GL_INVALID_VALUE;
679 unsigned int validRowSize = checkedValue.value(); 679 unsigned int validRowSize = checkedValue.value();
680 unsigned int padding = 0; 680 unsigned int padding = 0;
681 unsigned int residual = validRowSize % alignment; 681 unsigned int residual = validRowSize % alignment;
682 if (residual) { 682 if (residual) {
683 padding = alignment - residual; 683 padding = alignment - residual;
684 checkedValue += padding; 684 checkedValue += padding;
685 } 685 }
686 // Last row needs no padding. 686 // Last row needs no padding.
687 checkedValue *= (height - 1); 687 checkedValue *= (height - 1);
688 checkedValue += validRowSize; 688 checkedValue += validRowSize;
689 if (!checkedValue.isValid()) 689 if (!checkedValue.isValid())
690 return GraphicsContext3D::INVALID_VALUE; 690 return GL_INVALID_VALUE;
691 *imageSizeInBytes = checkedValue.value(); 691 *imageSizeInBytes = checkedValue.value();
692 if (paddingInBytes) 692 if (paddingInBytes)
693 *paddingInBytes = padding; 693 *paddingInBytes = padding;
694 return GraphicsContext3D::NO_ERROR; 694 return GL_NO_ERROR;
695 } 695 }
696 696
697 GraphicsContext3D::ImageExtractor::ImageExtractor(Image* image, ImageHtmlDomSour ce imageHtmlDomSource, bool premultiplyAlpha, bool ignoreGammaAndColorProfile) 697 GraphicsContext3D::ImageExtractor::ImageExtractor(Image* image, ImageHtmlDomSour ce imageHtmlDomSource, bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
698 { 698 {
699 m_image = image; 699 m_image = image;
700 m_imageHtmlDomSource = imageHtmlDomSource; 700 m_imageHtmlDomSource = imageHtmlDomSource;
701 m_extractSucceeded = extractImage(premultiplyAlpha, ignoreGammaAndColorProfi le); 701 m_extractSucceeded = extractImage(premultiplyAlpha, ignoreGammaAndColorProfi le);
702 } 702 }
703 703
704 GraphicsContext3D::ImageExtractor::~ImageExtractor() 704 GraphicsContext3D::ImageExtractor::~ImageExtractor()
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 return false; 755 return false;
756 m_imageSourceUnpackAlignment = 0; 756 m_imageSourceUnpackAlignment = 0;
757 m_skiaImage->bitmap().lockPixels(); 757 m_skiaImage->bitmap().lockPixels();
758 m_imagePixelData = m_skiaImage->bitmap().getPixels(); 758 m_imagePixelData = m_skiaImage->bitmap().getPixels();
759 return true; 759 return true;
760 } 760 }
761 761
762 unsigned GraphicsContext3D::getClearBitsByFormat(GC3Denum format) 762 unsigned GraphicsContext3D::getClearBitsByFormat(GC3Denum format)
763 { 763 {
764 switch (format) { 764 switch (format) {
765 case GraphicsContext3D::ALPHA: 765 case GL_ALPHA:
766 case GraphicsContext3D::LUMINANCE: 766 case GL_LUMINANCE:
767 case GraphicsContext3D::LUMINANCE_ALPHA: 767 case GL_LUMINANCE_ALPHA:
768 case GraphicsContext3D::RGB: 768 case GL_RGB:
769 case GraphicsContext3D::RGB565: 769 case GL_RGB565:
770 case GraphicsContext3D::RGBA: 770 case GL_RGBA:
771 case GraphicsContext3D::RGBA4: 771 case GL_RGBA4:
772 case GraphicsContext3D::RGB5_A1: 772 case GL_RGB5_A1:
773 return GraphicsContext3D::COLOR_BUFFER_BIT; 773 return GL_COLOR_BUFFER_BIT;
774 case GraphicsContext3D::DEPTH_COMPONENT16: 774 case GL_DEPTH_COMPONENT16:
775 case GraphicsContext3D::DEPTH_COMPONENT: 775 case GL_DEPTH_COMPONENT:
776 return GraphicsContext3D::DEPTH_BUFFER_BIT; 776 return GL_DEPTH_BUFFER_BIT;
777 case GraphicsContext3D::STENCIL_INDEX8: 777 case GL_STENCIL_INDEX8:
778 return GraphicsContext3D::STENCIL_BUFFER_BIT; 778 return GL_STENCIL_BUFFER_BIT;
779 case GraphicsContext3D::DEPTH_STENCIL: 779 case GL_DEPTH_STENCIL_OES:
780 return GraphicsContext3D::DEPTH_BUFFER_BIT | GraphicsContext3D::STENCIL_ BUFFER_BIT; 780 return GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
781 default: 781 default:
782 return 0; 782 return 0;
783 } 783 }
784 } 784 }
785 785
786 unsigned GraphicsContext3D::getChannelBitsByFormat(GC3Denum format) 786 unsigned GraphicsContext3D::getChannelBitsByFormat(GC3Denum format)
787 { 787 {
788 switch (format) { 788 switch (format) {
789 case GraphicsContext3D::ALPHA: 789 case GL_ALPHA:
790 return ChannelAlpha; 790 return ChannelAlpha;
791 case GraphicsContext3D::LUMINANCE: 791 case GL_LUMINANCE:
792 return ChannelRGB; 792 return ChannelRGB;
793 case GraphicsContext3D::LUMINANCE_ALPHA: 793 case GL_LUMINANCE_ALPHA:
794 return ChannelRGBA; 794 return ChannelRGBA;
795 case GraphicsContext3D::RGB: 795 case GL_RGB:
796 case GraphicsContext3D::RGB565: 796 case GL_RGB565:
797 return ChannelRGB; 797 return ChannelRGB;
798 case GraphicsContext3D::RGBA: 798 case GL_RGBA:
799 case GraphicsContext3D::RGBA4: 799 case GL_RGBA4:
800 case GraphicsContext3D::RGB5_A1: 800 case GL_RGB5_A1:
801 return ChannelRGBA; 801 return ChannelRGBA;
802 case GraphicsContext3D::DEPTH_COMPONENT16: 802 case GL_DEPTH_COMPONENT16:
803 case GraphicsContext3D::DEPTH_COMPONENT: 803 case GL_DEPTH_COMPONENT:
804 return ChannelDepth; 804 return ChannelDepth;
805 case GraphicsContext3D::STENCIL_INDEX8: 805 case GL_STENCIL_INDEX8:
806 return ChannelStencil; 806 return ChannelStencil;
807 case GraphicsContext3D::DEPTH_STENCIL: 807 case GL_DEPTH_STENCIL_OES:
808 return ChannelDepth | ChannelStencil; 808 return ChannelDepth | ChannelStencil;
809 default: 809 default:
810 return 0; 810 return 0;
811 } 811 }
812 } 812 }
813 813
814 void GraphicsContext3D::paintFramebufferToCanvas(int framebuffer, int width, int height, bool premultiplyAlpha, ImageBuffer* imageBuffer) 814 void GraphicsContext3D::paintFramebufferToCanvas(int framebuffer, int width, int height, bool premultiplyAlpha, ImageBuffer* imageBuffer)
815 { 815 {
816 unsigned char* pixels = 0; 816 unsigned char* pixels = 0;
817 817
(...skipping 14 matching lines...) Expand all
832 if (!m_resizingBitmap.allocPixels()) 832 if (!m_resizingBitmap.allocPixels())
833 return; 833 return;
834 } 834 }
835 readbackBitmap = &m_resizingBitmap; 835 readbackBitmap = &m_resizingBitmap;
836 } 836 }
837 837
838 // Read back the frame buffer. 838 // Read back the frame buffer.
839 SkAutoLockPixels bitmapLock(*readbackBitmap); 839 SkAutoLockPixels bitmapLock(*readbackBitmap);
840 pixels = static_cast<unsigned char*>(readbackBitmap->getPixels()); 840 pixels = static_cast<unsigned char*>(readbackBitmap->getPixels());
841 841
842 m_impl->bindFramebuffer(FRAMEBUFFER, framebuffer); 842 m_impl->bindFramebuffer(GL_FRAMEBUFFER, framebuffer);
843 readBackFramebuffer(pixels, width, height, ReadbackSkia, premultiplyAlpha ? AlphaDoPremultiply : AlphaDoNothing); 843 readBackFramebuffer(pixels, width, height, ReadbackSkia, premultiplyAlpha ? AlphaDoPremultiply : AlphaDoNothing);
844 flipVertically(pixels, width, height); 844 flipVertically(pixels, width, height);
845 845
846 readbackBitmap->notifyPixelsChanged(); 846 readbackBitmap->notifyPixelsChanged();
847 if (m_resizingBitmap.readyToDraw()) { 847 if (m_resizingBitmap.readyToDraw()) {
848 // We need to draw the resizing bitmap into the canvas's backing store. 848 // We need to draw the resizing bitmap into the canvas's backing store.
849 SkCanvas canvas(*canvasBitmap); 849 SkCanvas canvas(*canvasBitmap);
850 SkRect dst; 850 SkRect dst;
851 dst.set(SkIntToScalar(0), SkIntToScalar(0), SkIntToScalar(canvasBitmap-> width()), SkIntToScalar(canvasBitmap->height())); 851 dst.set(SkIntToScalar(0), SkIntToScalar(0), SkIntToScalar(canvasBitmap-> width()), SkIntToScalar(canvasBitmap->height()));
852 canvas.drawBitmapRect(m_resizingBitmap, 0, dst); 852 canvas.drawBitmapRect(m_resizingBitmap, 0, dst);
(...skipping 24 matching lines...) Expand all
877 { 877 {
878 if (m_initializedAvailableExtensions) 878 if (m_initializedAvailableExtensions)
879 return; 879 return;
880 880
881 m_initializedAvailableExtensions = true; 881 m_initializedAvailableExtensions = true;
882 bool success = m_impl->makeContextCurrent(); 882 bool success = m_impl->makeContextCurrent();
883 ASSERT(success); 883 ASSERT(success);
884 if (!success) 884 if (!success)
885 return; 885 return;
886 886
887 String extensionsString = m_impl->getString(GraphicsContext3D::EXTENSIONS); 887 String extensionsString = m_impl->getString(GL_EXTENSIONS);
888 splitStringHelper(extensionsString, m_enabledExtensions); 888 splitStringHelper(extensionsString, m_enabledExtensions);
889 889
890 String requestableExtensionsString = m_impl->getRequestableExtensionsCHROMIU M(); 890 String requestableExtensionsString = m_impl->getRequestableExtensionsCHROMIU M();
891 splitStringHelper(requestableExtensionsString, m_requestableExtensions); 891 splitStringHelper(requestableExtensionsString, m_requestableExtensions);
892 } 892 }
893 893
894 894
895 bool GraphicsContext3D::supportsExtension(const String& name) 895 bool GraphicsContext3D::supportsExtension(const String& name)
896 { 896 {
897 initializeExtensions(); 897 initializeExtensions();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 for (unsigned i = 0; i < count; i++) { 935 for (unsigned i = 0; i < count; i++) {
936 uint8* rowA = framebuffer + i * rowBytes; 936 uint8* rowA = framebuffer + i * rowBytes;
937 uint8* rowB = framebuffer + (height - i - 1) * rowBytes; 937 uint8* rowB = framebuffer + (height - i - 1) * rowBytes;
938 memcpy(scanline, rowB, rowBytes); 938 memcpy(scanline, rowB, rowBytes);
939 memcpy(rowB, rowA, rowBytes); 939 memcpy(rowB, rowA, rowBytes);
940 memcpy(rowA, scanline, rowBytes); 940 memcpy(rowA, scanline, rowBytes);
941 } 941 }
942 } 942 }
943 943
944 } // namespace WebCore 944 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/platform/graphics/GraphicsContext3D.h ('k') | Source/platform/graphics/GraphicsContext3DImagePacking.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698