diff options
author | Derek Sollenberger <djsollen@google.com> | 2011-02-24 05:27:46 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-02-24 05:27:47 -0800 |
commit | ae9f5f699fd7ae6cac2e90a646fa4bfa1e1412ca (patch) | |
tree | 9b09533becaca8a2ab72c9f50b1062148f95944b /WebCore/platform | |
parent | 52df3a88ee4d2299c8e84771a803e75dbadc2e8e (diff) | |
parent | b33016812afef21c69df5ab3d5b85eab5fef7c5c (diff) | |
download | external_webkit-ae9f5f699fd7ae6cac2e90a646fa4bfa1e1412ca.zip external_webkit-ae9f5f699fd7ae6cac2e90a646fa4bfa1e1412ca.tar.gz external_webkit-ae9f5f699fd7ae6cac2e90a646fa4bfa1e1412ca.tar.bz2 |
Merge "Skia Merge (revision 808)"
Diffstat (limited to 'WebCore/platform')
8 files changed, 58 insertions, 27 deletions
diff --git a/WebCore/platform/graphics/android/BaseTile.cpp b/WebCore/platform/graphics/android/BaseTile.cpp index bfd5118..9499870 100644 --- a/WebCore/platform/graphics/android/BaseTile.cpp +++ b/WebCore/platform/graphics/android/BaseTile.cpp @@ -254,7 +254,27 @@ void BaseTile::paintBitmap() float w = tileWidth * invScale; float h = tileHeight * invScale; - SkCanvas* canvas = texture->canvas(); + SkCanvas* canvas; + +#ifdef USE_SKIA_GPU + GLuint fboId; + glGenFramebuffersEXT(1, &fboId); + glBindFramebuffer(GL_FRAMEBUFFER, fboId); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureInfo->m_textureId, 0); + glCheckFramebufferStatus(GL_FRAMEBUFFER)); // should return GL_FRAMEBUFFER_COMPLETE + + //Do I need to assign a width/height/format? + + GrContext* context = gr_get_global_ctx(); + context->resetContext(); + GrRenderTarget* target = context->createPlatformRenderTarget(fboId, tileWidth, tileHeight); + SkCanvas tmpCanvas; + SkDevice* device = new SkGpuDevice(context, bm, target); + tmpCanvas.setDevice(device)->unref(); + canvas = &tmpCanvas; +#else + canvas = texture->canvas(); +#endif canvas->save(); canvas->drawColor(tiledPage->glWebViewState()->getBackgroundColor()); @@ -279,7 +299,18 @@ void BaseTile::paintBitmap() } texture->setTile(x, y); + +#ifdef USE_SKIA_GPU + // set the texture info w/h/format + textureInfo->m_width = tileWidth; + textureInfo->m_height = tileHeight; + texture->producerReleaseAndSwap(); + + glBindFramebuffer(GL_FRAMEBUFFER, 0); // rebind the standard FBO + glDeleteFramebuffers(1, &fboId); +#else texture->producerUpdate(textureInfo); +#endif m_atomicSync.lock(); m_lastPaintedPicture = pictureCount; diff --git a/WebCore/platform/graphics/android/FontCustomPlatformData.cpp b/WebCore/platform/graphics/android/FontCustomPlatformData.cpp index e17e532..4795d9e 100644 --- a/WebCore/platform/graphics/android/FontCustomPlatformData.cpp +++ b/WebCore/platform/graphics/android/FontCustomPlatformData.cpp @@ -35,13 +35,13 @@ namespace WebCore { FontCustomPlatformData::FontCustomPlatformData(SkTypeface* face) { - face->safeRef(); + SkSafeRef(face); m_typeface = face; } FontCustomPlatformData::~FontCustomPlatformData() { - m_typeface->safeUnref(); + SkSafeUnref(m_typeface); // the unref is enough to release the font data... } diff --git a/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp b/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp index 974b828..194bc62 100644 --- a/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp +++ b/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp @@ -83,7 +83,7 @@ FontPlatformData::FontPlatformData() FontPlatformData::FontPlatformData(const FontPlatformData& src) { if (hashTableDeletedFontValue() != src.mTypeface) { - src.mTypeface->safeRef(); + SkSafeRef(src.mTypeface); } mTypeface = src.mTypeface; @@ -101,7 +101,7 @@ FontPlatformData::FontPlatformData(SkTypeface* tf, float textSize, bool fakeBold : mTypeface(tf), mTextSize(textSize), mFakeBold(fakeBold), mFakeItalic(fakeItalic) { if (hashTableDeletedFontValue() != mTypeface) { - mTypeface->safeRef(); + SkSafeRef(mTypeface); } inc_count(); @@ -113,7 +113,7 @@ FontPlatformData::FontPlatformData(const FontPlatformData& src, float textSize) m_harfbuzzFace(src.m_harfbuzzFace) { if (hashTableDeletedFontValue() != mTypeface) { - mTypeface->safeRef(); + SkSafeRef(mTypeface); } inc_count(); @@ -135,17 +135,17 @@ FontPlatformData::~FontPlatformData() #endif if (hashTableDeletedFontValue() != mTypeface) { - mTypeface->safeUnref(); + SkSafeUnref(mTypeface); } } FontPlatformData& FontPlatformData::operator=(const FontPlatformData& src) { if (hashTableDeletedFontValue() != src.mTypeface) { - src.mTypeface->safeRef(); + SkSafeRef(src.mTypeface); } if (hashTableDeletedFontValue() != mTypeface) { - mTypeface->safeUnref(); + SkSafeUnref(mTypeface); } mTypeface = src.mTypeface; diff --git a/WebCore/platform/graphics/android/GLWebViewState.cpp b/WebCore/platform/graphics/android/GLWebViewState.cpp index 3d2f6c8..b3c5b02 100644 --- a/WebCore/platform/graphics/android/GLWebViewState.cpp +++ b/WebCore/platform/graphics/android/GLWebViewState.cpp @@ -85,7 +85,7 @@ GLWebViewState::GLWebViewState(android::Mutex* buttonMutex) GLWebViewState::~GLWebViewState() { - m_currentBaseLayer->safeUnref(); + SkSafeUnref(m_currentBaseLayer); delete m_tiledPageA; delete m_tiledPageB; #ifdef DEBUG_COUNT @@ -110,8 +110,8 @@ void GLWebViewState::setBaseLayer(BaseLayerAndroid* layer, const IntRect& rect, // We only update the layers if we are not currently // waiting for a tiledPage to be painted if (m_baseLayerUpdate) { - layer->safeRef(); - m_currentBaseLayer->safeUnref(); + SkSafeRef(layer); + SkSafeUnref(m_currentBaseLayer); m_currentBaseLayer = layer; } inval(rect); @@ -122,8 +122,8 @@ void GLWebViewState::setBaseLayer(BaseLayerAndroid* layer, const IntRect& rect, void GLWebViewState::unlockBaseLayerUpdate() { m_baseLayerUpdate = true; android::Mutex::Autolock lock(m_baseLayerLock); - m_baseLayer->safeRef(); - m_currentBaseLayer->safeUnref(); + SkSafeRef(m_baseLayer); + SkSafeUnref(m_currentBaseLayer); m_currentBaseLayer = m_baseLayer; inval(m_invalidateRect); IntRect empty; @@ -303,12 +303,12 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, float scale, SkColo { m_baseLayerLock.lock(); BaseLayerAndroid* baseLayer = m_currentBaseLayer; - baseLayer->safeRef(); + SkSafeRef(baseLayer); m_baseLayerLock.unlock(); if (!baseLayer) return false; bool ret = baseLayer->drawGL(rect, viewport, scale, color); - baseLayer->safeUnref(); + SkSafeUnref(baseLayer); return ret; } diff --git a/WebCore/platform/graphics/android/GradientAndroid.cpp b/WebCore/platform/graphics/android/GradientAndroid.cpp index 72ae336..b8dc9dd 100644 --- a/WebCore/platform/graphics/android/GradientAndroid.cpp +++ b/WebCore/platform/graphics/android/GradientAndroid.cpp @@ -38,7 +38,7 @@ class PlatformGradientRec { public: PlatformGradientRec() : m_shader(NULL) {} - ~PlatformGradientRec() { m_shader->safeUnref(); } + ~PlatformGradientRec() { SkSafeUnref(m_shader); } SkShader* m_shader; SkShader::TileMode m_tileMode; @@ -102,7 +102,7 @@ SkShader* Gradient::getShader(SkShader::TileMode mode) s = new SkColorShader(0); // zap our previous shader, if present - m_gradient->m_shader->safeUnref(); + SkSafeUnref(m_gradient->m_shader); m_gradient->m_shader = s; m_gradient->m_tileMode = mode; SkMatrix matrix = m_gradientSpaceTransformation; diff --git a/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp b/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp index 06a53b1..dce7b27 100644 --- a/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp +++ b/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp @@ -128,13 +128,13 @@ public: , useAA(other.useAA) { path = deepCopyPtr<SkPath>(other.path); - pathEffect->safeRef(); + SkSafeRef(pathEffect); } ~State() { delete path; - pathEffect->safeUnref(); + SkSafeUnref(pathEffect); } void setShadow(int radius, int dx, int dy, SkColor c) @@ -1043,7 +1043,7 @@ void GraphicsContext::setLineDash(const DashArray& dashes, float dashOffset) for (unsigned int i = 0; i < count; i++) intervals[i] = SkFloatToScalar(dashes[i % dashLength]); SkPathEffect **effectPtr = &m_data->getState()->pathEffect; - (*effectPtr)->safeUnref(); + SkSafeUnref(*effectPtr); *effectPtr = new SkDashPathEffect(intervals, count, SkFloatToScalar(dashOffset)); delete[] intervals; diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp index 66a62e1..f969999 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -101,7 +101,7 @@ LayerAndroid::LayerAndroid(const LayerAndroid& layer) : SkLayer(layer), { m_isFixed = layer.m_isFixed; m_contentsImage = layer.m_contentsImage; - m_contentsImage->safeRef(); + SkSafeRef(m_contentsImage); m_renderLayerPos = layer.m_renderLayerPos; m_transform = layer.m_transform; m_backgroundColor = layer.m_backgroundColor; @@ -195,8 +195,8 @@ LayerAndroid::~LayerAndroid() removeTexture(0); removeChildren(); delete m_extra; - m_contentsImage->safeUnref(); - m_recordingPicture->safeUnref(); + SkSafeUnref(m_contentsImage); + SkSafeUnref(m_recordingPicture); m_animations.clear(); #ifdef DEBUG_COUNT ClassTracker::instance()->decrement("LayerAndroid"); @@ -1055,11 +1055,11 @@ bool LayerAndroid::prepareContext(bool force) || (m_recordingPicture && ((m_recordingPicture->width() != (int) getSize().width()) || (m_recordingPicture->height() != (int) getSize().height())))) { - m_recordingPicture->safeUnref(); + SkSafeUnref(m_recordingPicture); m_recordingPicture = new SkPicture(); } } else if (m_recordingPicture) { - m_recordingPicture->safeUnref(); + SkSafeUnref(m_recordingPicture); m_recordingPicture = 0; } diff --git a/WebCore/platform/graphics/android/PatternAndroid.cpp b/WebCore/platform/graphics/android/PatternAndroid.cpp index 5a3fd8f..568036c 100644 --- a/WebCore/platform/graphics/android/PatternAndroid.cpp +++ b/WebCore/platform/graphics/android/PatternAndroid.cpp @@ -42,7 +42,7 @@ static SkShader::TileMode toTileMode(bool doRepeat) { void Pattern::platformDestroy() { - m_pattern->safeUnref(); + SkSafeUnref(m_pattern); m_pattern = 0; } |