diff options
Diffstat (limited to 'Source/WebCore/platform')
19 files changed, 100 insertions, 197 deletions
diff --git a/Source/WebCore/platform/FileChooser.h b/Source/WebCore/platform/FileChooser.h index ac5e0e6..6c382d1 100644 --- a/Source/WebCore/platform/FileChooser.h +++ b/Source/WebCore/platform/FileChooser.h @@ -50,6 +50,9 @@ public: virtual String acceptTypes() = 0; virtual void chooseIconForFiles(FileChooser*, const Vector<String>&) = 0; virtual ~FileChooserClient(); +#if PLATFORM(ANDROID) && ENABLE(MEDIA_CAPTURE) + virtual String capture() = 0; +#endif }; class FileChooser : public RefCounted<FileChooser> { @@ -79,6 +82,10 @@ public: // Acceptable MIME types. It's an 'accept' attribute value of the corresponding INPUT element. String acceptTypes() const { return m_client ? m_client->acceptTypes() : String(); } +#if PLATFORM(ANDROID) && ENABLE(MEDIA_CAPTURE) + String capture() const { return m_client ? m_client->capture() : String(); } +#endif + private: FileChooser(FileChooserClient*, const Vector<String>& initialFilenames); void initialize(); diff --git a/Source/WebCore/platform/graphics/Gradient.cpp b/Source/WebCore/platform/graphics/Gradient.cpp index 7541646..7e3984f 100644 --- a/Source/WebCore/platform/graphics/Gradient.cpp +++ b/Source/WebCore/platform/graphics/Gradient.cpp @@ -221,7 +221,7 @@ void Gradient::setGradientSpaceTransform(const AffineTransform& gradientSpaceTra setPlatformGradientSpaceTransform(gradientSpaceTransformation); } -#if !(USE(SKIA) && !PLATFORM(ANDROID)) && !USE(CAIRO) +#if !USE(SKIA) && !USE(CAIRO) void Gradient::setPlatformGradientSpaceTransform(const AffineTransform&) { } diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp index 36e25c9..8581a8e 100644 --- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp +++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp @@ -70,7 +70,7 @@ GLWebViewState::GLWebViewState() , m_goingLeft(false) , m_scale(1) , m_layersRenderingMode(kAllTextures) - , m_surfaceCollectionManager(this) + , m_surfaceCollectionManager() { m_viewport.setEmpty(); @@ -302,9 +302,10 @@ int GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect, bool shouldDraw) { TilesManager* tilesManager = TilesManager::instance(); - tilesManager->getProfiler()->nextFrame(viewport.fLeft, viewport.fTop, - viewport.fRight, viewport.fBottom, - scale); + if (shouldDraw) + tilesManager->getProfiler()->nextFrame(viewport.fLeft, viewport.fTop, + viewport.fRight, viewport.fBottom, + scale); tilesManager->incDrawGLCount(); ALOGV("drawGL, rect/viewRect(%d, %d, %d, %d), viewport/visibleRect(%.2f, %.2f, %.2f, %.2f)", diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.h b/Source/WebCore/platform/graphics/android/GLWebViewState.h index 6d969dd..2b28619 100644 --- a/Source/WebCore/platform/graphics/android/GLWebViewState.h +++ b/Source/WebCore/platform/graphics/android/GLWebViewState.h @@ -192,10 +192,6 @@ public: bool goingDown() { return m_goingDown; } bool goingLeft() { return m_goingLeft; } - void setDirection(bool goingDown, bool goingLeft) { - m_goingDown = goingDown; - m_goingLeft = goingLeft; - } float scale() { return m_scale; } diff --git a/Source/WebCore/platform/graphics/android/GradientAndroid.cpp b/Source/WebCore/platform/graphics/android/GradientAndroid.cpp deleted file mode 100644 index 7bc69c5..0000000 --- a/Source/WebCore/platform/graphics/android/GradientAndroid.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2006, The Android Open Source Project - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "Gradient.h" - -#include "CSSParser.h" -#include "GraphicsContext.h" -#include "NotImplemented.h" -#include "SkCanvas.h" -#include "SkColorShader.h" -#include "SkGradientShader.h" -#include "SkPaint.h" - -namespace WebCore { - -void Gradient::platformDestroy() -{ - delete m_gradient; - m_gradient = 0; -} - -static U8CPU F2B(float x) -{ - return (int)(x * 255); -} - -SkShader* Gradient::platformGradient() -{ - if (m_gradient) - return m_gradient; - - // need to ensure that the m_stops array is sorted. We call getColor() - // which, as a side effect, does the sort. - // TODO: refactor Gradient.h to formally expose a sort method - { - float r, g, b, a; - this->getColor(0, &r, &g, &b, &a); - } - - SkShader::TileMode mode = SkShader::kClamp_TileMode; - switch (m_spreadMethod) { - case SpreadMethodReflect: - mode = SkShader::kMirror_TileMode; - break; - case SpreadMethodRepeat: - mode = SkShader::kRepeat_TileMode; - break; - case SpreadMethodPad: - mode = SkShader::kClamp_TileMode; - break; - } - - SkPoint pts[2] = { m_p0, m_p1 }; // convert to SkPoint - - const size_t count = m_stops.size(); - SkAutoMalloc storage(count * (sizeof(SkColor) + sizeof(SkScalar))); - SkColor* colors = (SkColor*)storage.get(); - SkScalar* pos = (SkScalar*)(colors + count); - - Vector<ColorStop>::iterator iter = m_stops.begin(); - for (int i = 0; iter != m_stops.end(); i++) { - pos[i] = SkFloatToScalar(iter->stop); - colors[i] = SkColorSetARGB(F2B(iter->alpha), F2B(iter->red), - F2B(iter->green), F2B(iter->blue)); - ++iter; - } - - if (m_radial) { - m_gradient = SkGradientShader::CreateTwoPointRadial(pts[0], - SkFloatToScalar(m_r0), - pts[1], - SkFloatToScalar(m_r1), - colors, pos, count, mode); - } else - m_gradient = SkGradientShader::CreateLinear(pts, colors, pos, count, mode); - - if (!m_gradient) - m_gradient = new SkColorShader(0); - - SkMatrix matrix = m_gradientSpaceTransformation; - m_gradient->setLocalMatrix(matrix); - - return m_gradient; -} - -void Gradient::fill(GraphicsContext* context, const FloatRect& rect) -{ - context->setFillGradient(this); - context->fillRect(rect); -} - - -} //namespace diff --git a/Source/WebCore/platform/graphics/android/context/GraphicsContextAndroid.cpp b/Source/WebCore/platform/graphics/android/context/GraphicsContextAndroid.cpp index 12b53a3..f2d1400 100644 --- a/Source/WebCore/platform/graphics/android/context/GraphicsContextAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/context/GraphicsContextAndroid.cpp @@ -66,13 +66,31 @@ private: PlatformGraphicsContext* m_context; }; -static SkShader* extractShader(Pattern* pat, Gradient* grad) +static void syncPlatformContext(GraphicsContext* gc) { - if (pat) - return pat->platformPattern(AffineTransform()); - else if (grad) - return grad->platformGradient(); - return 0; + // Stroke and fill sometimes reference each other, so always + // sync them both to make sure our state is consistent. + + PlatformGraphicsContext* pgc = gc->platformContext(); + Gradient* grad = gc->state().fillGradient.get(); + Pattern* pat = gc->state().fillPattern.get(); + + if (grad) + pgc->setFillShader(grad->platformGradient()); + else if (pat) + pgc->setFillShader(pat->platformPattern(AffineTransform())); + else + pgc->setFillColor(gc->state().fillColor); + + grad = gc->state().strokeGradient.get(); + pat = gc->state().strokePattern.get(); + + if (grad) + pgc->setStrokeShader(grad->platformGradient()); + else if (pat) + pgc->setStrokeShader(pat->platformPattern(AffineTransform())); + else + pgc->setStrokeColor(gc->state().strokeColor); } //////////////////////////////////////////////////////////////////////////////////////////////// @@ -137,6 +155,7 @@ void GraphicsContext::drawRect(const IntRect& rect) if (paintingDisabled()) return; + syncPlatformContext(this); platformContext()->drawRect(rect); } @@ -146,6 +165,7 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) if (paintingDisabled()) return; + syncPlatformContext(this); platformContext()->drawLine(point1, point2); } @@ -154,6 +174,7 @@ void GraphicsContext::drawLineForText(const FloatPoint& pt, float width, bool /* if (paintingDisabled()) return; + syncPlatformContext(this); platformContext()->drawLineForText(pt, width); } @@ -163,6 +184,7 @@ void GraphicsContext::drawLineForTextChecking(const FloatPoint& pt, float width, if (paintingDisabled()) return; + syncPlatformContext(this); platformContext()->drawLineForTextChecking(pt, width, style); } @@ -172,6 +194,7 @@ void GraphicsContext::drawEllipse(const IntRect& rect) if (paintingDisabled()) return; + syncPlatformContext(this); platformContext()->drawEllipse(rect); } @@ -180,6 +203,7 @@ void GraphicsContext::strokeArc(const IntRect& r, int startAngle, int angleSpan) if (paintingDisabled()) return; + syncPlatformContext(this); platformContext()->strokeArc(r, startAngle, angleSpan); } @@ -189,6 +213,7 @@ void GraphicsContext::drawConvexPolygon(size_t numPoints, const FloatPoint* poin if (paintingDisabled()) return; + syncPlatformContext(this); platformContext()->drawConvexPolygon(numPoints, points, shouldAntialias); } @@ -199,6 +224,7 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLef if (paintingDisabled()) return; + syncPlatformContext(this); platformContext()->fillRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight, color, colorSpace); } @@ -208,6 +234,7 @@ void GraphicsContext::fillRect(const FloatRect& rect) if (paintingDisabled()) return; + syncPlatformContext(this); platformContext()->fillRect(rect); } @@ -216,6 +243,7 @@ void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, ColorS if (paintingDisabled()) return; + syncPlatformContext(this); platformContext()->fillRect(rect, color, colorSpace); } @@ -308,6 +336,7 @@ void GraphicsContext::setupFillPaint(SkPaint* paint) { if (paintingDisabled()) return; + syncPlatformContext(this); platformContext()->setupPaintFill(paint); } @@ -315,6 +344,7 @@ void GraphicsContext::setupStrokePaint(SkPaint* paint) { if (paintingDisabled()) return; + syncPlatformContext(this); platformContext()->setupPaintStroke(paint, 0); } @@ -322,14 +352,12 @@ bool GraphicsContext::setupShadowPaint(SkPaint* paint, SkPoint* offset) { if (paintingDisabled()) return false; + syncPlatformContext(this); return platformContext()->setupPaintShadow(paint, offset); } void GraphicsContext::setPlatformStrokeColor(const Color& c, ColorSpace) { - if (paintingDisabled()) - return; - platformContext()->setStrokeColor(c); } void GraphicsContext::setPlatformStrokeThickness(float f) @@ -348,9 +376,6 @@ void GraphicsContext::setPlatformStrokeStyle(StrokeStyle style) void GraphicsContext::setPlatformFillColor(const Color& c, ColorSpace) { - if (paintingDisabled()) - return; - platformContext()->setFillColor(c); } void GraphicsContext::setPlatformShadow(const FloatSize& size, float blur, const Color& color, ColorSpace) @@ -384,6 +409,7 @@ void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int if (paintingDisabled()) return; + syncPlatformContext(this); platformContext()->drawFocusRing(rects, width, offset, color); } @@ -424,6 +450,7 @@ void GraphicsContext::clearRect(const FloatRect& rect) if (paintingDisabled()) return; + syncPlatformContext(this); platformContext()->clearRect(rect); } @@ -432,6 +459,7 @@ void GraphicsContext::strokeRect(const FloatRect& rect, float lineWidth) if (paintingDisabled()) return; + syncPlatformContext(this); platformContext()->strokeRect(rect, lineWidth); } @@ -520,34 +548,18 @@ void GraphicsContext::setPlatformShouldAntialias(bool useAA) void GraphicsContext::setPlatformFillGradient(Gradient* fillGradient) { - if (paintingDisabled()) - return; - SkShader* shader = extractShader(0, fillGradient); - platformContext()->setFillShader(shader); } void GraphicsContext::setPlatformFillPattern(Pattern* fillPattern) { - if (paintingDisabled()) - return; - SkShader* shader = extractShader(fillPattern, 0); - platformContext()->setFillShader(shader); } void GraphicsContext::setPlatformStrokeGradient(Gradient* strokeGradient) { - if (paintingDisabled()) - return; - SkShader* shader = extractShader(0, strokeGradient); - platformContext()->setStrokeShader(shader); } void GraphicsContext::setPlatformStrokePattern(Pattern* strokePattern) { - if (paintingDisabled()) - return; - SkShader* shader = extractShader(strokePattern, 0); - platformContext()->setStrokeShader(shader); } AffineTransform GraphicsContext::getCTM() const @@ -579,6 +591,7 @@ void GraphicsContext::fillPath(const Path& pathToFill) if (paintingDisabled()) return; + syncPlatformContext(this); platformContext()->fillPath(pathToFill, fillRule()); } @@ -587,6 +600,7 @@ void GraphicsContext::strokePath(const Path& pathToStroke) if (paintingDisabled()) return; + syncPlatformContext(this); platformContext()->strokePath(pathToStroke); } @@ -634,6 +648,7 @@ void GraphicsContext::drawHighlightForText(const Font& font, const TextRun& run, if (paintingDisabled()) return; + syncPlatformContext(this); platformContext()->drawHighlightForText(font, run, point, h, backgroundColor, colorSpace, from, to, isActive); } diff --git a/Source/WebCore/platform/graphics/android/rendering/BaseRenderer.cpp b/Source/WebCore/platform/graphics/android/rendering/BaseRenderer.cpp index 833aea9..8bb1755 100644 --- a/Source/WebCore/platform/graphics/android/rendering/BaseRenderer.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/BaseRenderer.cpp @@ -112,7 +112,7 @@ void BaseRenderer::renderTiledContent(TileRenderInfo& renderInfo) setupPartialInval(renderInfo, &canvas); canvas.translate(-renderInfo.x * tileSize.width(), -renderInfo.y * tileSize.height()); canvas.scale(renderInfo.scale, renderInfo.scale); - renderInfo.tilePainter->paint(renderInfo.baseTile, &canvas); + renderInfo.tilePainter->paint(&canvas); if (renderInfo.baseTile && renderInfo.baseTile->backTexture()) checkForPureColor(renderInfo, &canvas); else diff --git a/Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp b/Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp index 9890331..cd43c03 100644 --- a/Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp @@ -215,14 +215,14 @@ float ImageTexture::opacity() return m_layer->drawOpacity(); } -bool ImageTexture::paint(Tile* tile, SkCanvas* canvas) +bool ImageTexture::paint(SkCanvas* canvas) { if (!m_picture) { ALOGV("IT %p COULDNT PAINT, NO PICTURE", this); return false; } - ALOGV("IT %p painting tile %d, %d with picture %p", this, tile->x(), tile->y(), m_picture); + ALOGV("IT %p painting with picture %p", this, m_picture); canvas->drawPicture(*m_picture); return true; diff --git a/Source/WebCore/platform/graphics/android/rendering/ImageTexture.h b/Source/WebCore/platform/graphics/android/rendering/ImageTexture.h index 34430f1..9e1de32 100644 --- a/Source/WebCore/platform/graphics/android/rendering/ImageTexture.h +++ b/Source/WebCore/platform/graphics/android/rendering/ImageTexture.h @@ -86,7 +86,7 @@ public: bool equalsCRC(unsigned crc); // methods used by TileGrid - virtual bool paint(Tile* tile, SkCanvas* canvas); + virtual bool paint(SkCanvas* canvas); virtual float opacity(); int nbTextures(); diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp index 43b0b77..a9ebd1e 100644 --- a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp @@ -298,7 +298,7 @@ bool Surface::isBase() return getFirstLayer()->subclassType() == LayerAndroid::BaseLayer; } -bool Surface::paint(Tile* tile, SkCanvas* canvas) +bool Surface::paint(SkCanvas* canvas) { if (singleLayer()) { getFirstLayer()->contentDraw(canvas, Layer::UnmergedLayers); diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.h b/Source/WebCore/platform/graphics/android/rendering/Surface.h index d197d43..0fced47 100644 --- a/Source/WebCore/platform/graphics/android/rendering/Surface.h +++ b/Source/WebCore/platform/graphics/android/rendering/Surface.h @@ -63,7 +63,7 @@ public: bool isBase(); // TilePainter methods - virtual bool paint(Tile* tile, SkCanvas* canvas); + virtual bool paint(SkCanvas* canvas); virtual float opacity(); virtual Color* background(); diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp index 7c8f570..b8d751c 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp @@ -42,6 +42,7 @@ SurfaceBacking::SurfaceBacking(bool isBaseSurface) { m_frontTexture = new TileGrid(isBaseSurface); m_backTexture = new TileGrid(isBaseSurface); + m_lowResTexture = new TileGrid(isBaseSurface); m_scale = -1; m_futureScale = -1; m_zooming = false; @@ -51,6 +52,7 @@ SurfaceBacking::~SurfaceBacking() { delete m_frontTexture; delete m_backTexture; + delete m_lowResTexture; } void SurfaceBacking::prepareGL(GLWebViewState* state, bool allowZoom, @@ -70,6 +72,9 @@ void SurfaceBacking::prepareGL(GLWebViewState* state, bool allowZoom, m_futureScale = scale; m_zoomUpdateTime = WTF::currentTime() + SurfaceBacking::s_zoomUpdateDelay; m_zooming = true; + + // release back texture's TileTextures, so they can be reused immediately + m_backTexture->discardTextures(); } bool useExpandPrefetch = aggressiveRendering; @@ -77,39 +82,43 @@ void SurfaceBacking::prepareGL(GLWebViewState* state, bool allowZoom, this, scale, m_scale, m_futureScale, m_zooming, m_frontTexture, m_backTexture); - if (!m_zooming) { - m_frontTexture->prepareGL(state, m_scale, - prepareArea, unclippedArea, painter, false, useExpandPrefetch); - if (aggressiveRendering) { - // prepare the back tiled texture to render content in low res - float lowResPrefetchScale = m_scale * LOW_RES_PREFETCH_SCALE_MODIFIER; - m_backTexture->prepareGL(state, lowResPrefetchScale, - prepareArea, unclippedArea, painter, true, useExpandPrefetch); - m_backTexture->swapTiles(); - } - } else if (m_zoomUpdateTime < WTF::currentTime()) { + if (m_zooming && (m_zoomUpdateTime < WTF::currentTime())) { m_backTexture->prepareGL(state, m_futureScale, - prepareArea, unclippedArea, painter, false, useExpandPrefetch); + prepareArea, unclippedArea, painter, false, false); if (m_backTexture->isReady()) { // zooming completed, swap the textures and new front tiles swapTileGrids(); m_frontTexture->swapTiles(); m_backTexture->discardTextures(); + m_lowResTexture->discardTextures(); m_scale = m_futureScale; m_zooming = false; } } + + if (!m_zooming) { + m_frontTexture->prepareGL(state, m_scale, + prepareArea, unclippedArea, painter, false, useExpandPrefetch); + if (aggressiveRendering) { + // prepare low res content + float lowResPrefetchScale = m_scale * LOW_RES_PREFETCH_SCALE_MODIFIER; + m_lowResTexture->prepareGL(state, lowResPrefetchScale, + prepareArea, unclippedArea, painter, + true, useExpandPrefetch); + m_lowResTexture->swapTiles(); + } + } } void SurfaceBacking::drawGL(const IntRect& visibleArea, float opacity, const TransformationMatrix* transform, bool aggressiveRendering, const Color* background) { - // draw low res prefetch page, if needed - if (aggressiveRendering && !m_zooming && m_frontTexture->isMissingContent()) - m_backTexture->drawGL(visibleArea, opacity, transform); + // draw low res prefetch page if zooming or front texture missing content + if (aggressiveRendering && isMissingContent()) + m_lowResTexture->drawGL(visibleArea, opacity, transform); m_frontTexture->drawGL(visibleArea, opacity, transform, background); } @@ -118,12 +127,14 @@ void SurfaceBacking::markAsDirty(const SkRegion& dirtyArea) { m_backTexture->markAsDirty(dirtyArea); m_frontTexture->markAsDirty(dirtyArea); + m_lowResTexture->markAsDirty(dirtyArea); } void SurfaceBacking::swapTiles() { m_backTexture->swapTiles(); m_frontTexture->swapTiles(); + m_lowResTexture->swapTiles(); } void SurfaceBacking::computeTexturesAmount(TexturesResult* result, LayerAndroid* layer) diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h index ec01dbe..bbac9b5 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h @@ -61,7 +61,7 @@ public: bool isMissingContent() { - return !m_zooming && m_frontTexture->isMissingContent(); + return m_zooming || m_frontTexture->isMissingContent(); } int nbTextures(IntRect& area, float scale) @@ -80,6 +80,8 @@ private: TileGrid* m_frontTexture; TileGrid* m_backTexture; + TileGrid* m_lowResTexture; + float m_scale; float m_futureScale; double m_zoomUpdateTime; diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp index 8c9cad5..52a8e44 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp @@ -36,9 +36,8 @@ namespace WebCore { -SurfaceCollectionManager::SurfaceCollectionManager(GLWebViewState* state) - : m_state(state) - , m_drawingCollection(0) +SurfaceCollectionManager::SurfaceCollectionManager() + : m_drawingCollection(0) , m_paintingCollection(0) , m_queuedCollection(0) , m_fastSwapMode(false) @@ -59,8 +58,6 @@ void SurfaceCollectionManager::swap() // swap can't be called unless painting just finished ASSERT(m_paintingCollection); - android::Mutex::Autolock lock(m_paintSwapLock); - ALOGV("SWAPPING, D %p, P %p, Q %p", m_drawingCollection, m_paintingCollection, m_queuedCollection); @@ -90,8 +87,6 @@ void SurfaceCollectionManager::swap() // clear all of the content in the three collections held by the collection manager void SurfaceCollectionManager::clearCollections() { - ALOGV("SurfaceCollectionManager %p removing PS from state %p", this, m_state); - SkSafeUnref(m_drawingCollection); m_drawingCollection = 0; SkSafeUnref(m_paintingCollection); @@ -109,8 +104,6 @@ bool SurfaceCollectionManager::updateWithSurfaceCollection(SurfaceCollection* ne // can't have a queued collection unless have a painting collection too ASSERT(m_paintingCollection || !m_queuedCollection); - android::Mutex::Autolock lock(m_paintSwapLock); - if (!newCollection || brandNew) { clearCollections(); if (brandNew) { diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.h b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.h index cc98899..125bf02 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.h +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.h @@ -41,7 +41,7 @@ class SurfaceCollection; class TEST_EXPORT SurfaceCollectionManager { public: - SurfaceCollectionManager(GLWebViewState* state); + SurfaceCollectionManager(); ~SurfaceCollectionManager(); @@ -58,10 +58,6 @@ private: void swap(); void clearCollections(); - android::Mutex m_paintSwapLock; - - GLWebViewState* m_state; - SurfaceCollection* m_drawingCollection; SurfaceCollection* m_paintingCollection; SurfaceCollection* m_queuedCollection; diff --git a/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp b/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp index 398db72..00cc656 100644 --- a/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp @@ -341,7 +341,6 @@ void TileGrid::drawMissingRegion(const SkRegion& region, float opacity, SkRegion::Iterator iterator(region); const float tileWidth = TilesManager::tileWidth() / m_scale; const float tileHeight = TilesManager::tileHeight() / m_scale; - ShaderProgram* shader = TilesManager::instance()->shader(); while (!iterator.done()) { SkIRect r = iterator.rect(); SkRect rect; diff --git a/Source/WebCore/platform/graphics/android/rendering/TilePainter.h b/Source/WebCore/platform/graphics/android/rendering/TilePainter.h index d992aee..53dfadc 100644 --- a/Source/WebCore/platform/graphics/android/rendering/TilePainter.h +++ b/Source/WebCore/platform/graphics/android/rendering/TilePainter.h @@ -33,14 +33,13 @@ class SkCanvas; namespace WebCore { -class Tile; class Color; class TilePainter : public SkRefCnt { // TODO: investigate webkit threadsafe ref counting public: virtual ~TilePainter() { } - virtual bool paint(Tile* tile, SkCanvas* canvas) = 0; + virtual bool paint(SkCanvas* canvas) = 0; virtual float opacity() { return 1.0; } enum SurfaceType { Painted, Image }; virtual SurfaceType type() { return Painted; } diff --git a/Source/WebCore/platform/graphics/android/rendering/TileTexture.cpp b/Source/WebCore/platform/graphics/android/rendering/TileTexture.cpp index 39effd7..126a7ac 100644 --- a/Source/WebCore/platform/graphics/android/rendering/TileTexture.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/TileTexture.cpp @@ -77,15 +77,15 @@ void TileTexture::discardGLTexture() } } -bool TileTexture::acquire(TextureOwner* owner, bool force) +bool TileTexture::acquire(TextureOwner* owner) { if (m_owner == owner) return true; - return setOwner(owner, force); + return setOwner(owner); } -bool TileTexture::setOwner(TextureOwner* owner, bool force) +bool TileTexture::setOwner(TextureOwner* owner) { bool proceed = true; if (m_owner && m_owner != owner) diff --git a/Source/WebCore/platform/graphics/android/rendering/TileTexture.h b/Source/WebCore/platform/graphics/android/rendering/TileTexture.h index 5fe43b0..b008b7d 100644 --- a/Source/WebCore/platform/graphics/android/rendering/TileTexture.h +++ b/Source/WebCore/platform/graphics/android/rendering/TileTexture.h @@ -51,11 +51,11 @@ public: // allows consumer thread to assign ownership of the texture to the tile. It // returns false if ownership cannot be transferred because the tile is busy - bool acquire(TextureOwner* owner, bool force = false); + bool acquire(TextureOwner* owner); bool release(TextureOwner* owner); // set the texture owner if not busy. Return false if busy, true otherwise. - bool setOwner(TextureOwner* owner, bool force = false); + bool setOwner(TextureOwner* owner); // private member accessor functions TextureOwner* owner() { return m_owner; } // only used by the consumer thread |