Changeset 106630 in webkit
- Timestamp:
- Feb 2, 2012 10:59:53 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 2 added
- 2 deleted
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r106628 r106630 1 2012-02-02 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r106620. 4 http://trac.webkit.org/changeset/106620 5 https://bugs.webkit.org/show_bug.cgi?id=77716 6 7 It broke non ENABLE(3D_RENDERING) builds (Requested by 8 Ossy_morning on #webkit). 9 10 * GNUmakefile.list.am: 11 * Target.pri: 12 * WebCore.gypi: 13 * platform/graphics/GraphicsContext.h: 14 (WebCore): 15 (GraphicsContext): 16 * platform/graphics/cairo/TextureMapperCairo.cpp: 17 (WebCore::TextureMapper::create): 18 (WebCore): 19 * platform/graphics/opengl/TextureMapperGL.cpp: 20 (Entry): 21 (DirectlyCompositedImageRepository): 22 (WebCore::TextureMapperGLData::DirectlyCompositedImageRepository::findOrCreate): 23 (WebCore::TextureMapperGLData::DirectlyCompositedImageRepository::deref): 24 (WebCore::TextureMapperGLData::DirectlyCompositedImageRepository::DirectlyCompositedImageRepository): 25 (WebCore::TextureMapperGLData::DirectlyCompositedImageRepository::~DirectlyCompositedImageRepository): 26 (TextureMapperGLData): 27 (BitmapTextureGL): 28 (WebCore::BitmapTextureGL::isOpaque): 29 (WebCore::BitmapTextureGL::pack): 30 (WebCore::BitmapTextureGL::unpack): 31 (WebCore::BitmapTextureGL::isPacked): 32 (WebCore::BitmapTextureGL::BitmapTextureGL): 33 (WebCore::TextureMapperGL::beginPainting): 34 (WebCore::BitmapTextureGL::reset): 35 (WebCore::BitmapTextureGL::beginPaint): 36 (WebCore::BitmapTextureGL::endPaint): 37 (WebCore): 38 (WebCore::BitmapTextureGL::updateContents): 39 (WebCore::BitmapTextureGL::updateRawContents): 40 (WebCore::BitmapTextureGL::setContentsToImage): 41 (WebCore::BitmapTextureGL::destroy): 42 (WebCore::TextureMapperGL::bindSurface): 43 * platform/graphics/opengl/TextureMapperGL.h: 44 (TextureMapperGL): 45 (WebCore::TextureMapperGL::allowSurfaceForRoot): 46 (BGRA32PremultimpliedBuffer): 47 (WebCore::BGRA32PremultimpliedBuffer::~BGRA32PremultimpliedBuffer): 48 (WebCore): 49 * platform/graphics/qt/GraphicsContext3DQt.cpp: 50 (WebCore::GraphicsContext3DPrivate::paintToTextureMapper): 51 * platform/graphics/qt/GraphicsContextQt.cpp: 52 * platform/graphics/qt/TextureMapperQt.cpp: Added. 53 (WebCore): 54 (WebCore::BitmapTextureQt::destroy): 55 (WebCore::BitmapTextureQt::reset): 56 (WebCore::BitmapTextureQt::beginPaint): 57 (WebCore::BitmapTextureQt::endPaint): 58 (WebCore::BitmapTextureQt::updateContents): 59 (WebCore::BitmapTextureQt::save): 60 (WebCore::BitmapTextureQt::setContentsToImage): 61 (WebCore::BitmapTextureQt::pack): 62 (WebCore::BitmapTextureQt::unpack): 63 (WebCore::TextureMapperQt::beginClip): 64 (WebCore::TextureMapperQt::endClip): 65 (WebCore::TextureMapperQt::viewportSize): 66 (WebCore::TextureMapperQt::TextureMapperQt): 67 (WebCore::TextureMapperQt::setGraphicsContext): 68 (WebCore::TextureMapperQt::graphicsContext): 69 (WebCore::TextureMapperQt::bindSurface): 70 (WebCore::TextureMapperQt::drawTexture): 71 (WebCore::TextureMapper::create): 72 (WebCore::TextureMapperQt::createTexture): 73 (WebCore::BitmapTextureQt::BitmapTextureQt): 74 (WebCore::TextureMapperQt::beginPainting): 75 (WebCore::TextureMapperQt::endPainting): 76 (BGRA32PremultimpliedBufferQt): 77 (WebCore::BGRA32PremultimpliedBufferQt::beginPaint): 78 (WebCore::BGRA32PremultimpliedBufferQt::endPaint): 79 (WebCore::BGRA32PremultimpliedBufferQt::data): 80 (WebCore::BGRA32PremultimpliedBuffer::create): 81 (WebCore::uidForImage): 82 * platform/graphics/qt/TextureMapperQt.h: Added. 83 (WebCore): 84 (BitmapTextureQt): 85 (WebCore::BitmapTextureQt::~BitmapTextureQt): 86 (WebCore::BitmapTextureQt::size): 87 (WebCore::BitmapTextureQt::isValid): 88 (WebCore::BitmapTextureQt::sourceRect): 89 (WebCore::BitmapTextureQt::isPacked): 90 (WebCore::BitmapTextureQt::painter): 91 (TextureMapperQt): 92 (WebCore::TextureMapperQt::allowSurfaceForRoot): 93 (WebCore::TextureMapperQt::initialize): 94 (WebCore::TextureMapperQt::create): 95 (WebCore::TextureMapperQt::currentPainter): 96 * platform/graphics/texmap/TextureMapper.cpp: 97 * platform/graphics/texmap/TextureMapper.h: 98 (WebCore::BitmapTexture::BitmapTexture): 99 (WebCore::BitmapTexture::allowOfflineTextureUpload): 100 (BitmapTexture): 101 (WebCore::BitmapTexture::pack): 102 (WebCore::BitmapTexture::unpack): 103 (WebCore::BitmapTexture::isPacked): 104 (WebCore::BitmapTexture::updateRawContents): 105 (WebCore::BitmapTexture::beginPaintMedia): 106 (WebCore::BitmapTexture::save): 107 (WebCore::BitmapTexture::lock): 108 (WebCore::BitmapTexture::unlock): 109 (WebCore::BitmapTexture::isLocked): 110 (TextureMapper): 111 (WebCore::TextureMapper::viewportSize): 112 (WebCore::TextureMapper::setViewportSize): 113 (WebCore::TextureMapper::allowPartialUpdates): 114 (WebCore::TextureMapper::isOpenGLBacked): 115 (WebCore::TextureMapper::setTransform): 116 (WebCore::TextureMapper::transform): 117 * platform/graphics/texmap/TextureMapperImageBuffer.cpp: Removed. 118 * platform/graphics/texmap/TextureMapperImageBuffer.h: Removed. 119 * platform/graphics/texmap/TextureMapperNode.cpp: 120 (WebCore::TextureMapperNode::renderContent): 121 (WebCore::TextureMapperNode::setContentsTileBackBuffer): 122 * platform/graphics/texmap/TextureMapperNode.h: 123 (TextureMapperNode): 124 1 125 2012-02-02 Keishi Hattori <keishi@webkit.org> 2 126 -
trunk/Source/WebCore/GNUmakefile.list.am
r106620 r106630 5734 5734 Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp \ 5735 5735 Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h \ 5736 Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp \ 5737 Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h \ 5738 Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp \ 5739 Source/WebCore/platform/graphics/texmap/TextureMapperNode.h \ 5740 Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h 5736 Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp \ 5737 Source/WebCore/platform/graphics/texmap/TextureMapperNode.h \ 5738 Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h 5741 5739 webcoregtk_sources += \ 5742 5740 Source/WebCore/platform/graphics/cairo/TextureMapperCairo.cpp \ … … 5756 5754 Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp \ 5757 5755 Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h \ 5758 Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp \ 5759 Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h \ 5760 Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp \ 5761 Source/WebCore/platform/graphics/texmap/TextureMapperNode.h \ 5756 Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp \ 5757 Source/WebCore/platform/graphics/texmap/TextureMapperNode.h \ 5762 5758 Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h 5763 5759 webcoregtk_sources += \ -
trunk/Source/WebCore/Target.pri
r106620 r106630 3940 3940 contains(CONFIG, texmap) { 3941 3941 HEADERS += \ 3942 platform/graphics/qt/TextureMapperQt.h \ 3942 3943 platform/graphics/texmap/GraphicsLayerTextureMapper.h \ 3943 3944 platform/graphics/texmap/LayerTransform.h \ 3944 3945 platform/graphics/texmap/TextureMapper.h \ 3945 3946 platform/graphics/texmap/TextureMapperAnimation.h \ 3946 platform/graphics/texmap/TextureMapperImageBuffer.h \3947 3947 platform/graphics/texmap/TextureMapperNode.h \ 3948 3948 platform/graphics/texmap/TextureMapperPlatformLayer.h 3949 3949 3950 3950 SOURCES += \ 3951 platform/graphics/qt/TextureMapperQt.cpp \ 3951 3952 platform/graphics/texmap/LayerTransform.cpp \ 3952 3953 platform/graphics/texmap/TextureMapper.cpp \ 3953 3954 platform/graphics/texmap/TextureMapperAnimation.cpp \ 3954 platform/graphics/texmap/TextureMapperImageBuffer.cpp \3955 3955 platform/graphics/texmap/TextureMapperNode.cpp \ 3956 3956 platform/graphics/texmap/GraphicsLayerTextureMapper.cpp … … 3960 3960 SOURCES += platform/graphics/opengl/TextureMapperGL.cpp 3961 3961 CONFIG += opengl-shims 3962 DEFINES += WTF_USE_TEXTURE_MAPPER_GL3963 3962 } 3964 3963 } else { -
trunk/Source/WebCore/WebCore.gypi
r106620 r106630 3581 3581 'platform/graphics/texmap/TextureMapperAnimation.cpp', 3582 3582 'platform/graphics/texmap/TextureMapperAnimation.h', 3583 'platform/graphics/texmap/TextureMapperImageBuffer.cpp',3584 'platform/graphics/texmap/TextureMapperImageBuffer.h',3585 3583 'platform/graphics/texmap/TextureMapperNode.cpp', 3586 3584 'platform/graphics/texmap/TextureMapperNode.h', -
trunk/Source/WebCore/platform/graphics/GraphicsContext.h
r106620 r106630 125 125 class GraphicsContext3D; 126 126 class TextRun; 127 class TransformationMatrix;128 127 129 128 enum TextDrawingMode { … … 411 410 AffineTransform getCTM() const; 412 411 413 #if ENABLE(3D_RENDERING) && USE(TEXTURE_MAPPER)414 // This is needed when using accelerated-compositing in software mode, like in TextureMapper.415 void concat3DTransform(const TransformationMatrix&);416 void set3DTransform(const TransformationMatrix&);417 TransformationMatrix get3DTransform() const;418 #endif419 412 // Create an image buffer compatible with this context, with suitable resolution 420 413 // for drawing into the buffer and then into this context. -
trunk/Source/WebCore/platform/graphics/cairo/TextureMapperCairo.cpp
r106620 r106630 116 116 } 117 117 118 PassOwnPtr<TextureMapper> TextureMapper::create(GraphicsContext* context) 119 { 120 return adoptPtr(new TextureMapperCairo); 121 } 122 118 123 PassRefPtr<BitmapTexture> TextureMapperCairo::createTexture() 119 124 { -
trunk/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp
r106620 r106630 266 266 }; 267 267 268 struct DirectlyCompositedImageRepository { 269 struct Entry { 270 GLuint texture; 271 int refCount; 272 }; 273 typedef HashMap<ImageUID, Entry> ImageTextureMap; 274 ImageTextureMap imageToTexture; 275 276 GLuint findOrCreate(ImageUID image, bool& found) 277 { 278 ImageTextureMap::iterator it = imageToTexture.find(image); 279 found = false; 280 if (it != imageToTexture.end()) { 281 it->second.refCount++; 282 found = true; 283 return it->second.texture; 284 } 285 Entry entry; 286 GL_CMD(glGenTextures(1, &entry.texture)); 287 entry.refCount = 1; 288 imageToTexture.add(image, entry); 289 return entry.texture; 290 } 291 292 bool deref(ImageUID image) 293 { 294 HashMap<ImageUID, Entry>::iterator it = imageToTexture.find(image); 295 if (it != imageToTexture.end()) { 296 if (it->second.refCount < 2) { 297 imageToTexture.remove(it); 298 return false; 299 } 300 } 301 return true; 302 } 303 304 DirectlyCompositedImageRepository() 305 { 306 } 307 308 ~DirectlyCompositedImageRepository() 309 { 310 for (ImageTextureMap::iterator it = imageToTexture.begin(); it != imageToTexture.end(); ++it) { 311 GLuint texture = it->second.texture; 312 if (texture) 313 GL_CMD(glDeleteTextures(1, &texture)); 314 } 315 316 } 317 } directlyCompositedImages; 318 268 319 SharedGLData& sharedGLData() const 269 320 { … … 282 333 GLint previousProgram; 283 334 GLint previousScissorState; 284 GLint viewport[4];285 335 RefPtr<SharedGLData> m_sharedGLData; 286 336 }; … … 293 343 virtual void reset(const IntSize&, bool opaque); 294 344 void bind(); 345 virtual PlatformGraphicsContext* beginPaint(const IntRect& dirtyRect); 346 virtual void endPaint(); 347 virtual void setContentsToImage(Image*); 295 348 ~BitmapTextureGL() { destroy(); } 296 349 virtual uint32_t id() const { return m_id; } 350 inline bool isOpaque() const { return m_opaque; } 297 351 inline FloatSize relativeSize() const { return m_relativeSize; } 298 352 void setTextureMapper(TextureMapperGL* texmap) { m_textureMapper = texmap; } 299 void updateContents(Image*, const IntRect&, const IntRect&, PixelFormat); 300 void updateContents(const void*, const IntRect&); 353 354 void updateContents(PixelFormat, const IntRect&, void*); 355 void updateRawContents(const IntRect&, const void*); 356 void pack() 357 { 358 // This is currently a stub. 359 if (isPacked()) 360 return; 361 m_isPacked = true; 362 } 363 364 void unpack() 365 { 366 // This is currently a stub. 367 if (!isPacked()) 368 return; 369 m_isPacked = false; 370 } 371 372 bool isPacked() const 373 { 374 return m_isPacked; 375 } 301 376 302 377 private: 303 378 GLuint m_id; 379 ImageUID m_imageUID; 304 380 FloatSize m_relativeSize; 381 bool m_opaque; 305 382 IntSize m_textureSize; 383 OwnPtr<BGRA32PremultimpliedBuffer> m_buffer; 306 384 IntRect m_dirtyRect; 307 385 GLuint m_fbo; … … 309 387 IntSize m_actualSize; 310 388 bool m_surfaceNeedsReset; 389 bool m_isPacked; 311 390 TextureMapperGL* m_textureMapper; 312 391 BitmapTextureGL() 313 392 : m_id(0) 393 , m_imageUID(0) 394 , m_opaque(false) 314 395 , m_fbo(0) 315 396 , m_rbo(0) … … 464 545 glClearStencil(0); 465 546 glClear(GL_STENCIL_BUFFER_BIT); 466 glGetIntegerv(GL_VIEWPORT, data().viewport);467 547 bindSurface(0); 468 548 } … … 584 664 { 585 665 BitmapTexture::reset(newSize, opaque); 666 m_imageUID = 0; 586 667 IntSize newTextureSize = nextPowerOfTwo(newSize); 587 668 bool justCreated = false; … … 602 683 m_actualSize = newSize; 603 684 m_relativeSize = FloatSize(float(newSize.width()) / m_textureSize.width(), float(newSize.height()) / m_textureSize.height()); 685 m_opaque = opaque; 604 686 m_surfaceNeedsReset = true; 605 687 } 606 688 607 689 PlatformGraphicsContext* BitmapTextureGL::beginPaint(const IntRect& dirtyRect) 690 { 691 m_buffer = BGRA32PremultimpliedBuffer::create(); 692 m_dirtyRect = dirtyRect; 693 return m_buffer->beginPaint(dirtyRect, m_opaque); 694 } 695 696 void BitmapTextureGL::endPaint() 697 { 698 if (!m_buffer) 699 return; 700 m_buffer->endPaint(); 701 updateContents(BGRAFormat, m_dirtyRect, m_buffer->data()); 702 GL_CMD(glBindTexture(GL_TEXTURE_2D, m_id)) 703 m_buffer.clear(); 704 } 705 706 #ifdef TEXMAP_OPENGL_ES_2 608 707 static void swizzleBGRAToRGBA(uint32_t* data, const IntSize& size) 609 708 { … … 616 715 } 617 716 } 618 619 void BitmapTextureGL::updateContents(const void* data, const IntRect& targetRect) 717 #endif 718 719 void BitmapTextureGL::updateContents(PixelFormat pixelFormat, const IntRect& rect, void* bits) 620 720 { 621 721 GL_CMD(glBindTexture(GL_TEXTURE_2D, m_id)) 622 GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), GL_RGBA, GL_UNSIGNED_BYTE, data)) 623 } 624 625 void BitmapTextureGL::updateContents(Image* image, const IntRect& targetRect, const IntRect& sourceRect, BitmapTexture::PixelFormat format) 626 { 627 if (!image) 628 return; 722 #ifdef TEXMAP_OPENGL_ES_2 723 bool shouldSwizzle = false; 724 #endif 725 726 GLint glFormat = GL_RGBA; 727 switch (pixelFormat) { 728 case RGBAFormat: 729 glFormat = GL_RGBA; 730 break; 731 case RGBFormat: 732 glFormat = GL_RGB; 733 break; 734 case BGRAFormat: 735 #ifdef TEXMAP_OPENGL_ES_2 736 shouldSwizzle = true; 737 glFormat = GL_RGBA; 738 #else 739 glFormat = GL_BGRA; 740 #endif 741 break; 742 case BGRFormat: 743 #ifdef TEXMAP_OPENGL_ES_2 744 shouldSwizzle = true; 745 glFormat = GL_RGB; 746 #else 747 glFormat = GL_BGR; 748 #endif 749 break; 750 } 751 752 #ifdef TEXMAP_OPENGL_ES_2 753 if (shouldSwizzle) 754 swizzleBGRAToRGBA(static_cast<uint32_t*>(bits), rect.size()); 755 #endif 756 GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.width(), rect.height(), glFormat, GL_UNSIGNED_BYTE, bits)) 757 } 758 759 void BitmapTextureGL::updateRawContents(const IntRect& rect, const void* bits) 760 { 629 761 GL_CMD(glBindTexture(GL_TEXTURE_2D, m_id)) 630 762 GLuint glFormat = isOpaque() ? GL_RGB : GL_RGBA; 631 NativeImagePtr frameImage = image->nativeImageForCurrentFrame(); 632 if (!frameImage) 633 return; 634 635 #if PLATFORM(QT) 636 QImage qtImage = frameImage->toImage(); 637 if (IntSize(qtImage.size()) != sourceRect.size()) 638 qtImage = qtImage.copy(sourceRect); 639 if (format == BGRAFormat || format == BGRFormat) 640 swizzleBGRAToRGBA(reinterpret_cast<uint32_t*>(qtImage.bits()), qtImage.size()); 641 GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), glFormat, GL_UNSIGNED_BYTE, qtImage.constBits())) 642 #endif 763 GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.width(), rect.height(), glFormat, GL_UNSIGNED_BYTE, bits)) 764 } 765 766 void BitmapTextureGL::setContentsToImage(Image* image) 767 { 768 ImageUID uid = image ? uidForImage(image) : 0; 769 if (!image || !uid) { 770 if (m_imageUID) 771 destroy(); 772 return; 773 } 774 775 if (uid == m_imageUID) 776 return; 777 bool found = false; 778 GLuint newTextureID = m_textureMapper->data().directlyCompositedImages.findOrCreate(uid, found); 779 if (newTextureID != m_id) { 780 m_imageUID = uid; 781 destroy(); 782 m_id = newTextureID; 783 reset(image->size(), false); 784 if (!found) { 785 GraphicsContext context(beginPaint(IntRect(0, 0, m_textureSize.width(), m_textureSize.height()))); 786 context.drawImage(image, ColorSpaceDeviceRGB, IntPoint(0, 0), CompositeCopy); 787 endPaint(); 788 } 789 } 643 790 } 644 791 … … 691 838 void BitmapTextureGL::destroy() 692 839 { 693 if (m_id )840 if (m_id && (!m_imageUID || !m_textureMapper->data().directlyCompositedImages.deref(m_imageUID))) 694 841 GL_CMD(glDeleteTextures(1, &m_id)) 695 842 … … 726 873 727 874 if (!surface) { 728 IntSize viewportSize(data().viewport[2], data().viewport[3]);729 875 GL_CMD(glBindFramebuffer(GL_FRAMEBUFFER, 0)) 730 data().projectionMatrix = createProjectionMatrix(viewportSize , true);876 data().projectionMatrix = createProjectionMatrix(viewportSize(), true).multiply(transform()); 731 877 GL_CMD(glStencilFunc(data().sharedGLData().stencilIndex > 1 ? GL_EQUAL : GL_ALWAYS, data().sharedGLData().stencilIndex - 1, data().sharedGLData().stencilIndex - 1)) 732 878 GL_CMD(glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP)) 733 GL_CMD(glViewport(0, 0, viewportSize .width(), viewportSize.height()))734 data().sharedGLData().clipStack.append(IntRect( data().viewport[0], data().viewport[1], data().viewport[2], data().viewport[3]));879 GL_CMD(glViewport(0, 0, viewportSize().width(), viewportSize().height())) 880 data().sharedGLData().clipStack.append(IntRect(IntPoint::zero(), viewportSize())); 735 881 return; 736 882 } … … 840 986 } 841 987 842 PassOwnPtr<TextureMapper> TextureMapper::platformCreateAccelerated()843 {844 return TextureMapperGL::create();845 }846 847 988 }; -
trunk/Source/WebCore/platform/graphics/opengl/TextureMapperGL.h
r106620 r106630 44 44 virtual void bindSurface(BitmapTexture* surface); 45 45 virtual void beginClip(const TransformationMatrix&, const FloatRect&); 46 virtual void beginPainting();47 virtual void endPainting();48 46 virtual void endClip(); 47 virtual bool allowSurfaceForRoot() const { return false; } 49 48 virtual PassRefPtr<BitmapTexture> createTexture(); 50 49 virtual const char* type() const; 51 50 static PassOwnPtr<TextureMapperGL> create() { return adoptPtr(new TextureMapperGL); } 51 void beginPainting(); 52 void endPainting(); 52 53 void setGraphicsContext(GraphicsContext* context) { m_context = context; } 53 54 GraphicsContext* graphicsContext() { return m_context; } 54 55 virtual bool isOpenGLBacked() const { return true; } 55 void platformUpdateContents(NativeImagePtr, const IntRect&, const IntRect&, BitmapTexture::PixelFormat);56 virtual AccelerationMode accelerationMode() const { return OpenGLMode; }57 56 58 57 private: … … 66 65 67 66 // An offscreen buffer to be rendered by software. 67 class BGRA32PremultimpliedBuffer { 68 WTF_MAKE_FAST_ALLOCATED; 69 public: 70 virtual ~BGRA32PremultimpliedBuffer() { } 71 virtual PlatformGraphicsContext* beginPaint(const IntRect& dirtyRect, bool opaque) = 0; 72 virtual void endPaint() = 0; 73 virtual void* data() = 0; 74 static PassOwnPtr<BGRA32PremultimpliedBuffer> create(); 75 }; 76 68 77 static inline int nextPowerOfTwo(int num) 69 78 { -
trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
r106620 r106630 147 147 blitMultisampleFramebufferAndRestoreContext(); 148 148 149 if (textureMapper-> accelerationMode() == TextureMapper::OpenGLMode) {149 if (textureMapper->isOpenGLBacked()) { 150 150 TextureMapperGL* texmapGL = static_cast<TextureMapperGL*>(textureMapper); 151 151 texmapGL->drawTexture(m_context->m_texture, !m_context->m_attrs.alpha, FloatSize(1, 1), targetRect, matrix, opacity, mask, true /* flip */); -
trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
r106620 r106630 1336 1336 } 1337 1337 1338 #if ENABLE(3D_RENDERING) && USE(TEXTURE_MAPPER)1339 TransformationMatrix GraphicsContext::get3DTransform() const1340 {1341 if (paintingDisabled())1342 return TransformationMatrix();1343 1344 return platformContext()->combinedTransform();1345 }1346 1347 void GraphicsContext::concat3DTransform(const TransformationMatrix& transform)1348 {1349 if (paintingDisabled())1350 return;1351 1352 m_data->p()->setWorldTransform(transform, true);1353 }1354 1355 void GraphicsContext::set3DTransform(const TransformationMatrix& transform)1356 {1357 if (paintingDisabled())1358 return;1359 1360 m_data->p()->setWorldTransform(transform, false);1361 }1362 #endif1363 1364 1338 void GraphicsContext::setURLForRect(const KURL&, const IntRect&) 1365 1339 { -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.cpp
r106620 r106630 20 20 #include "config.h" 21 21 #include "TextureMapper.h" 22 23 #include "TextureMapperImageBuffer.h"24 22 25 23 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) … … 74 72 } 75 73 76 77 PassOwnPtr<TextureMapper> TextureMapper::create(AccelerationMode mode)78 {79 if (mode == SoftwareMode)80 return TextureMapperImageBuffer::create();81 return platformCreateAccelerated();82 }83 84 74 } 85 75 #endif -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.h
r106620 r106630 48 48 public: 49 49 enum PixelFormat { BGRAFormat, RGBAFormat, BGRFormat, RGBFormat }; 50 BitmapTexture() 51 : m_isOpaque(true) 52 { 53 } 54 50 BitmapTexture() : m_lockCount(0) {} 55 51 virtual ~BitmapTexture() { } 56 52 virtual void destroy() { } 57 53 54 virtual bool allowOfflineTextureUpload() const { return false; } 58 55 virtual IntSize size() const = 0; 59 virtual void updateContents(Image*, const IntRect&, const IntRect&, BitmapTexture::PixelFormat) = 0; 60 virtual void updateContents(const void*, const IntRect&) = 0; 56 virtual int bpp() const { return 32; } 61 57 virtual bool isValid() const = 0; 62 63 virtual int bpp() const { return 32; }64 58 virtual void reset(const IntSize& size, bool opaque = false) 65 59 { … … 68 62 } 69 63 64 virtual void pack() { } 65 virtual void unpack() { } 66 virtual bool isPacked() const { return false; } 67 68 virtual PlatformGraphicsContext* beginPaint(const IntRect& dirtyRect) = 0; 69 virtual void endPaint() = 0; 70 71 // For performance reasons, BitmapTexture might modify the bits directly (swizzle). 72 // Thus, this method is only recommended for buffer update, such as used by WebKit2. 73 virtual void updateContents(PixelFormat, const IntRect&, void* bits) = 0; 74 virtual void updateRawContents(const IntRect&, const void* bits) { } 75 virtual PlatformGraphicsContext* beginPaintMedia() 76 { 77 return beginPaint(IntRect(0, 0, size().width(), size().height())); 78 } 79 virtual void setContentsToImage(Image*) = 0; 80 virtual bool save(const String&) { return false; } 81 82 inline void lock() { ++m_lockCount; } 83 inline void unlock() { --m_lockCount; } 84 inline bool isLocked() { return m_lockCount; } 70 85 inline IntSize contentSize() const { return m_contentSize; } 71 86 inline int numberOfBytes() const { return size().width() * size().height() * bpp() >> 3; } 72 inline bool isOpaque() const { return m_isOpaque; }73 87 74 88 protected: 89 int m_lockCount; 75 90 IntSize m_contentSize; 76 91 bool m_isOpaque; … … 83 98 84 99 public: 85 enum AccelerationMode { SoftwareMode, OpenGLMode }; 86 static PassOwnPtr<TextureMapper> create(AccelerationMode newMode = SoftwareMode); 100 static PassOwnPtr<TextureMapper> create(GraphicsContext* graphicsContext = 0); 87 101 virtual ~TextureMapper() { } 88 102 … … 91 105 // makes a surface the target for the following drawTexture calls. 92 106 virtual void bindSurface(BitmapTexture* surface) = 0; 93 virtual void setGraphicsContext(GraphicsContext* context) { m_context = context; }94 virtual GraphicsContext* graphicsContext() { return m_context; }107 virtual void setGraphicsContext(GraphicsContext*) = 0; 108 virtual GraphicsContext* graphicsContext() = 0; 95 109 virtual void beginClip(const TransformationMatrix&, const FloatRect&) = 0; 96 110 virtual void endClip() = 0; 111 virtual bool allowSurfaceForRoot() const = 0; 97 112 virtual PassRefPtr<BitmapTexture> createTexture() = 0; 113 IntSize viewportSize() const { return m_viewportSize; } 114 void setViewportSize(const IntSize& s) { m_viewportSize = s; } 98 115 99 116 void setImageInterpolationQuality(InterpolationQuality quality) { m_interpolationQuality = quality; } … … 102 119 InterpolationQuality imageInterpolationQuality() const { return m_interpolationQuality; } 103 120 TextDrawingModeFlags textDrawingMode() const { return m_textDrawingMode; } 104 virtual AccelerationMode accelerationMode() const = 0; 121 virtual bool allowPartialUpdates() const { return false; } 122 virtual bool isOpenGLBacked() const { return false; } 123 124 void setTransform(const TransformationMatrix& matrix) { m_transform = matrix; } 125 TransformationMatrix transform() const { return m_transform; } 105 126 106 127 virtual void beginPainting() { } … … 109 130 // A surface is released implicitly when dereferenced. 110 131 virtual PassRefPtr<BitmapTexture> acquireTextureFromPool(const IntSize&); 132 111 133 112 134 protected: … … 117 139 118 140 private: 119 #if USE(TEXTURE_MAPPER_GL)120 static PassOwnPtr<TextureMapper> platformCreateAccelerated();121 #else122 static PassOwnPtr<TextureMapper> platformCreateAccelerated()123 {124 return 0;125 }126 #endif127 141 InterpolationQuality m_interpolationQuality; 128 142 TextDrawingModeFlags m_textDrawingMode; 143 TransformationMatrix m_transform; 144 IntSize m_viewportSize; 129 145 Vector<RefPtr<BitmapTexture> > m_texturePool; 130 GraphicsContext* m_context;131 146 }; 132 147 133 } 148 }; 134 149 135 150 #endif -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp
r106620 r106630 24 24 25 25 #include "GraphicsLayerTextureMapper.h" 26 #include "ImageBuffer.h"27 26 #include "MathExtras.h" 28 27 … … 158 157 return; 159 158 160 IntRect dirtyRect = enclosingIntRect(m_currentContent.needsDisplay ? entireRect() : m_currentContent.needsDisplayRect); 159 // FIXME: Add directly composited images. 160 FloatRect dirtyRect = m_currentContent.needsDisplay ? entireRect() : m_currentContent.needsDisplayRect; 161 161 162 162 for (size_t tileIndex = 0; tileIndex < m_ownedTiles.size(); ++tileIndex) { 163 163 OwnedTile& tile = m_ownedTiles[tileIndex]; 164 FloatRect rect = dirtyRect; 164 165 if (!tile.texture) 165 166 tile.texture = textureMapper->createTexture(); … … 169 170 if (tile.needsReset || texture->contentSize() != tileSize || !texture->isValid()) { 170 171 tile.needsReset = false; 171 texture->reset(tileSize, m_state.contentsOpaque); 172 dirtyRect.unite(enclosingIntRect(tile.rect)); 173 } 174 } 175 176 if (dirtyRect.isEmpty()) 177 return; 178 179 // Paint the entire dirty rect into an image buffer. This ensures we only paint once. 180 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(dirtyRect.size()); 181 GraphicsContext* context = imageBuffer->context(); 182 context->setImageInterpolationQuality(textureMapper->imageInterpolationQuality()); 183 context->setTextDrawingMode(textureMapper->textDrawingMode()); 184 context->translate(-dirtyRect.x(), -dirtyRect.y()); 185 layer->paintGraphicsLayerContents(*context, dirtyRect); 186 if (m_currentContent.contentType == DirectImageContentType) 187 context->drawImage(m_currentContent.image.get(), ColorSpaceDeviceRGB, m_state.contentsRect); 188 189 // FIXME: Implement ImageBuffer::DontCopyBackingStore in Qt/GTK ports, and then change this. 190 // See https://bugs.webkit.org/show_bug.cgi?id=77689 191 RefPtr<Image> image = imageBuffer->copyImage(CopyBackingStore); 192 193 // Divide the image to tiles. 194 for (size_t tileIndex = 0; tileIndex < m_ownedTiles.size(); ++tileIndex) { 195 OwnedTile& tile = m_ownedTiles[tileIndex]; 196 IntRect targetRect = enclosingIntRect(tile.rect); 197 targetRect.intersect(dirtyRect); 198 if (targetRect.isEmpty()) 172 texture->reset(tileSize, m_currentContent.contentType == DirectImageContentType ? false : m_state.contentsOpaque); 173 rect = tile.rect; 174 } 175 176 IntRect contentRect = enclosingIntRect(tile.rect); 177 contentRect.intersect(enclosingIntRect(rect)); 178 if (contentRect.isEmpty()) 199 179 continue; 200 IntRect sourceRect = targetRect; 201 202 // Normalize sourceRect to the buffer's coordinates. 203 sourceRect.move(-dirtyRect.x(), -dirtyRect.y()); 204 205 // Normalize targetRect to the texture's coordinqates. 206 targetRect.move(-tile.rect.x(), -tile.rect.y()); 207 tile.texture->updateContents(image.get(), targetRect, sourceRect, BitmapTexture::RGBAFormat); 180 181 FloatRect contentRectInTileCoordinates = contentRect; 182 FloatPoint offset(-tile.rect.x(), -tile.rect.y()); 183 contentRectInTileCoordinates.move(offset.x(), offset.y()); 184 185 { 186 GraphicsContext context(texture->beginPaint(enclosingIntRect(contentRectInTileCoordinates))); 187 context.setImageInterpolationQuality(textureMapper->imageInterpolationQuality()); 188 context.setTextDrawingMode(textureMapper->textDrawingMode()); 189 context.translate(offset.x(), offset.y()); 190 FloatRect scaledContentRect(contentRect); 191 if (m_currentContent.contentType == DirectImageContentType) 192 context.drawImage(m_currentContent.image.get(), ColorSpaceDeviceRGB, IntPoint(0, 0)); 193 else 194 layer->paintGraphicsLayerContents(context, enclosingIntRect(scaledContentRect)); 195 texture->endPaint(); 196 } 208 197 } 209 198 … … 493 482 } 494 483 495 void TextureMapperNode::setContentsTileBackBuffer(int id, const IntRect& sourceRect, const IntRect& targetRect, const void* data)484 void TextureMapperNode::setContentsTileBackBuffer(int id, const IntRect& sourceRect, const IntRect& targetRect, const void* bits) 496 485 { 497 486 ASSERT(m_textureMapper); … … 510 499 tile.backBuffer.texture = m_textureMapper->createTexture(); 511 500 tile.backBuffer.texture->reset(sourceRect.size(), false); 512 tile.backBuffer.texture->update Contents(data, sourceRect);501 tile.backBuffer.texture->updateRawContents(sourceRect, bits); 513 502 tile.isBackBufferUpdated = true; 514 503 } -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperNode.h
r106620 r106630 149 149 int createContentsTile(float scale); 150 150 void removeContentsTile(int id); 151 void setContentsTileBackBuffer(int id, const IntRect& sourceRect, const IntRect& targetRect, const void* );151 void setContentsTileBackBuffer(int id, const IntRect& sourceRect, const IntRect& targetRect, const void* bits); 152 152 void setTileBackBufferTextureForDirectlyCompositedImage(int id, const IntRect& sourceRect, const FloatRect& targetRect, BitmapTexture*); 153 153 void clearAllDirectlyCompositedImageTiles(); -
trunk/Source/WebKit/qt/Api/qwebframe.cpp
r106620 r106630 337 337 textureMapper->setImageInterpolationQuality(context->imageInterpolationQuality()); 338 338 textureMapper->setTextDrawingMode(context->textDrawingMode()); 339 textureMapper->setViewportSize(frame->view()->frameRect().size()); 339 340 QPainter* painter = context->platformContext(); 340 341 const QTransform transform = painter->worldTransform(); -
trunk/Source/WebKit/qt/ChangeLog
r106620 r106630 1 2012-02-02 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r106620. 4 http://trac.webkit.org/changeset/106620 5 https://bugs.webkit.org/show_bug.cgi?id=77716 6 7 It broke non ENABLE(3D_RENDERING) builds (Requested by 8 Ossy_morning on #webkit). 9 10 * Api/qwebframe.cpp: 11 (QWebFramePrivate::renderCompositedLayers): 12 * WebCoreSupport/PageClientQt.cpp: 13 (WebCore::PageClientQWidget::setRootGraphicsLayer): 14 (WebCore::PageClientQGraphicsWidget::setRootGraphicsLayer): 15 1 16 2012-02-02 No'am Rosenthal <noam.rosenthal@nokia.com> 2 17 -
trunk/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp
r106620 r106630 29 29 30 30 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) 31 #include "TextureMapper .h"31 #include "TextureMapperQt.h" 32 32 #include "texmap/TextureMapperNode.h" 33 34 #if USE(TEXTURE_MAPPER_GL) 35 #include "opengl/TextureMapperGL.h" 36 #endif 33 37 #endif 34 38 … … 73 77 if (layer) { 74 78 textureMapperNodeClient = adoptPtr(new TextureMapperNodeClientQt(page->mainFrame(), layer)); 75 textureMapperNodeClient->setTextureMapper( TextureMapper::create());79 textureMapperNodeClient->setTextureMapper(adoptPtr(new TextureMapperQt)); 76 80 textureMapperNodeClient->syncRootLayer(); 77 81 return; … … 264 268 QGraphicsView* graphicsView = view->scene()->views()[0]; 265 269 if (graphicsView && graphicsView->viewport() && graphicsView->viewport()->inherits("QGLWidget")) { 266 textureMapperNodeClient->setTextureMapper(TextureMapper ::create(TextureMapper::OpenGLMode));270 textureMapperNodeClient->setTextureMapper(TextureMapperGL::create()); 267 271 return; 268 272 } 269 273 #endif 270 textureMapperNodeClient->setTextureMapper(TextureMapper ::create());274 textureMapperNodeClient->setTextureMapper(TextureMapperQt::create()); 271 275 return; 272 276 } -
trunk/Source/WebKit2/ChangeLog
r106620 r106630 1 2012-02-02 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r106620. 4 http://trac.webkit.org/changeset/106620 5 https://bugs.webkit.org/show_bug.cgi?id=77716 6 7 It broke non ENABLE(3D_RENDERING) builds (Requested by 8 Ossy_morning on #webkit). 9 10 * UIProcess/qt/LayerTreeHostProxyQt.cpp: 11 (WebKit::LayerTreeHostProxy::paintToCurrentGLContext): 12 (WebKit::LayerTreeHostProxy::paintToGraphicsContext): 13 (WebKit::LayerTreeHostProxy::createImage): 14 (WebKit::LayerTreeHostProxy::ensureRootLayer): 15 1 16 2012-02-02 No'am Rosenthal <noam.rosenthal@nokia.com> 2 17 -
trunk/Source/WebKit2/UIProcess/qt/LayerTreeHostProxyQt.cpp
r106620 r106630 27 27 #include "MessageID.h" 28 28 #include "ShareableBitmap.h" 29 #include "TextureMapper.h" 29 #include "TextureMapperGL.h" 30 #include "TextureMapperQt.h" 30 31 #include "UpdateInfo.h" 31 32 #include "WebCoreArgumentCoders.h" … … 171 172 { 172 173 if (!m_textureMapper) 173 m_textureMapper = TextureMapper ::create(TextureMapper::OpenGLMode);174 ASSERT( m_textureMapper->accelerationMode() == TextureMapper::OpenGLMode);174 m_textureMapper = TextureMapperGL::create(); 175 ASSERT(dynamic_cast<TextureMapperGL*>(m_textureMapper.get())); 175 176 176 177 syncRemoteContent(); … … 184 185 return; 185 186 187 GLint viewport[4]; 188 glGetIntegerv(GL_VIEWPORT, viewport); 189 m_textureMapper->setViewportSize(IntSize(viewport[2], viewport[3])); 186 190 node->setTextureMapper(m_textureMapper.get()); 187 191 m_textureMapper->beginPainting(); … … 208 212 { 209 213 if (!m_textureMapper) 210 m_textureMapper = TextureMapper::create(); 211 ASSERT(m_textureMapper->accelerationMode() == TextureMapper::SoftwareMode); 214 m_textureMapper = TextureMapperQt::create(); 215 ASSERT(dynamic_cast<TextureMapperQt*>(m_textureMapper.get())); 216 212 217 syncRemoteContent(); 213 218 TextureMapperNode* node = toTextureMapperNode(rootLayer()); … … 406 411 RefPtr<BitmapTexture> texture = m_textureMapper->createTexture(); 407 412 texture->reset(rect.size(), !imageHasAlpha); 408 texture->update Contents(subImage.constBits(), IntRect(IntPoint::zero(), rect.size()));413 texture->updateRawContents(IntRect(IntPoint::zero(), rect.size()), subImage.constBits()); 409 414 tiledImage.add(rect.location(), texture); 410 415 } … … 469 474 m_rootLayer->setSize(FloatSize(1.0, 1.0)); 470 475 if (!m_textureMapper) 471 m_textureMapper = TextureMapper ::create(TextureMapper::OpenGLMode);476 m_textureMapper = TextureMapperGL::create(); 472 477 toTextureMapperNode(m_rootLayer.get())->setTextureMapper(m_textureMapper.get()); 473 478 }
Note: See TracChangeset
for help on using the changeset viewer.