Changeset 145968 in webkit
- Timestamp:
- Mar 15, 2013 5:36:12 PM (11 years ago)
- Location:
- trunk/Source/WebKit/blackberry
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/blackberry/Api/BackingStore.cpp
r143615 r145968 50 50 #include <BlackBerryPlatformWindow.h> 51 51 52 #include <SkImageDecoder.h>53 54 52 #include <wtf/CurrentTime.h> 55 53 #include <wtf/MathExtras.h> … … 1065 1063 ASSERT(backBuffer); 1066 1064 1067 // If the tile has been created, but this is the first time we are painting on it 1068 // then it hasn't been given a default background yet so that we can save time during 1069 // startup. That's why we are doing it here instead... 1070 if (!backBuffer->backgroundPainted()) 1071 backBuffer->paintBackground(); 1072 1065 backBuffer->paintBackground(); 1073 1066 backBuffer->setLastRenderScale(currentScale); 1074 1067 backBuffer->setLastRenderOrigin(tileOrigin); … … 1223 1216 dstRect.toString().c_str(), documentSrcRect.toString().c_str(), viewportAccessor->scale()); 1224 1217 #endif 1218 1219 BlackBerry::Platform::Graphics::Buffer* dstBuffer = buffer(); 1220 ASSERT(dstBuffer); 1221 if (dstBuffer) { 1222 // On the GPU, clearing is free and allows for optimizations, 1223 // so we always want to do this first for the whole surface. 1224 // Don't call clearWindow() as we don't want to add it to the posted rect. 1225 BlackBerry::Platform::Graphics::clearBuffer(dstBuffer, 1226 m_webPageBackgroundColor.red(), m_webPageBackgroundColor.green(), 1227 m_webPageBackgroundColor.blue(), m_webPageBackgroundColor.alpha()); 1228 } else 1229 Platform::logAlways(Platform::LogLevelWarn, "Empty window buffer, can't blit contents."); 1225 1230 1226 1231 #if DEBUG_CHECKERBOARD … … 1426 1431 Platform::IntRectRegion transformedContentsRegion = transformedContents; 1427 1432 Platform::IntRectRegion backingStoreRegion = geometry->backingStoreRect(); 1428 Platform::IntRectRegion c heckeredRegion1433 Platform::IntRectRegion clearRegion 1429 1434 = Platform::IntRectRegion::subtractRegions(transformedContentsRegion, backingStoreRegion); 1430 1435 1431 // Blit checkered to those parts that are not covered by the backingStoreRect. 1432 std::vector<Platform::IntRect> checkeredRects = checkeredRegion.rects(); 1433 for (size_t i = 0; i < checkeredRects.size(); ++i) 1434 layerRenderer->drawCheckerboardPattern(transform, m_webPage->d->mapFromTransformedFloatRect(WebCore::IntRect(checkeredRects.at(i)))); 1436 // Clear those parts that are not covered by the backingStoreRect. 1437 Color clearColor(Color::white); 1438 std::vector<Platform::IntRect> clearRects = clearRegion.rects(); 1439 for (size_t i = 0; i < clearRects.size(); ++i) 1440 layerRenderer->drawColor(transform, m_webPage->d->mapFromTransformedFloatRect(WebCore::IntRect(clearRects.at(i))), clearColor); 1435 1441 1436 1442 // Get the list of tile rects that makeup the content. … … 1443 1449 1444 1450 if (!tileBuffer || !geometry->isTileCorrespondingToBuffer(index, tileBuffer)) 1445 layerRenderer->drawC heckerboardPattern(transform, m_webPage->d->mapFromTransformedFloatRect(Platform::FloatRect(dirtyRect)));1451 layerRenderer->drawColor(transform, m_webPage->d->mapFromTransformedFloatRect(Platform::FloatRect(dirtyRect)), clearColor); 1446 1452 else { 1447 1453 Platform::IntPoint tileOrigin = tileBuffer->lastRenderOrigin(); … … 1457 1463 Platform::IntRect tileSurfaceRect = notRenderedRects.at(i); 1458 1464 tileSurfaceRect.move(-tileOrigin.x(), -tileOrigin.y()); 1459 layerRenderer->drawC heckerboardPattern(transform, m_webPage->d->mapFromTransformedFloatRect(Platform::FloatRect(tileSurfaceRect)));1465 layerRenderer->drawColor(transform, m_webPage->d->mapFromTransformedFloatRect(Platform::FloatRect(tileSurfaceRect)), clearColor); 1460 1466 } 1461 1467 } … … 1809 1815 Platform::IntSize BackingStorePrivate::tileSize() 1810 1816 { 1811 static Platform::IntSize tileSize = Platform::Settings::instance()->tileSize( Platform::BackingStoreTileUsage);1817 static Platform::IntSize tileSize = Platform::Settings::instance()->tileSize(); 1812 1818 return tileSize; 1813 1819 } -
trunk/Source/WebKit/blackberry/Api/WebOverlay.cpp
r145962 r145968 1 1 /* 2 * Copyright (C) 2012 Research In Motion Limited. All rights reserved.2 * Copyright (C) 2012, 2013 Research In Motion Limited. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 25 25 #include "LayerWebKitThread.h" 26 26 #include "NotImplemented.h" 27 #include "PlatformContextSkia.h"28 27 #include "TextureCacheCompositingThread.h" 29 28 #include "WebAnimation.h" … … 36 35 #include "WebPage_p.h" 37 36 37 #include <BlackBerryPlatformGraphicsContext.h> 38 38 #include <BlackBerryPlatformMessageClient.h> 39 39 #include <BlackBerryPlatformString.h> 40 40 #include <GLES2/gl2.h> 41 #include <SkDevice.h> 41 42 using namespace WebCore; 43 using BlackBerry::Platform::Graphics::GLES2Program; 42 44 43 45 namespace BlackBerry { 44 46 namespace WebKit { 45 46 using namespace WebCore;47 47 48 48 WebOverlay::WebOverlay() … … 231 231 } 232 232 233 void WebOverlayPrivate::drawContents( SkCanvas* canvas)233 void WebOverlayPrivate::drawContents(Platform::Graphics::Drawable* drawable) 234 234 { 235 235 if (!client) 236 236 return; 237 237 238 client->drawOverlayContents(q, canvas);238 client->drawOverlayContents(q, drawable); 239 239 } 240 240 … … 384 384 void WebOverlayPrivateWebKitThread::paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext& c, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect&) 385 385 { 386 drawContents(c.platformContext() ->canvas());386 drawContents(c.platformContext()); 387 387 } 388 388 389 389 WebOverlayLayerCompositingThreadClient::WebOverlayLayerCompositingThreadClient() 390 390 : m_drawsContent(false) 391 , m_layerCompositingThread(0)392 391 , m_client(0) 393 392 { … … 405 404 } 406 405 407 void WebOverlayLayerCompositingThreadClient::setContents (const SkBitmap& contents)408 { 409 m_ contents = contents;406 void WebOverlayLayerCompositingThreadClient::setContentsToImage(const BlackBerry::Platform::Graphics::TiledImage& image) 407 { 408 m_image = image; 410 409 m_color = Color(); 411 410 m_texture.clear(); … … 415 414 void WebOverlayLayerCompositingThreadClient::clearUploadedContents() 416 415 { 417 m_uploaded Contents = SkBitmap();416 m_uploadedImage = BlackBerry::Platform::Graphics::TiledImage(); 418 417 } 419 418 420 419 void WebOverlayLayerCompositingThreadClient::setContentsToColor(const Color& color) 421 420 { 422 m_ contents = SkBitmap();421 m_image = BlackBerry::Platform::Graphics::TiledImage(); 423 422 m_color = color; 424 423 m_texture.clear(); … … 435 434 } 436 435 437 void WebOverlayLayerCompositingThreadClient::uploadTexturesIfNeeded(LayerCompositingThread* )438 { 439 if (m_ contents.isNull() && !m_color.isValid() && !m_drawsContent)436 void WebOverlayLayerCompositingThreadClient::uploadTexturesIfNeeded(LayerCompositingThread* layer) 437 { 438 if (m_image.isNull() && !m_color.isValid() && !m_drawsContent) 440 439 return; 441 440 … … 447 446 return; 448 447 } 448 449 Texture::HostType textureContents = Texture::HostType(); 450 IntSize textureSize; 449 451 450 452 if (m_drawsContent) { … … 452 454 return; 453 455 454 if (m_contents.isNull()) { 455 m_contents.setConfig(SkBitmap::kARGB_8888_Config, m_layerCompositingThread->bounds().width(), m_layerCompositingThread->bounds().height()); 456 m_contents.allocPixels(); 457 } 458 459 SkDevice device(m_contents); 460 SkCanvas canvas(&device); 461 m_client->drawOverlayContents(m_owner, &canvas); 462 canvas.flush(); 456 textureSize = layer->bounds(); 457 textureContents = BlackBerry::Platform::Graphics::createBuffer(IntSize(0, 0), BlackBerry::Platform::Graphics::NeverBacked); 458 if (!textureContents) 459 return; 460 461 clearBuffer(textureContents, 0, 0, 0, 0); 462 PlatformGraphicsContext* platformContext = lockBufferDrawable(textureContents); 463 double transform[] = { 464 1, 0, 465 0, 1, 466 -layer->bounds().width() / 2.0, -layer->bounds().height() / 2.0 467 }; 468 platformContext->setTransform(transform); 469 m_client->drawOverlayContents(m_owner, platformContext); 470 471 releaseBufferDrawable(textureContents); 472 } else if (!m_image.isNull()) { 473 textureSize = IntSize(m_image.width(), m_image.height()); 474 textureContents = BlackBerry::Platform::Graphics::createBuffer(IntSize(0, 0), BlackBerry::Platform::Graphics::NeverBacked); 475 if (!textureContents) 476 return; 477 478 PlatformGraphicsContext* platformContext = BlackBerry::Platform::Graphics::lockBufferDrawable(textureContents); 479 480 AffineTransform transform; 481 platformContext->getTransform(reinterpret_cast<double*>(&transform)); 482 transform.translate(-m_image.width() / 2.0, -m_image.height() / 2.0); 483 platformContext->setTransform(reinterpret_cast<double*>(&transform)); 484 485 FloatRect rect(0, 0, m_image.width(), m_image.height()); 486 platformContext->addImage(rect, rect, &m_image); 487 releaseBufferDrawable(textureContents); 488 m_uploadedImage = m_image; 463 489 } 464 490 465 491 m_texture = Texture::create(); 466 m_texture->protect(IntSize(m_contents.width(), m_contents.height())); 467 IntRect bitmapRect(0, 0, m_contents.width(), m_contents.height()); 468 m_uploadedContents = m_contents; 469 m_texture->updateContents(m_uploadedContents, bitmapRect, bitmapRect, false); 470 } 471 472 void WebOverlayLayerCompositingThreadClient::drawTextures(LayerCompositingThread* layer, double /*scale*/, int positionLocation, int texCoordLocation) 492 m_texture->protect(IntSize(), BlackBerry::Platform::Graphics::BackedWhenNecessary); 493 IntRect bitmapRect(0, 0, textureSize.width(), textureSize.height()); 494 m_texture->updateContents(textureContents, bitmapRect, bitmapRect, false); 495 } 496 497 void WebOverlayLayerCompositingThreadClient::drawTextures(LayerCompositingThread* layer, double scale, const GLES2Program& program) 473 498 { 474 499 if (!m_texture || !m_texture->textureId()) 475 500 return; 476 501 477 glBindTexture(GL_TEXTURE_2D, m_texture->textureId()); 478 glVertexAttribPointer(positionLocation, 2, GL_FLOAT, GL_FALSE, 0, &layer->getTransformedBounds()); 479 float texcoords[4 * 2] = { 0, 0, 0, 1, 1, 1, 1, 0 }; 480 glVertexAttribPointer(texCoordLocation, 2, GL_FLOAT, GL_FALSE, 0, texcoords); 481 glDrawArrays(GL_TRIANGLE_FAN, 0, 4); 502 TransformationMatrix matrix = layer->drawTransform(); 503 if (!m_image.isNull()) { 504 if (m_image.size().isEmpty()) 505 return; 506 507 matrix.scaleNonUniform(static_cast<double>(layer->bounds().width()) / m_image.width(), static_cast<double>(layer->bounds().height()) / m_image.height()); 508 } 509 matrix.scale(layer->sizeIsScaleInvariant() ? 1.0 / scale : 1.0); 510 blitToBuffer(0, m_texture->textureId(), reinterpret_cast<BlackBerry::Platform::TransformationMatrix&>(matrix), 511 BlackBerry::Platform::Graphics::SourceOver, static_cast<unsigned char>(layer->drawOpacity() * 255)); 482 512 } 483 513 … … 490 520 WebOverlayPrivateCompositingThread::WebOverlayPrivateCompositingThread(PassRefPtr<LayerCompositingThread> layerCompositingThread) 491 521 : m_layerCompositingThreadClient(0) 522 , m_data(0) 492 523 { 493 524 m_layerCompositingThread = layerCompositingThread; … … 498 529 { 499 530 m_layerCompositingThread = LayerCompositingThread::create(LayerData::CustomLayer, m_layerCompositingThreadClient); 500 m_layerCompositingThreadClient->setLayer(m_layerCompositingThread.get());501 531 } 502 532 … … 617 647 void WebOverlayPrivateCompositingThread::removeFromParent() 618 648 { 619 if ( m_layerCompositingThread->superlayer() == page()->m_compositor->compositingThreadOverlayLayer())620 page()->m_ compositor->removeOverlay(m_layerCompositingThread.get());649 if (page() && m_layerCompositingThread->superlayer() == page()->compositor()->compositingThreadOverlayLayer()) 650 page()->m_webPage->removeCompositingThreadOverlay(q); 621 651 else 622 652 m_layerCompositingThread->removeFromSuperlayer(); … … 629 659 return; 630 660 631 const SkBitmap& oldContents = m_layerCompositingThreadClient->contents(); 632 if (!oldContents.isNull()) { 633 SkAutoLockPixels lock(oldContents); 634 if (data == oldContents.getPixels()) 635 return; 636 } 637 638 SkBitmap contents; 639 contents.setConfig(SkBitmap::kARGB_8888_Config, imageSize.width(), imageSize.height()); 640 641 switch (adoptionType) { 642 case WebOverlay::ReferenceImageData: 643 contents.setPixels(const_cast<unsigned char*>(data)); 644 break; 645 case WebOverlay::CopyImageData: 646 if (contents.allocPixels()) { 647 contents.lockPixels(); 648 size_t bytes = SkBitmap::ComputeSize(SkBitmap::kARGB_8888_Config, imageSize.width(), imageSize.height()); 649 memcpy(contents.getPixels(), data, bytes); 650 contents.unlockPixels(); 651 } 652 break; 653 default: 654 ASSERT_NOT_REACHED(); 655 } 656 657 m_layerCompositingThreadClient->setContents(contents); 661 if (data == m_data) 662 return; 663 664 m_data = data; 665 666 BlackBerry::Platform::Graphics::TiledImage image = BlackBerry::Platform::Graphics::TiledImage(imageSize, reinterpret_cast_ptr<const unsigned*>(data), true, BlackBerry::Platform::Graphics::TiledImage::Hardware); 667 668 m_layerCompositingThreadClient->setContentsToImage(image); 658 669 m_layerCompositingThread->setNeedsTexture(true); 659 670 } -
trunk/Source/WebKit/blackberry/Api/WebOverlay.h
r145962 r145968 1 1 /* 2 * Copyright (C) 2012 Research In Motion Limited. All rights reserved.2 * Copyright (C) 2012, 2013 Research In Motion Limited. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 119 119 void invalidate(); 120 120 121 // The client can be used to draw layer contents using Skia.121 // The client can be used to draw layer contents. 122 122 void setClient(WebOverlayClient*); 123 123 -
trunk/Source/WebKit/blackberry/Api/WebOverlayClient.h
r118750 r145968 21 21 22 22 #include "BlackBerryGlobal.h" 23 24 class SkCanvas; 23 #include <BlackBerryPlatformGraphics.h> 25 24 26 25 namespace BlackBerry { … … 35 34 virtual ~WebOverlayClient() { } 36 35 37 virtual void drawOverlayContents(WebOverlay*, SkCanvas*) = 0;36 virtual void drawOverlayContents(WebOverlay*, BlackBerry::Platform::Graphics::Drawable*) = 0; 38 37 }; 39 38 -
trunk/Source/WebKit/blackberry/Api/WebOverlay_p.h
r145962 r145968 1 1 /* 2 * Copyright (C) 2012 Research In Motion Limited. All rights reserved.2 * Copyright (C) 2012, 2013 Research In Motion Limited. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 28 28 #include "WebOverlayOverride.h" 29 29 30 #include < SkBitmap.h>30 #include <TiledImage.h> 31 31 #include <pthread.h> 32 32 #include <wtf/OwnPtr.h> 33 33 #include <wtf/RefPtr.h> 34 35 class SkCanvas;36 34 37 35 namespace WTF { … … 104 102 virtual void clear() = 0; 105 103 virtual void invalidate() = 0; 106 void drawContents( SkCanvas*);104 void drawContents(Platform::Graphics::Drawable*); 107 105 108 106 virtual void resetOverrides() = 0; … … 172 170 virtual void notifyFlushRequired(const WebCore::GraphicsLayer*); 173 171 virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& inClip); 174 virtual bool contentsVisible(const WebCore::GraphicsLayer*, const WebCore::IntRect& contentRect) const { return true; } 172 virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const { return false; } 173 virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const { return false; } 175 174 176 175 private: … … 185 184 virtual ~WebOverlayLayerCompositingThreadClient() { } 186 185 187 void setLayer(WebCore::LayerCompositingThread* layer) { m_layerCompositingThread = layer; }188 186 void setClient(WebOverlay* owner, WebOverlayClient* client) { m_owner = owner; m_client = client; } 189 187 … … 192 190 void invalidate(); 193 191 194 const SkBitmap& contents() const { return m_contents; } 195 void setContents(const SkBitmap&); 196 192 void setContentsToImage(const BlackBerry::Platform::Graphics::TiledImage&); 197 193 void setContentsToColor(const WebCore::Color&); 194 195 const BlackBerry::Platform::Graphics::TiledImage& image() const { return m_image; } 198 196 199 197 // LayerCompositingThreadClient … … 201 199 virtual void layerVisibilityChanged(WebCore::LayerCompositingThread*, bool visible); 202 200 virtual void uploadTexturesIfNeeded(WebCore::LayerCompositingThread*); 203 virtual void drawTextures(WebCore::LayerCompositingThread*, double scale, int positionLocation, int texCoordLocation);201 virtual void drawTextures(WebCore::LayerCompositingThread*, double scale, const Platform::Graphics::GLES2Program&); 204 202 virtual void deleteTextures(WebCore::LayerCompositingThread*); 205 203 … … 208 206 209 207 private: 208 bool m_drawsContent; 210 209 RefPtr<WebCore::Texture> m_texture; 211 bool m_drawsContent; 212 SkBitmap m_contents; 213 SkBitmap m_uploadedContents; 210 BlackBerry::Platform::Graphics::TiledImage m_image; 211 BlackBerry::Platform::Graphics::TiledImage m_uploadedImage; 214 212 WebCore::Color m_color; 215 WebCore::LayerCompositingThread* m_layerCompositingThread;216 213 WebOverlay* m_owner; 217 214 WebOverlayClient* m_client; … … 263 260 private: 264 261 WebOverlayLayerCompositingThreadClient* m_layerCompositingThreadClient; 262 const unsigned char* m_data; 265 263 }; 266 264 -
trunk/Source/WebKit/blackberry/Api/WebPageCompositor.cpp
r145953 r145968 46 46 : m_client(client) 47 47 , m_webPage(page) 48 , m_context(0) 48 49 , m_drawsRootLayer(false) 49 50 , m_childWindowPlacement(WebPageCompositor::DocumentCoordinates) -
trunk/Source/WebKit/blackberry/ChangeLog
r145962 r145968 1 2013-03-15 Arvid Nilsson <anilsson@rim.com> 2 3 [BlackBerry] BlackBerry::Platform::Graphics::GraphicsContext integration related changes in Source/WebKit/blackberry 4 https://bugs.webkit.org/show_bug.cgi?id=112467 5 6 Reviewed by Rob Buis. 7 8 PR 293208 9 10 This patch contains contributions from many members of the BlackBerry 11 WebKit team: 12 13 Mike Lattanzio 14 Arvid Nilsson 15 Jakob Petsovits 16 Konrad Piascik 17 Jeff Rogers 18 Filip Spacek 19 20 * Api/BackingStore.cpp: 21 (BlackBerry::WebKit::BackingStorePrivate::render): 22 (BlackBerry::WebKit::BackingStorePrivate::blitVisibleContents): 23 (BlackBerry::WebKit::BackingStorePrivate::compositeContents): 24 (BlackBerry::WebKit::BackingStorePrivate::tileSize): 25 * Api/WebOverlay.cpp: 26 (BlackBerry::WebKit::WebOverlayPrivate::drawContents): 27 (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::paintContents): 28 (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::WebOverlayLayerCompositingThreadClient): 29 (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::setContentsToImage): 30 (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::clearUploadedContents): 31 (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::setContentsToColor): 32 (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::uploadTexturesIfNeeded): 33 (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::drawTextures): 34 (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::WebOverlayPrivateCompositingThread): 35 (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::removeFromParent): 36 (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::setContentsToImage): 37 * Api/WebOverlay.h: 38 * Api/WebOverlayClient.h: 39 * Api/WebOverlay_p.h: 40 (WebOverlayPrivate): 41 (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::showDebugBorders): 42 (BlackBerry::WebKit::WebOverlayPrivateWebKitThread::showRepaintCounter): 43 (WebOverlayLayerCompositingThreadClient): 44 (BlackBerry::WebKit::WebOverlayLayerCompositingThreadClient::image): 45 (WebOverlayPrivateCompositingThread): 46 * Api/WebPageCompositor.cpp: 47 (BlackBerry::WebKit::WebPageCompositorPrivate::WebPageCompositorPrivate): 48 * WebKitSupport/BackingStoreTile.cpp: 49 (BlackBerry::WebKit::TileBuffer::~TileBuffer): 50 (BlackBerry::WebKit::TileBuffer::nativeBuffer): 51 (BlackBerry::WebKit::TileBuffer::paintBackground): 52 * WebKitSupport/DefaultTapHighlight.cpp: 53 (BlackBerry::WebKit::DefaultTapHighlight::paintContents): 54 (BlackBerry::WebKit::DefaultTapHighlight::showDebugBorders): 55 (WebKit): 56 (BlackBerry::WebKit::DefaultTapHighlight::showRepaintCounter): 57 * WebKitSupport/DefaultTapHighlight.h: 58 (DefaultTapHighlight): 59 * WebKitSupport/InspectorOverlayBlackBerry.cpp: 60 (BlackBerry::WebKit::InspectorOverlay::showDebugBorders): 61 (WebKit): 62 (BlackBerry::WebKit::InspectorOverlay::showRepaintCounter): 63 * WebKitSupport/InspectorOverlayBlackBerry.h: 64 (InspectorOverlay): 65 * WebKitSupport/SelectionOverlay.cpp: 66 (BlackBerry::WebKit::SelectionOverlay::draw): 67 (BlackBerry::WebKit::SelectionOverlay::hide): 68 (BlackBerry::WebKit::SelectionOverlay::paintContents): 69 (BlackBerry::WebKit::SelectionOverlay::showDebugBorders): 70 (WebKit): 71 (BlackBerry::WebKit::SelectionOverlay::showRepaintCounter): 72 * WebKitSupport/SelectionOverlay.h: 73 (SelectionOverlay): 74 * WebKitSupport/SurfacePool.cpp: 75 (BlackBerry::WebKit::SurfacePool::createPlatformGraphicsContext): 76 (BlackBerry::WebKit::SurfacePool::destroyPlatformGraphicsContext): 77 (BlackBerry::WebKit::SurfacePool::waitForBuffer): 78 (BlackBerry::WebKit::SurfacePool::notifyBuffersComposited): 79 (BlackBerry::WebKit::SurfacePool::destroyPlatformSync): 80 * WebKitSupport/SurfacePool.h: 81 1 82 2013-03-15 Arvid Nilsson <anilsson@rim.com> 2 83 -
trunk/Source/WebKit/blackberry/WebKitSupport/BackingStoreTile.cpp
r136965 r145968 46 46 TileBuffer::~TileBuffer() 47 47 { 48 destroyBuffer(m_nativeBuffer);48 Platform::Graphics::destroyBuffer(m_nativeBuffer); 49 49 } 50 50 … … 102 102 { 103 103 if (!m_nativeBuffer) 104 m_nativeBuffer = createBuffer(m_size, Platform::Graphics::AlwaysBacked, SurfacePool::globalSurfacePool()->sharedPixmapGroup());104 m_nativeBuffer = Platform::Graphics::createBuffer(m_size, Platform::Graphics::AlwaysBacked, SurfacePool::globalSurfacePool()->sharedPixmapGroup()); 105 105 106 106 return m_nativeBuffer; … … 116 116 m_backgroundPainted = true; 117 117 118 clearBuffer(nativeBuffer(), 0, 0, 0, 0);118 Platform::Graphics::clearBuffer(nativeBuffer(), 0, 0, 0, 0); 119 119 } 120 120 -
trunk/Source/WebKit/blackberry/WebKitSupport/DefaultTapHighlight.cpp
r144640 r145968 25 25 #include "GraphicsContext.h" 26 26 #include "Path.h" 27 #include "PlatformContextSkia.h"28 27 #include "WebAnimation.h" 29 28 #include "WebPage_p.h" 30 29 30 #include <BlackBerryPlatformGraphicsContext.h> 31 31 #include <BlackBerryPlatformMessageClient.h> 32 32 … … 128 128 void DefaultTapHighlight::paintContents(const GraphicsLayer*, GraphicsContext& c, GraphicsLayerPaintingPhase, const IntRect& /*inClip*/) 129 129 { 130 std::vector<Platform::IntRect> rects = m_region.rects(); 131 Platform::IntRect rect = m_region.extents(); 132 SkRegion overlayRegion; 133 134 unsigned rectCount = m_region.numRects(); 135 if (!rectCount) 130 if (!m_region.numRects()) 136 131 return; 137 132 138 for (unsigned i = 0; i < rectCount; ++i) { 139 Platform::IntRect rectToPaint = rects[i]; 140 SkIRect r = SkIRect::MakeXYWH(rectToPaint.x(), rectToPaint.y(), rectToPaint.width(), rectToPaint.height()); 141 overlayRegion.op(r, SkRegion::kUnion_Op); 142 } 133 Path path(m_region.boundaryPath()); 143 134 144 SkPath pathToPaint;145 overlayRegion.getBoundaryPath(&pathToPaint);146 147 Path path(pathToPaint);148 135 c.save(); 136 const Platform::IntRect& rect = m_region.extents(); 149 137 c.translate(-rect.x(), -rect.y()); 150 138 … … 159 147 } 160 148 161 bool DefaultTapHighlight:: contentsVisible(const GraphicsLayer*, const IntRect& contentRect) const149 bool DefaultTapHighlight::showDebugBorders(const GraphicsLayer* layer) const 162 150 { 163 // This layer is typically small enough that we can afford to cache all tiles and never 164 // risk checkerboarding. 165 return true; 151 return m_page->showDebugBorders(layer); 152 } 153 154 bool DefaultTapHighlight::showRepaintCounter(const GraphicsLayer* layer) const 155 { 156 return m_page->showRepaintCounter(layer); 166 157 } 167 158 -
trunk/Source/WebKit/blackberry/WebKitSupport/DefaultTapHighlight.h
r144640 r145968 1 1 /* 2 * Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved.2 * Copyright (C) 2011, 2012, 2013 Research In Motion Limited. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 58 58 virtual void notifyFlushRequired(const WebCore::GraphicsLayer*); 59 59 virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& inClip); 60 virtual bool contentsVisible(const WebCore::GraphicsLayer*, const WebCore::IntRect& contentRect) const; 60 virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const; 61 virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const; 61 62 62 63 private: -
trunk/Source/WebKit/blackberry/WebKitSupport/InspectorOverlayBlackBerry.cpp
r133517 r145968 1 1 /* 2 * Copyright (C) 2012 Research In Motion Limited. All rights reserved.2 * Copyright (C) 2012, 2013 Research In Motion Limited. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 57 57 } 58 58 59 bool InspectorOverlay::showDebugBorders(const WebCore::GraphicsLayer* layer) const 60 { 61 return m_webPage->showDebugBorders(layer); 62 } 63 64 bool InspectorOverlay::showRepaintCounter(const WebCore::GraphicsLayer* layer) const 65 { 66 return m_webPage->showRepaintCounter(layer); 67 } 59 68 #endif 60 69 -
trunk/Source/WebKit/blackberry/WebKitSupport/InspectorOverlayBlackBerry.h
r133517 r145968 1 1 /* 2 * Copyright (C) 2012 Research In Motion Limited. All rights reserved.2 * Copyright (C) 2012, 2013 Research In Motion Limited. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 55 55 virtual void notifyFlushRequired(const WebCore::GraphicsLayer*); 56 56 virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& inClip); 57 virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const; 58 virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const; 57 59 #endif 58 60 -
trunk/Source/WebKit/blackberry/WebKitSupport/SelectionOverlay.cpp
r133517 r145968 1 1 /* 2 * Copyright (C) 2012 Research In Motion Limited. All rights reserved.2 * Copyright (C) 2012, 2013 Research In Motion Limited. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 25 25 #include "GraphicsContext.h" 26 26 #include "LayerMessage.h" 27 #include "LayerWebKitThread.h" 27 28 #include "Path.h" 28 #include "PlatformContextSkia.h"29 29 #include "RenderTheme.h" 30 30 #include "WebPage_p.h" … … 46 46 } 47 47 48 void SelectionOverlay::draw(const Platform::IntRectRegion& region)48 void SelectionOverlay::draw(const Selection& selection) 49 49 { 50 50 ASSERT(BlackBerry::Platform::webKitThreadMessageClient()->isCurrentThread()); 51 51 52 m_region = region; 53 FloatRect rect = IntRect(m_region.extents()); 54 if (rect.isEmpty()) { 55 hide(); 56 return; 52 m_selection = selection; 53 54 while (m_layers.size() < m_selection.size()) 55 m_layers.append(GraphicsLayer::create(this)); 56 57 m_layers.resize(m_selection.size()); 58 59 size_t i = 0; 60 for (Selection::iterator it = m_selection.begin(); it != m_selection.end(); ++it, ++i) { 61 GraphicsLayer* parent = it->key; 62 GraphicsLayer* overlay = m_layers[i].get(); 63 64 parent->platformLayer()->addOverlay(overlay->platformLayer()); 65 overlay->setPosition(FloatPoint::zero()); 66 if (parent == m_page->m_overlayLayer) 67 overlay->setSize(m_page->contentsSize()); 68 else 69 overlay->setSize(parent->size()); 70 overlay->setAnchorPoint(FloatPoint3D(0, 0, 0)); 71 overlay->setDrawsContent(true); 72 overlay->setNeedsDisplay(); 57 73 } 58 59 if (!m_overlay)60 m_overlay = adoptPtr(new WebOverlay(this));61 62 m_page->m_webPage->addOverlay(m_overlay.get());63 m_overlay->resetOverrides();64 m_overlay->setPosition(rect.location());65 m_overlay->setSize(rect.size());66 m_overlay->setDrawsContent(true);67 m_overlay->setOpacity(1.0);68 m_overlay->invalidate();69 74 } 70 75 … … 73 78 ASSERT(BlackBerry::Platform::webKitThreadMessageClient()->isCurrentThread()); 74 79 75 if (!m_overlay) 76 return; 77 78 m_page->m_webPage->removeOverlay(m_overlay.get()); 80 for (size_t i = 0; i < m_layers.size(); ++i) 81 m_layers[i]->platformLayer()->removeFromSuperlayer(); 82 m_selection.clear(); 79 83 } 80 84 … … 84 88 } 85 89 86 void SelectionOverlay::paintContents(const GraphicsLayer* , GraphicsContext& c, GraphicsLayerPaintingPhase, const IntRect& inClip)90 void SelectionOverlay::paintContents(const GraphicsLayer* layer, GraphicsContext& c, GraphicsLayerPaintingPhase, const IntRect& clip) 87 91 { 88 std::vector<Platform::IntRect> rects = m_region.rects(); 89 Platform::IntRect rect = m_region.extents(); 90 SkRegion windowRegion; 91 92 unsigned rectCount = m_region.numRects(); 93 if (!rectCount) 92 if (!layer->platformLayer()->superlayer()) 94 93 return; 95 94 96 IntRect clip(inClip); 97 clip.move(rect.x(), rect.y()); 98 for (unsigned i = 0; i < rectCount; ++i) { 99 IntRect rectToPaint = rects[i]; 95 Selection::iterator it = m_selection.find(layer->platformLayer()->superlayer()->owner()); 96 if (it == m_selection.end()) 97 return; 98 99 const Vector<WebCore::FloatQuad>& quads = it->value; 100 101 c.save(); 102 103 Color color = RenderTheme::defaultTheme()->activeSelectionBackgroundColor(); 104 c.setFillColor(color, ColorSpaceDeviceRGB); 105 106 for (unsigned i = 0; i < quads.size(); ++i) { 107 FloatRect rectToPaint = quads[i].boundingBox(); 100 108 rectToPaint.intersect(clip); 101 SkIRect r = SkIRect::MakeXYWH(rectToPaint.x(), rectToPaint.y(), rectToPaint.width(), rectToPaint.height()); 102 windowRegion.op(r, SkRegion::kUnion_Op); 109 if (rectToPaint.isEmpty()) 110 continue; 111 112 c.fillRect(rectToPaint); 103 113 } 104 114 105 SkPath pathToPaint;106 windowRegion.getBoundaryPath(&pathToPaint); 115 c.restore(); 116 } 107 117 108 Path path(pathToPaint); 109 c.save(); 110 c.translate(-rect.x(), -rect.y()); 118 bool SelectionOverlay::showDebugBorders(const GraphicsLayer* layer) const 119 { 120 return m_page->showDebugBorders(layer); 121 } 111 122 112 // Draw selection overlay 113 Color color = RenderTheme::defaultTheme()->activeSelectionBackgroundColor(); 114 c.setFillColor(color, ColorSpaceDeviceRGB); 115 c.fillPath(path); 116 117 c.restore(); 123 bool SelectionOverlay::showRepaintCounter(const GraphicsLayer* layer) const 124 { 125 return m_page->showRepaintCounter(layer); 118 126 } 119 127 -
trunk/Source/WebKit/blackberry/WebKitSupport/SelectionOverlay.h
r133517 r145968 1 1 /* 2 * Copyright (C) 2012 Research In Motion Limited. All rights reserved.2 * Copyright (C) 2012, 2013 Research In Motion Limited. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 25 25 26 26 #include "Color.h" 27 #include "FloatQuad.h" 27 28 #include "GraphicsLayerClient.h" 28 #include " WebOverlay.h"29 #include "IntRect.h" 29 30 30 31 #include <BlackBerryPlatformIntRectRegion.h> 32 #include <wtf/HashMap.h> 31 33 #include <wtf/OwnPtr.h> 32 34 #include <wtf/PassOwnPtr.h> 35 #include <wtf/Vector.h> 33 36 34 37 namespace BlackBerry { … … 39 42 class SelectionOverlay : public WebCore::GraphicsLayerClient { 40 43 public: 44 typedef HashMap<WebCore::GraphicsLayer*, Vector<WebCore::FloatQuad> > Selection; 45 41 46 static PassOwnPtr<SelectionOverlay> create(WebPagePrivate* page) 42 47 { … … 44 49 } 45 50 46 virtual~SelectionOverlay();51 ~SelectionOverlay(); 47 52 48 v irtual void draw(const Platform::IntRectRegion&);49 v irtual void hide();53 void draw(const Selection&); 54 void hide(); 50 55 51 56 // GraphicsLayerClient 52 57 virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) { } 53 58 virtual void notifyFlushRequired(const WebCore::GraphicsLayer*); 54 virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& inClip); 59 virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect&); 60 virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const; 61 virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const; 55 62 56 63 private: … … 58 65 59 66 WebPagePrivate* m_page; 60 OwnPtr<WebOverlay> m_overlay;61 BlackBerry::Platform::IntRectRegion m_region;67 Selection m_selection; 68 Vector<OwnPtr<WebCore::GraphicsLayer> > m_layers; 62 69 }; 63 70 -
trunk/Source/WebKit/blackberry/WebKitSupport/SurfacePool.cpp
r142677 r145968 1 1 /* 2 * Copyright (C) 2010, 2011, 2012 Research In Motion Limited. All rights reserved.2 * Copyright (C) 2010, 2011, 2012, 2013 Research In Motion Limited. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 20 20 #include "SurfacePool.h" 21 21 22 #include "PlatformContextSkia.h"23 24 22 #include <BlackBerryPlatformExecutableMessage.h> 25 23 #include <BlackBerryPlatformGraphics.h> … … 123 121 PlatformGraphicsContext* SurfacePool::createPlatformGraphicsContext(Platform::Graphics::Drawable* drawable) const 124 122 { 125 return new WebCore::PlatformContextSkia(drawable);123 return drawable; 126 124 } 127 125 128 126 void SurfacePool::destroyPlatformGraphicsContext(PlatformGraphicsContext* platformGraphicsContext) const 129 127 { 130 delete platformGraphicsContext;131 128 } 132 129 … … 204 201 if (!m_hasFenceExtension) 205 202 return; 206 207 #if BLACKBERRY_PLATFORM_GRAPHICS_EGL208 EGLSyncKHR platformSync;209 210 {211 Platform::MutexLocker locker(&m_mutex);212 platformSync = tileBuffer->fence()->takePlatformSync();213 }214 215 if (!platformSync)216 return;217 218 if (!eglClientWaitSyncKHR(Platform::Graphics::eglDisplay(), platformSync, 0, 100000000LL))219 Platform::logAlways(Platform::LogLevelWarn, "Failed to wait for EGLSyncKHR object!\n");220 221 // Instead of assuming eglDestroySyncKHR is thread safe, we add it to222 // a garbage list for later collection on the thread that created it.223 {224 Platform::MutexLocker locker(&m_mutex);225 m_garbage.insert(platformSync);226 }227 #endif228 203 } 229 204 … … 232 207 if (!m_hasFenceExtension) 233 208 return; 234 235 #if BLACKBERRY_PLATFORM_GRAPHICS_EGL236 Platform::MutexLocker locker(&m_mutex);237 238 EGLDisplay display = Platform::Graphics::eglDisplay();239 240 // The EGL_KHR_fence_sync spec is nice enough to specify that the sync object241 // is not actually deleted until everyone has stopped using it.242 for (std::set<void*>::const_iterator it = m_garbage.begin(); it != m_garbage.end(); ++it)243 eglDestroySyncKHR(display, *it);244 m_garbage.clear();245 246 // If we didn't blit anything, we don't need to create a new fence.247 if (tileBuffers.isEmpty())248 return;249 250 // Create a new fence and assign to the tiles that were blit. Invalidate any previous251 // fence that may be active among these tiles and add its sync object to the garbage set252 // for later destruction to make sure it doesn't leak.253 RefPtr<Fence> fence = Fence::create(eglCreateSyncKHR(display, EGL_SYNC_FENCE_KHR, 0));254 for (unsigned int i = 0; i < tileBuffers.size(); ++i)255 tileBuffers[i]->setFence(fence);256 #endif257 209 } 258 210 259 211 void SurfacePool::destroyPlatformSync(void* platformSync) 260 212 { 261 #if BLACKBERRY_PLATFORM_GRAPHICS_EGL && USE(SKIA) 262 Platform::MutexLocker locker(&m_mutex); 263 m_garbage.insert(platformSync); 264 #endif 265 } 266 267 } 268 } 213 } 214 215 } 216 } -
trunk/Source/WebKit/blackberry/WebKitSupport/SurfacePool.h
r142037 r145968 1 1 /* 2 * Copyright (C) 2010, 2011, 2012 Research In Motion Limited. All rights reserved.2 * Copyright (C) 2010, 2011, 2012, 2013 Research In Motion Limited. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 21 21 22 22 #include "BackingStoreTile.h" 23 24 #include "PlatformContextSkia.h" 23 #include "GraphicsContext.h" 25 24 26 25 #include <BlackBerryPlatformGraphics.h>
Note: See TracChangeset
for help on using the changeset viewer.