diff options
author | Nicolas Roard <nicolas@android.com> | 2010-11-02 12:52:48 -0700 |
---|---|---|
committer | Nicolas Roard <nicolas@android.com> | 2010-11-02 16:43:41 -0700 |
commit | d62fe68ed1fe9531732ba8503ca8c53e48ba09ba (patch) | |
tree | 3a0061956683752698da22504f54ca600d0072a5 /WebCore/platform/graphics/android/BaseLayerAndroid.cpp | |
parent | 48735f195bdb1f681dba8e1d67f0b85b9b74c1a8 (diff) | |
download | external_webkit-d62fe68ed1fe9531732ba8503ca8c53e48ba09ba.zip external_webkit-d62fe68ed1fe9531732ba8503ca8c53e48ba09ba.tar.gz external_webkit-d62fe68ed1fe9531732ba8503ca8c53e48ba09ba.tar.bz2 |
Set the page background color in BaseLayerAndroid
This allows us to show the correct background even if the tiles aren't yet painted.
Change-Id: Ia3ef97770aadb5f64490e44f20110ea21578ccd0
Diffstat (limited to 'WebCore/platform/graphics/android/BaseLayerAndroid.cpp')
-rw-r--r-- | WebCore/platform/graphics/android/BaseLayerAndroid.cpp | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp index c043edb..2d38dc1 100644 --- a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp +++ b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp @@ -64,7 +64,8 @@ int BaseLayerAndroid::count() BaseLayerAndroid::BaseLayerAndroid() #if USE(ACCELERATED_COMPOSITING) - : m_glWebViewState(0) + : m_glWebViewState(0), + m_color(Color::white) #endif { #ifdef DEBUG_COUNT @@ -211,9 +212,9 @@ bool BaseLayerAndroid::drawGL(IntRect& viewRect, SkRect& visibleRect, glEnable(GL_SCISSOR_TEST); glScissor(left, top, width, height); - glClearColor((float)SkColorGetR(color) / 255.0, - (float)SkColorGetG(color) / 255.0, - (float)SkColorGetB(color) / 255.0, 1); + glClearColor((float)m_color.red() / 255.0, + (float)m_color.green() / 255.0, + (float)m_color.blue() / 255.0, 1); glClear(GL_COLOR_BUFFER_BIT); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -238,30 +239,4 @@ bool BaseLayerAndroid::drawGL(IntRect& viewRect, SkRect& visibleRect, return ret; } -SkColor BaseLayerAndroid::getColor(const SkIRect& rect) -{ - SkBitmap sample, pixel; - SkCanvas canvas; - sample.setConfig(SkBitmap::kARGB_8888_Config, rect.width(), rect.height()); - sample.allocPixels(); - canvas.setBitmapDevice(sample); - canvas.save(); - canvas.translate(-rect.fLeft, -rect.fTop); - draw(&canvas); - canvas.restore(); - pixel.setConfig(SkBitmap::kARGB_8888_Config, 1, 1); - pixel.allocPixels(); - canvas.setBitmapDevice(pixel); - SkPaint paint; - paint.setFlags(SkPaint::kFilterBitmap_Flag); - canvas.scale(SkScalarInvert(SkIntToScalar(rect.width())), - SkScalarInvert(SkIntToScalar(rect.height()))); - canvas.drawBitmap(sample, 0, 0, &paint); - pixel.lockPixels(); - uint32_t* colorAddr = pixel.getAddr32(0, 0); - SkColor result = (SkColor) *colorAddr; - pixel.unlockPixels(); - return result; -} - } // namespace WebCore |