Introduction to plug-in rendering modes of Android browsers

Source: Internet
Author: User

The browser plug-in of Android2.1 has two rendering modes. The definitions in android_npapi.h are as follows:
KBitmap_ANPDrawingModel = 0;
KSurface_ANPDrawingModel = 1;
(Bitmap mode and surface mode ).
During instance initialization (when newp of the Plugin function list is called), Plug-in needs to inform the browser of the rendering method.
 
The following describes the two rendering methods:
 
1. bitmap mode

 
KBitmap_ANPDrawingMode is a traditional rendering method. in this mode, the bottom layer of the browser calls the NPP_HandleEvent function provided by Plug-in to trigger the rendering event, and pass the bitmap address to be rendered as part of the parameter to plug-in. plug-in only needs to be drawn using the related ANPInterface obtained during initialization. In this mode, plug-in does not need to consider the scaling problem, and the screen scaling will be handled by webkit.
 
// ============================================
 
2. surface mode
 

 
KSurface_ANPDrawingMode has the special features of the Android platform, because this mode requires Java-side cooperation. In this mode, Plug-in will inform webkit of its PluginStub class name during initialization. webkit will, based on this class name, combine the npp parameter, obtain the corresponding view on the Java side and add it to the layout. To use this mode, plug-in must implement a class inherited from PluginStub, which is similar to SurfaceView and must be scaled by itself.
 
According to the description in android_npapi.h, the performance of the Surface mode is better than that of the bitmap mode, but I found that the surface mode will flash during scaling on the simulator. However, flash10.1 on nexus one of android2.2 seems to be in the surface mode, but it does not Flash. In order to support Flash, google has made many modifications to webkit on Android versions recently.
 
Link

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.