summaryrefslogtreecommitdiffstats
path: root/samples/BrowserPlugin
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2011-10-03 14:43:56 -0700
committerChris Craik <ccraik@google.com>2011-10-03 14:51:50 -0700
commit771310eb994282bf677b079dd47b3f260721a093 (patch)
tree30d76a36e72eddb8715361ef33a3a2e281cd6427 /samples/BrowserPlugin
parentf82ab455aaf208403e836b14eaf480133f5345d8 (diff)
downloadandroid_development-771310eb994282bf677b079dd47b3f260721a093.tar.gz
android_development-771310eb994282bf677b079dd47b3f260721a093.tar.bz2
android_development-771310eb994282bf677b079dd47b3f260721a093.zip
Disable plugin content copy when 0x0 pixels
bug:5382635 Change-Id: I83f999d9e2dd0dc51a6c2f780f2f2b7add95a60a
Diffstat (limited to 'samples/BrowserPlugin')
-rw-r--r--samples/BrowserPlugin/jni/RenderingThread.cpp7
-rw-r--r--samples/BrowserPlugin/jni/animation/AnimationThread.cpp7
-rw-r--r--samples/BrowserPlugin/jni/animation/AnimationThread.h3
3 files changed, 8 insertions, 9 deletions
diff --git a/samples/BrowserPlugin/jni/RenderingThread.cpp b/samples/BrowserPlugin/jni/RenderingThread.cpp
index 91ffb4a01..1307e9097 100644
--- a/samples/BrowserPlugin/jni/RenderingThread.cpp
+++ b/samples/BrowserPlugin/jni/RenderingThread.cpp
@@ -43,9 +43,14 @@ RenderingThread::RenderingThread(NPP npp) : android::Thread() {
}
android::status_t RenderingThread::readyToRun() {
+ gLogI.log(kError_ANPLogType, "thread %p acquiring native window...", this);
while (m_ANW == NULL) {
m_ANW = gNativeWindowI.acquireNativeWindow(m_npp);
+ if (!m_ANW)
+ gLogI.log(kError_ANPLogType, "thread %p acquire native window FAILED!", this);
+
}
+ gLogI.log(kError_ANPLogType, "thread %p acquired native window successfully!", this);
#if (!USE_SOFTWARE_RENDERING)
m_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
@@ -165,6 +170,8 @@ void RenderingThread::updateNativeWindow(ANativeWindow* ANW,
const SkBitmap& bitmap)
{
#if USE_SOFTWARE_RENDERING
+ if (bitmap.height() == 0 || bitmap.width() == 0)
+ return;
//STEP 1: lock the ANW, getting a buffer
ANativeWindow_Buffer buffer;
diff --git a/samples/BrowserPlugin/jni/animation/AnimationThread.cpp b/samples/BrowserPlugin/jni/animation/AnimationThread.cpp
index 1388fe374..2729a532f 100644
--- a/samples/BrowserPlugin/jni/animation/AnimationThread.cpp
+++ b/samples/BrowserPlugin/jni/animation/AnimationThread.cpp
@@ -45,7 +45,7 @@ AnimationThread::AnimationThread(NPP npp) : RenderingThread(npp) {
m_paint = new SkPaint;
m_paint->setAntiAlias(true);
- m_bitmap = constructBitmap(DEFAULT_WIDTH, DEFAULT_HEIGHT);
+ m_bitmap = constructBitmap(0, 0);
m_canvas = new SkCanvas(*m_bitmap);
m_startExecutionTime = 0;
@@ -95,11 +95,6 @@ bool AnimationThread::threadLoop() {
int width, height;
getDimensions(width, height);
- if (width <= 0)
- width = DEFAULT_WIDTH;
- if (height <= 0)
- height = DEFAULT_HEIGHT;
-
if (m_bitmap->width() != width || m_bitmap->height() != height) {
delete m_canvas;
delete m_bitmap;
diff --git a/samples/BrowserPlugin/jni/animation/AnimationThread.h b/samples/BrowserPlugin/jni/animation/AnimationThread.h
index e95ecceff..8222a7ee2 100644
--- a/samples/BrowserPlugin/jni/animation/AnimationThread.h
+++ b/samples/BrowserPlugin/jni/animation/AnimationThread.h
@@ -59,9 +59,6 @@ private:
SkPaint* m_paint;
SkBitmap* m_bitmap;
SkCanvas* m_canvas;
-
- static const unsigned int DEFAULT_WIDTH = 400;
- static const unsigned int DEFAULT_HEIGHT = 400;
};