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

Side by Side Diff: remoting/host/differ.h

Issue 7622002: Revert 96327 - Switch over to using SkRegions to calculate dirty areas. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/capturer_win.cc ('k') | remoting/host/differ.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "third_party/skia/include/core/SkRegion.h" 12 #include "remoting/base/types.h"
13 #include "ui/gfx/rect.h"
13 14
14 namespace remoting { 15 namespace remoting {
15 16
16 typedef uint8 DiffInfo; 17 typedef uint8 DiffInfo;
17 18
18 // TODO: Simplify differ now that we are working with SkRegions.
19 // diff_info_ should no longer be needed, as we can put our data directly into
20 // the region that we are calculating.
21 // http://crbug.com/92379
22 class Differ { 19 class Differ {
23 public: 20 public:
24 // Create a differ that operates on bitmaps with the specified width, height 21 // Create a differ that operates on bitmaps with the specified width, height
25 // and bytes_per_pixel. 22 // and bytes_per_pixel.
26 Differ(int width, int height, int bytes_per_pixel, int stride); 23 Differ(int width, int height, int bytes_per_pixel, int stride);
27 ~Differ(); 24 ~Differ();
28 25
29 int width() { return width_; } 26 int width() { return width_; }
30 int height() { return height_; } 27 int height() { return height_; }
31 int bytes_per_pixel() { return bytes_per_pixel_; } 28 int bytes_per_pixel() { return bytes_per_pixel_; }
32 int bytes_per_row() { return bytes_per_row_; } 29 int bytes_per_row() { return bytes_per_row_; }
33 30
34 // Given the previous and current screen buffer, calculate the dirty region 31 // Given the previous and current screen buffer, calculate the set of
35 // that encloses all of the changed pixels in the new screen. 32 // rectangles that enclose all the changed pixels in the new screen.
36 void CalcDirtyRegion(const void* prev_buffer, const void* curr_buffer, 33 void CalcDirtyRects(const void* prev_buffer, const void* curr_buffer,
37 SkRegion* region); 34 InvalidRects* rects);
38
39 private:
40 // Allow tests to access our private parts.
41 friend class DifferTest;
42 35
43 // Identify all of the blocks that contain changed pixels. 36 // Identify all of the blocks that contain changed pixels.
44 void MarkDirtyBlocks(const void* prev_buffer, const void* curr_buffer); 37 void MarkDirtyBlocks(const void* prev_buffer, const void* curr_buffer);
45 38
46 // After the dirty blocks have been identified, this routine merges adjacent 39 // After the dirty blocks have been identified, this routine merges adjacent
47 // blocks into a region. 40 // blocks into larger rectangular units.
48 // The goal is to minimize the region that covers the dirty blocks. 41 // The goal is to minimize the number of rects that cover the dirty blocks,
49 void MergeBlocks(SkRegion* region); 42 // although it is not required to calc the absolute minimum of rects.
43 void MergeBlocks(InvalidRects* rects);
44
45 // Allow tests to access our private parts.
46 friend class DifferTest;
47
48 private:
50 49
51 // Check for diffs in upper-left portion of the block. The size of the portion 50 // Check for diffs in upper-left portion of the block. The size of the portion
52 // to check is specified by the |width| and |height| values. 51 // to check is specified by the |width| and |height| values.
53 // Note that if we force the capturer to always return images whose width and 52 // Note that if we force the capturer to always return images whose width and
54 // height are multiples of kBlockSize, then this will never be called. 53 // height are multiples of kBlockSize, then this will never be called.
55 DiffInfo DiffPartialBlock(const uint8* prev_buffer, const uint8* curr_buffer, 54 DiffInfo DiffPartialBlock(const uint8* prev_buffer, const uint8* curr_buffer,
56 int stride, int width, int height); 55 int stride, int width, int height);
57 56
58 // Dimensions of screen. 57 // Dimensions of screen.
59 int width_; 58 int width_;
(...skipping 13 matching lines...) Expand all
73 int diff_info_width_; 72 int diff_info_width_;
74 int diff_info_height_; 73 int diff_info_height_;
75 int diff_info_size_; 74 int diff_info_size_;
76 75
77 DISALLOW_COPY_AND_ASSIGN(Differ); 76 DISALLOW_COPY_AND_ASSIGN(Differ);
78 }; 77 };
79 78
80 } // namespace remoting 79 } // namespace remoting
81 80
82 #endif // REMOTING_HOST_DIFFER_H_ 81 #endif // REMOTING_HOST_DIFFER_H_
OLDNEW
« no previous file with comments | « remoting/host/capturer_win.cc ('k') | remoting/host/differ.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698