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

Unified Diff: webrtc/modules/desktop_capture/desktop_frame_rotator.h

Issue 2500883004: Add DesktopFrame rotation functions (Closed)
Patch Set: Resolve review comments Created 4 years, 1 month 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: webrtc/modules/desktop_capture/desktop_frame_rotator.h
diff --git a/webrtc/modules/desktop_capture/desktop_frame_rotator.h b/webrtc/modules/desktop_capture/desktop_frame_rotator.h
new file mode 100644
index 0000000000000000000000000000000000000000..915e273cdbbb22c02ff1e72b7205041f217ac445
--- /dev/null
+++ b/webrtc/modules/desktop_capture/desktop_frame_rotator.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_ROTATOR_H_
Sergey Ulanov 2016/11/17 02:07:39 suggest renaming it to "desktop_frame_rotation.h"
Hzj_jie 2016/11/17 07:14:55 Done.
+#define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_ROTATOR_H_
+
+#include "webrtc/modules/desktop_capture/desktop_frame.h"
+#include "webrtc/modules/desktop_capture/desktop_geometry.h"
+
+namespace webrtc {
+
+// Represents the rotation of a DesktopFrame.
+enum class Rotation {
+ CLOCK_WISE_0,
+ CLOCK_WISE_90,
+ CLOCK_WISE_180,
+ CLOCK_WISE_270,
+};
+
+// Rotates input DesktopFrame |source|, copies pixel in a rotated rectangle
+// |rect| into another DesktopFrame |target|, and adds |rect| into
+// |target|->mutable_updated_region().
+// |rotation| specifies |source| to |target| rotation. |rect| is in |target|
+// coordinate.
Sergey Ulanov 2016/11/17 02:07:39 I think it would be cleaner, easier to understand
Hzj_jie 2016/11/17 07:14:55 If the |rect| is in source coordinate, but indeed
Sergey Ulanov 2016/11/19 02:11:40 I don't think you really need to DerotateRect(). J
Hzj_jie 2016/11/19 05:10:59 Done. But I still do not think exporting RotateRe
+// This function triggers check failure if |target| is null, returns false if
+// |target| does not cover the |rect|.
+bool CopyRotatedRectTo(const DesktopFrame& source,
Sergey Ulanov 2016/11/17 02:07:39 Maybe call it RotateDesktopFrame()?
Hzj_jie 2016/11/17 07:14:55 Done.
+ DesktopRect rect,
+ Rotation rotation,
+ DesktopFrame* target);
+
+// Rotates input DesktopFrame |source|, copies pixel in a unrotated rectangle
+// |rect| into another DesktopFrame |target|, and adds rotated |rect| into
+// |target|->mutable_updated_region().
+// |rotation| specifies |source| to |target| rotation. |rect| is in |source|
+// coordinate.
+// This function triggers check failure if |target| is null, returns false if
Sergey Ulanov 2016/11/17 02:07:39 Don't need to mention target==null here. It's obvi
Hzj_jie 2016/11/17 07:14:55 Done.
+// |target| does not cover the |rect|.
+bool CopyUnrotatedRectTo(const DesktopFrame& source,
Sergey Ulanov 2016/11/17 02:07:39 The reason I suggested to expose RotateRect() func
Hzj_jie 2016/11/17 07:14:55 IMO, these two functions are more like RotateAndCo
+ DesktopRect rect,
+ Rotation rotation,
+ DesktopFrame* target);
+
+} // namespace webrtc
+
+#endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_ROTATOR_H_

Powered by Google App Engine
This is Rietveld 408576698