summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-01 21:30:00 +0000
committerwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-01 21:30:00 +0000
commit2b09f53f4ff7ded78bebbe9d6c9a307489071284 (patch)
tree5fac9d2f388d011aba21af193c9bd40d80d85e47 /remoting
parentac8df2f385df0c623c91b73118be06e1a3f46e34 (diff)
downloadchromium_src-2b09f53f4ff7ded78bebbe9d6c9a307489071284.zip
chromium_src-2b09f53f4ff7ded78bebbe9d6c9a307489071284.tar.gz
chromium_src-2b09f53f4ff7ded78bebbe9d6c9a307489071284.tar.bz2
Convert cursors captured on Windows to premultiplied alpha.
BUG=137112 Review URL: https://chromiumcodereview.appspot.com/11336007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165504 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/host/video_frame_capturer_win.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/remoting/host/video_frame_capturer_win.cc b/remoting/host/video_frame_capturer_win.cc
index 2ca5080..23b8496 100644
--- a/remoting/host/video_frame_capturer_win.cc
+++ b/remoting/host/video_frame_capturer_win.cc
@@ -19,6 +19,7 @@
#include "remoting/host/win/desktop.h"
#include "remoting/host/win/scoped_thread_desktop.h"
#include "remoting/proto/control.pb.h"
+#include "third_party/skia/include/core/SkColorPriv.h"
namespace remoting {
@@ -463,15 +464,23 @@ void VideoFrameCapturerWin::CaptureCursor() {
return;
}
- // Cursor bitmap is stored upside-down on Windows. Flip the rows and store
- // it in the proto.
+ // Copy across colour cursor imagery.
+ // CursorShapeInfo stores imagery top-down, and premultiplied
+ // by the alpha channel, whereas windows stores them bottom-up
+ // and not premultiplied.
uint8* cursor_src_data = reinterpret_cast<uint8*>(bitmap.bmBits);
uint8* src = cursor_src_data + ((height - 1) * row_bytes);
uint8* dst = cursor_dst_data;
- for (int row = 0; row < height; row++) {
- memcpy(dst, src, row_bytes);
- dst += width * kBytesPerPixel;
- src -= row_bytes;
+ for (int row = 0; row < height; ++row) {
+ for (int column = 0; column < width; ++column) {
+ dst[0] = SkAlphaMul(src[0], src[3]);
+ dst[1] = SkAlphaMul(src[1], src[3]);
+ dst[2] = SkAlphaMul(src[2], src[3]);
+ dst[3] = src[3];
+ dst += kBytesPerPixel;
+ src += kBytesPerPixel;
+ }
+ src -= row_bytes + (width * kBytesPerPixel);
}
} else {
if (bitmap.bmPlanes != 1 || bitmap.bmBitsPixel != 1) {