| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef REMOTING_HOST_DIFFER_H_ | 5 #ifndef REMOTING_HOST_DIFFER_H_ |
| 6 #define REMOTING_HOST_DIFFER_H_ | 6 #define REMOTING_HOST_DIFFER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 12 #include "gfx/rect.h" | 12 #include "gfx/rect.h" |
| 13 #include "remoting/base/types.h" | 13 #include "remoting/base/types.h" |
| 14 | 14 |
| 15 namespace remoting { | 15 namespace remoting { |
| 16 | 16 |
| 17 typedef uint8 DiffInfo; | 17 typedef uint8 DiffInfo; |
| 18 | 18 |
| 19 // Size (in pixels) of each square block used for diffing. | 19 // Size (in pixels) of each square block used for diffing. |
| 20 // This must be a multiple of sizeof(uint64). | 20 // This must be a multiple of sizeof(uint64). |
| 21 static const int kBlockSize = 32; | 21 static const int kBlockSize = 32; |
| 22 | 22 |
| 23 class Differ { | 23 class Differ { |
| 24 public: | 24 public: |
| 25 // Create a differ that operates on bitmaps with the specified width, height | 25 // Create a differ that operates on bitmaps with the specified width, height |
| 26 // and bytes_per_pixel. | 26 // and bytes_per_pixel. |
| 27 Differ(int width, int height, int bytes_per_pixel, int stride); | 27 Differ(int width, int height, int bytes_per_pixel, int stride); |
| 28 ~Differ(); |
| 28 | 29 |
| 29 // Given the previous and current screen buffer, calculate the set of | 30 // Given the previous and current screen buffer, calculate the set of |
| 30 // rectangles that enclose all the changed pixels in the new screen. | 31 // rectangles that enclose all the changed pixels in the new screen. |
| 31 void CalcDirtyRects(const void* prev_buffer, const void* curr_buffer, | 32 void CalcDirtyRects(const void* prev_buffer, const void* curr_buffer, |
| 32 InvalidRects* rects); | 33 InvalidRects* rects); |
| 33 | 34 |
| 34 // Identify all of the blocks that contain changed pixels. | 35 // Identify all of the blocks that contain changed pixels. |
| 35 void MarkDirtyBlocks(const void* prev_buffer, const void* curr_buffer); | 36 void MarkDirtyBlocks(const void* prev_buffer, const void* curr_buffer); |
| 36 | 37 |
| 37 // Diff a small block of image and return non-zero if there is a diff. | 38 // Diff a small block of image and return non-zero if there is a diff. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 int diff_info_width_; | 79 int diff_info_width_; |
| 79 int diff_info_height_; | 80 int diff_info_height_; |
| 80 int diff_info_size_; | 81 int diff_info_size_; |
| 81 | 82 |
| 82 DISALLOW_COPY_AND_ASSIGN(Differ); | 83 DISALLOW_COPY_AND_ASSIGN(Differ); |
| 83 }; | 84 }; |
| 84 | 85 |
| 85 } // namespace remoting | 86 } // namespace remoting |
| 86 | 87 |
| 87 #endif // REMOTING_HOST_DIFFER_H_ | 88 #endif // REMOTING_HOST_DIFFER_H_ |
| OLD | NEW |