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

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

Issue 11470028: Move screen capturers to remoting/capturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef REMOTING_HOST_DIFFER_H_
6 #define REMOTING_HOST_DIFFER_H_
7
8 #include <vector>
9
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "third_party/skia/include/core/SkRegion.h"
13
14 namespace remoting {
15
16 typedef uint8 DiffInfo;
17
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 {
23 public:
24 // Create a differ that operates on bitmaps with the specified width, height
25 // and bytes_per_pixel.
26 Differ(int width, int height, int bytes_per_pixel, int stride);
27 ~Differ();
28
29 int width() { return width_; }
30 int height() { return height_; }
31 int bytes_per_pixel() { return bytes_per_pixel_; }
32 int bytes_per_row() { return bytes_per_row_; }
33
34 // Given the previous and current screen buffer, calculate the dirty region
35 // that encloses all of the changed pixels in the new screen.
36 void CalcDirtyRegion(const void* prev_buffer, const void* curr_buffer,
37 SkRegion* region);
38
39 private:
40 // Allow tests to access our private parts.
41 friend class DifferTest;
42
43 // Identify all of the blocks that contain changed pixels.
44 void MarkDirtyBlocks(const void* prev_buffer, const void* curr_buffer);
45
46 // After the dirty blocks have been identified, this routine merges adjacent
47 // blocks into a region.
48 // The goal is to minimize the region that covers the dirty blocks.
49 void MergeBlocks(SkRegion* region);
50
51 // 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.
53 // 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.
55 DiffInfo DiffPartialBlock(const uint8* prev_buffer, const uint8* curr_buffer,
56 int stride, int width, int height);
57
58 // Dimensions of screen.
59 int width_;
60 int height_;
61
62 // Number of bytes for each pixel in source and dest bitmap.
63 // (Yes, they must match.)
64 int bytes_per_pixel_;
65
66 // Number of bytes in each row of the image (AKA: stride).
67 int bytes_per_row_;
68
69 // Diff information for each block in the image.
70 scoped_array<DiffInfo> diff_info_;
71
72 // Dimensions and total size of diff info array.
73 int diff_info_width_;
74 int diff_info_height_;
75 int diff_info_size_;
76
77 DISALLOW_COPY_AND_ASSIGN(Differ);
78 };
79
80 } // namespace remoting
81
82 #endif // REMOTING_HOST_DIFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698