Merge revision 643 and revision 648 changes:

- Improve the cefclient transparency test by adding the ability to view individual pixel values (issue #584).
- Change cefclient off-screen rendering example to account for premultiplied alpha values (issue #584).

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1025@649 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-05-25 14:33:01 +00:00
parent 2bd2007fb9
commit 0bccf1bff2
5 changed files with 86 additions and 11 deletions

View File

@ -466,6 +466,22 @@ LRESULT CALLBACK PluginWndProc(HWND hWnd, UINT message, WPARAM wParam,
lastMousePos.x = curMousePos.x = LOWORD(lParam);
lastMousePos.y = curMousePos.y = HIWORD(lParam);
mouseRotation = true;
} else if (wParam & MK_CONTROL) {
// Retrieve the pixel value.
int x = LOWORD(lParam);
int y = HIWORD(lParam);
unsigned char r, g, b, a;
if (plugin->renderer.GetPixelValue(x, y, r, g, b, a)) {
std::stringstream ss;
ss << x << "," << y << " = R:" << static_cast<int>(r) << " G:" <<
static_cast<int>(g) << " B:" << static_cast<int>(b);
if (plugin->renderer.IsTransparent())
ss << " A:" << static_cast<int>(a);
std::string js =
"document.getElementById('pixel').innerText = '" + ss.str() + "';";
AppGetBrowser()->GetMainFrame()->ExecuteJavaScript(js, "", 0);
}
} else {
if (g_offscreenBrowser.get()) {
g_offscreenBrowser->SendMouseClickEvent(LOWORD(lParam), HIWORD(lParam),