diff options
Diffstat (limited to 'Source/WebCore/platform')
10 files changed, 38 insertions, 174 deletions
diff --git a/Source/WebCore/platform/android/RenderThemeAndroid.cpp b/Source/WebCore/platform/android/RenderThemeAndroid.cpp index 7ef814e..481ecbf 100644 --- a/Source/WebCore/platform/android/RenderThemeAndroid.cpp +++ b/Source/WebCore/platform/android/RenderThemeAndroid.cpp @@ -234,17 +234,18 @@ bool RenderThemeAndroid::paintButton(RenderObject* obj, const PaintInfo& info, c // If it is a disabled button, simply paint it to the master picture. Node* node = obj->node(); Element* formControlElement = static_cast<Element*>(node); - if (formControlElement && !formControlElement->isEnabledFormControl()) { + if (formControlElement) { android::WebFrame* webFrame = getWebFrame(node); if (webFrame) { RenderSkinAndroid* skins = webFrame->renderSkins(); - if (skins) - skins->renderSkinButton()->draw(getCanvasFromInfo(info), rect, - RenderSkinAndroid::kDisabled); + if (skins) { + RenderSkinAndroid::State state = RenderSkinAndroid::kNormal; + if (!formControlElement->isEnabledFormControl()) + state = RenderSkinAndroid::kDisabled; + skins->renderSkinButton()->draw(getCanvasFromInfo(info), rect, state); + } } - } else - // Store all the important information in the platform context. - info.context->platformContext()->storeButtonInfo(node, rect); + } // We always return false so we do not request to be redrawn. return false; diff --git a/Source/WebCore/platform/graphics/android/GLExtras.cpp b/Source/WebCore/platform/graphics/android/GLExtras.cpp index c6cb7f3..873ea33 100644 --- a/Source/WebCore/platform/graphics/android/GLExtras.cpp +++ b/Source/WebCore/platform/graphics/android/GLExtras.cpp @@ -202,8 +202,6 @@ void GLExtras::drawFindOnPage(SkRect& viewport) void GLExtras::drawGL(IntRect& webViewRect, SkRect& viewport, int titleBarHeight) { if (m_drawExtra) { - // TODO: Support clipping - glDisable(GL_SCISSOR_TEST); if (m_drawExtra == m_ring) drawCursorRings(); else if (m_drawExtra == m_findOnPage) @@ -211,6 +209,5 @@ void GLExtras::drawGL(IntRect& webViewRect, SkRect& viewport, int titleBarHeight else XLOGC("m_drawExtra %p is unknown! (cursor: %p, find: %p", m_drawExtra, m_ring, m_findOnPage); - glEnable(GL_SCISSOR_TEST); } } diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp index a1766d0..3fb2384 100644 --- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp +++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp @@ -69,7 +69,7 @@ namespace WebCore { using namespace android; -GLWebViewState::GLWebViewState(android::Mutex* buttonMutex) +GLWebViewState::GLWebViewState() : m_zoomManager(this) , m_paintingBaseLayer(0) , m_currentBaseLayer(0) @@ -78,7 +78,6 @@ GLWebViewState::GLWebViewState(android::Mutex* buttonMutex) , m_usePageA(true) , m_frameworkInval(0, 0, 0, 0) , m_frameworkLayersInval(0, 0, 0, 0) - , m_globalButtonMutex(buttonMutex) , m_baseLayerUpdate(true) , m_backgroundColor(SK_ColorWHITE) , m_isScrolling(false) @@ -241,9 +240,7 @@ unsigned int GLWebViewState::paintBaseLayerContent(SkCanvas* canvas) SkSafeRef(base); m_baseLayerLock.unlock(); if (base) { - m_globalButtonMutex->lock(); base->drawCanvas(canvas); - m_globalButtonMutex->unlock(); } SkSafeUnref(base); return m_currentPictureCounter; @@ -311,8 +308,10 @@ void GLWebViewState::setViewport(SkRect& viewport, float scale) // allocate max possible number of tiles visible with this viewport int viewMaxTileX = static_cast<int>(ceilf((viewport.width()-1) * invTileContentWidth)) + 1; int viewMaxTileY = static_cast<int>(ceilf((viewport.height()-1) * invTileContentHeight)) + 1; - int maxTextureCount = (viewMaxTileX + TILE_PREFETCH_DISTANCE * 2) * - (viewMaxTileY + TILE_PREFETCH_DISTANCE * 2) * 2; + + int maxTextureCount = (viewMaxTileX + m_expandedTileBoundsX * 2) * + (viewMaxTileY + m_expandedTileBoundsY * 2) * 2; + TilesManager::instance()->setMaxTextureCount(maxTextureCount); m_tiledPageA->updateBaseTileSize(); m_tiledPageB->updateBaseTileSize(); @@ -428,8 +427,9 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect, float viewWidth = (viewport.fRight - viewport.fLeft) * TILE_PREFETCH_RATIO; float viewHeight = (viewport.fBottom - viewport.fTop) * TILE_PREFETCH_RATIO; - bool useHorzPrefetch = viewWidth < baseContentWidth(); - bool useVertPrefetch = viewHeight < baseContentHeight(); + bool useMinimalMemory = TilesManager::instance()->useMinimalMemory(); + bool useHorzPrefetch = useMinimalMemory ? 0 : viewWidth < baseContentWidth(); + bool useVertPrefetch = useMinimalMemory ? 0 : viewHeight < baseContentHeight(); m_expandedTileBoundsX = (useHorzPrefetch) ? TILE_PREFETCH_DISTANCE : 0; m_expandedTileBoundsY = (useVertPrefetch) ? TILE_PREFETCH_DISTANCE : 0; @@ -464,10 +464,8 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect, // TODO: upload as many textures as possible within a certain time limit bool ret = ImagesManager::instance()->uploadTextures(); - if (scale < MIN_SCALE_WARNING || scale > MAX_SCALE_WARNING) { + if (scale < MIN_SCALE_WARNING || scale > MAX_SCALE_WARNING) XLOGC("WARNING, scale seems corrupted after update: %e", scale); - CRASH(); - } // gather the textures we can use TilesManager::instance()->gatherLayerTextures(); @@ -477,6 +475,8 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect, double currentTime = setupDrawing(rect, viewport, webViewRect, titleBarHeight, clip, scale); ret |= baseLayer->drawGL(currentTime, compositedRoot, rect, viewport, scale, buffersSwappedPtr); + FloatRect extrasclip(0, 0, rect.width(), rect.height()); + TilesManager::instance()->shader()->clip(extrasclip); m_glExtras.drawGL(webViewRect, viewport, titleBarHeight); glBindBuffer(GL_ARRAY_BUFFER, 0); diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.h b/Source/WebCore/platform/graphics/android/GLWebViewState.h index b2aab88..5f7ca71 100644 --- a/Source/WebCore/platform/graphics/android/GLWebViewState.h +++ b/Source/WebCore/platform/graphics/android/GLWebViewState.h @@ -165,7 +165,7 @@ class LayerAndroid; class GLWebViewState { public: - GLWebViewState(android::Mutex* globalButtonMutex); + GLWebViewState(); ~GLWebViewState(); ZoomManager* zoomManager() { return &m_zoomManager; } @@ -254,7 +254,6 @@ private: IntRect m_lastInval; IntRect m_frameworkInval; IntRect m_frameworkLayersInval; - android::Mutex* m_globalButtonMutex; bool m_baseLayerUpdate; SkRegion m_invalidateRegion; diff --git a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp index 6cb9288..05a0fdc 100644 --- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp @@ -652,7 +652,7 @@ bool GraphicsLayerAndroid::paintContext(SkPicture* context, if (!canvas) return false; - PlatformGraphicsContext platformContext(canvas, 0); + PlatformGraphicsContext platformContext(canvas); GraphicsContext graphicsContext(&platformContext); paintGraphicsLayerContents(graphicsContext, rect); diff --git a/Source/WebCore/platform/graphics/android/PlatformGraphicsContext.cpp b/Source/WebCore/platform/graphics/android/PlatformGraphicsContext.cpp index fcdcce9..098534c 100644 --- a/Source/WebCore/platform/graphics/android/PlatformGraphicsContext.cpp +++ b/Source/WebCore/platform/graphics/android/PlatformGraphicsContext.cpp @@ -30,13 +30,13 @@ namespace WebCore { -PlatformGraphicsContext::PlatformGraphicsContext(SkCanvas* canvas, WTF::Vector<Container>* buttons) - : mCanvas(canvas), m_deleteCanvas(false), m_buttons(buttons) +PlatformGraphicsContext::PlatformGraphicsContext(SkCanvas* canvas) + : mCanvas(canvas), m_deleteCanvas(false) { } PlatformGraphicsContext::PlatformGraphicsContext() - : mCanvas(new SkCanvas), m_deleteCanvas(true), m_buttons(0) + : mCanvas(new SkCanvas), m_deleteCanvas(true) { } @@ -48,27 +48,4 @@ PlatformGraphicsContext::~PlatformGraphicsContext() } } -void PlatformGraphicsContext::storeButtonInfo(Node* node, const IntRect& r) -{ - if (m_buttons == NULL) - return; - // Check to see if we already have a Container for this node. If so, update - // it with the new rectangle and make the new recording canvas reference - // its picture. - Container* end = m_buttons->end(); - for (Container* ptr = m_buttons->begin(); ptr != end; ptr++) { - if (ptr->matches(node)) { - mCanvas->drawPicture(*(ptr->picture())); - ptr->setRect(r); - return; - } - } - // We did not have a Container representing this node, so create a new one. - Container container(node, r); - // Place a reference to our subpicture in the Picture. - mCanvas->drawPicture(*(container.picture())); - // Keep track of the information about the button. - m_buttons->append(container); -} - } // WebCore diff --git a/Source/WebCore/platform/graphics/android/PlatformGraphicsContext.h b/Source/WebCore/platform/graphics/android/PlatformGraphicsContext.h index 6d08d44..d22dbd8 100644 --- a/Source/WebCore/platform/graphics/android/PlatformGraphicsContext.h +++ b/Source/WebCore/platform/graphics/android/PlatformGraphicsContext.h @@ -35,108 +35,6 @@ class SkCanvas; -class Container { -public: - Container(WebCore::Node* node, const WebCore::IntRect& r) - : m_node(node), m_rect(r), m_state(WebCore::RenderSkinAndroid::kDisabled) - { - m_picture = new SkPicture; - } - - ~Container() - { - m_picture->unref(); - } - - Container& operator=(const Container& src) - { - if (this != &src) { - m_node = src.m_node; - if (m_picture) - m_picture->unref(); - m_picture = src.m_picture; - m_picture->ref(); - m_rect = src.m_rect; - m_state = WebCore::RenderSkinAndroid::kDisabled; - } - return *this; - } - - Container(const Container& src) - { - m_node = src.m_node; - m_picture = src.m_picture; - m_picture->ref(); - m_rect = src.m_rect; - m_state = WebCore::RenderSkinAndroid::kDisabled; - } - - // m_picture has a ref count of 1 to begin with. It will increase each time - // m_picture is referenced by another picture. When the other pictures are - // deleted, the ref count gets decremented. If the ref count is one, then - // no other pictures reference this one, so the button is no longer being - // used, and therefore can be removed. - bool canBeRemoved() - { - return m_picture->getRefCnt() == 1; - } - - bool matches(const WebCore::Node* match) { return m_node == match; } - - const WebCore::Node* node() const { return m_node; } - - // Provide a pointer to our SkPicture. - SkPicture* picture() { return m_picture; } - - WebCore::IntRect rect() { return m_rect; } - - // Update the rectangle with a new rectangle, as the positioning of this - // button may have changed due to a new layout. If it is a new rectangle, - // set its state to disabled, so that it will be redrawn when we cycle - // through the list of buttons. - void setRect(WebCore::IntRect r) - { - if (m_rect != r) { - m_rect = r; - m_state = WebCore::RenderSkinAndroid::kDisabled; - } - } - - // Update the focus state of this button, depending on whether it - // corresponds to the focused node passed in. If its state has changed, - // re-record to the subpicture, so the master picture will reflect the - // change. - void updateFocusState(WebCore::RenderSkinAndroid::State state, - WebCore::RenderSkinButton* buttonSkin) - { - if (state == m_state) - return; - // If this button is being told to draw focused, but it is already in a - // pressed state, leave it in the pressed state, to show that it is - // being followed. - if (m_state == WebCore::RenderSkinAndroid::kPressed && - state == WebCore::RenderSkinAndroid::kFocused) - return; - m_state = state; - SkCanvas* canvas = m_picture->beginRecording(m_rect.maxX(), m_rect.maxY()); - buttonSkin->draw(canvas, m_rect, state); - m_picture->endRecording(); - } -private: - // Only used for comparison, since after it is stored it will be transferred - // to the UI thread. - WebCore::Node* m_node; - // The rectangle representing the bounds of the button. - WebCore::IntRect m_rect; - // An SkPicture that, thanks to storeButtonInfo, is pointed to by the master - // picture, so that we can rerecord this button without rerecording the - // world. - SkPicture* m_picture; - // The state of the button - Currently kFocused or kNormal (and kDisabled - // as an initial value), but could be expanded to include other states. - WebCore::RenderSkinAndroid::State m_state; -}; - namespace WebCore { class GraphicsContext; @@ -146,19 +44,14 @@ public: PlatformGraphicsContext(); // Pass in a recording canvas, and an array of button information to be // updated. - PlatformGraphicsContext(SkCanvas* canvas, WTF::Vector<Container>* buttons); + PlatformGraphicsContext(SkCanvas* canvas); ~PlatformGraphicsContext(); SkCanvas* mCanvas; bool deleteUs() const { return m_deleteCanvas; } - // If our graphicscontext has a button list, add a new container for the - // nod/rect, and record a new subpicture for this node/button in the current - // mCanvas - void storeButtonInfo(Node* node, const IntRect& r); private: bool m_deleteCanvas; - WTF::Vector<Container>* m_buttons; }; } diff --git a/Source/WebCore/platform/graphics/android/TilesManager.cpp b/Source/WebCore/platform/graphics/android/TilesManager.cpp index d36017f..acfe9e7 100644 --- a/Source/WebCore/platform/graphics/android/TilesManager.cpp +++ b/Source/WebCore/platform/graphics/android/TilesManager.cpp @@ -99,6 +99,7 @@ TilesManager::TilesManager() , m_showVisualIndicator(false) , m_invertedScreen(false) , m_invertedScreenSwitch(false) + , m_useMinimalMemory(true) , m_drawGLCount(1) { XLOG("TilesManager ctor"); diff --git a/Source/WebCore/platform/graphics/android/TilesManager.h b/Source/WebCore/platform/graphics/android/TilesManager.h index 4daecff..8ae9202 100644 --- a/Source/WebCore/platform/graphics/android/TilesManager.h +++ b/Source/WebCore/platform/graphics/android/TilesManager.h @@ -170,6 +170,16 @@ public: m_shader.setContrast(contrast); } + void setUseMinimalMemory(bool useMinimalMemory) + { + m_useMinimalMemory = useMinimalMemory; + } + + bool useMinimalMemory() + { + return m_useMinimalMemory; + } + void incDrawGLCount() { m_drawGLCount++; @@ -207,6 +217,8 @@ private: bool m_invertedScreen; bool m_invertedScreenSwitch; + bool m_useMinimalMemory; + sp<TexturesGenerator> m_pixmapsGenerationThread; android::Mutex m_texturesLock; diff --git a/Source/WebCore/platform/graphics/android/android_graphics.cpp b/Source/WebCore/platform/graphics/android/android_graphics.cpp index e255d29..e88c65d 100644 --- a/Source/WebCore/platform/graphics/android/android_graphics.cpp +++ b/Source/WebCore/platform/graphics/android/android_graphics.cpp @@ -112,22 +112,6 @@ void CursorRing::draw(SkCanvas* canvas, LayerAndroid* layer, IntRect* inval) void CursorRing::setIsButton(const CachedNode* node) { m_isButton = false; - m_viewImpl->gButtonMutex.lock(); - // If this is a button drawn by us (rather than webkit) do not draw the - // cursor ring, since its cursor will be shown by a change in what we draw. - // Should be in sync with recordButtons, since that will be called - // before this. - if (m_viewImpl->m_buttons.size() > 0) { - WebCore::Node* cursorPointer = (WebCore::Node*) node->nodePointer(); - Container* end = m_viewImpl->m_buttons.end(); - for (Container* ptr = m_viewImpl->m_buttons.begin(); ptr != end; ptr++) { - if (ptr->matches(cursorPointer)) { - m_isButton = true; - break; - } - } - } - m_viewImpl->gButtonMutex.unlock(); } bool CursorRing::setup() |