Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(655)

Unified Diff: remoting/client/plugin/empty_cursor_filter.cc

Issue 1228333004: Move code that doesn't depend on PPAPI out of remoting/client/plugin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/client/plugin/empty_cursor_filter.cc
diff --git a/remoting/client/plugin/empty_cursor_filter.cc b/remoting/client/plugin/empty_cursor_filter.cc
deleted file mode 100644
index 15180fa007ba28a6f67ad297aeeb0b055449f1e0..0000000000000000000000000000000000000000
--- a/remoting/client/plugin/empty_cursor_filter.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "remoting/client/plugin/empty_cursor_filter.h"
-
-#include <algorithm>
-
-#include "remoting/proto/control.pb.h"
-
-namespace remoting {
-
-protocol::CursorShapeInfo EmptyCursorShape() {
- protocol::CursorShapeInfo empty_shape;
- empty_shape.set_data(std::string());
- empty_shape.set_width(0);
- empty_shape.set_height(0);
- empty_shape.set_hotspot_x(0);
- empty_shape.set_hotspot_y(0);
- return empty_shape;
-}
-
-bool IsCursorShapeEmpty(const protocol::CursorShapeInfo& cursor_shape) {
- return cursor_shape.width() <= 0 || cursor_shape.height() <= 0;
-}
-
-EmptyCursorFilter::EmptyCursorFilter(protocol::CursorShapeStub* cursor_stub)
- : cursor_stub_(cursor_stub) {
-}
-
-EmptyCursorFilter::~EmptyCursorFilter() {}
-
-namespace {
-
-#if defined(ARCH_CPU_LITTLE_ENDIAN)
-const uint32_t kPixelAlphaMask = 0xff000000;
-#else // !defined(ARCH_CPU_LITTLE_ENDIAN)
-const uint32_t kPixelAlphaMask = 0x000000ff;
-#endif // !defined(ARCH_CPU_LITTLE_ENDIAN)
-
-// Returns true if |pixel| is not completely transparent.
-bool IsVisiblePixel(uint32_t pixel) {
- return (pixel & kPixelAlphaMask) != 0;
-}
-
-// Returns true if there is at least one visible pixel in the given range.
-bool IsVisibleRow(const uint32_t* begin, const uint32_t* end) {
- return std::find_if(begin, end, &IsVisiblePixel) != end;
-}
-
-} // namespace
-
-void EmptyCursorFilter::SetCursorShape(
- const protocol::CursorShapeInfo& cursor_shape) {
- const uint32_t* src_row_data = reinterpret_cast<const uint32_t*>(
- cursor_shape.data().data());
- const uint32_t* src_row_data_end =
- src_row_data + cursor_shape.width() * cursor_shape.height();
- if (IsVisibleRow(src_row_data, src_row_data_end)) {
- cursor_stub_->SetCursorShape(cursor_shape);
- return;
- }
- cursor_stub_->SetCursorShape(EmptyCursorShape());
-}
-
-} // namespace remoting
« no previous file with comments | « remoting/client/plugin/empty_cursor_filter.h ('k') | remoting/client/plugin/empty_cursor_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698