OLD | NEW |
1 // Copyright (c) 2012 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 #include "remoting/base/decoder_row_based.h" | 5 #include "remoting/base/decoder_row_based.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "remoting/base/decompressor.h" | 8 #include "remoting/base/decompressor.h" |
9 #include "remoting/base/decompressor_zlib.h" | 9 #include "remoting/base/decompressor_zlib.h" |
10 #include "remoting/base/decompressor_verbatim.h" | 10 #include "remoting/base/decompressor_verbatim.h" |
11 #include "remoting/base/util.h" | 11 #include "remoting/base/util.h" |
(...skipping 25 matching lines...) Expand all Loading... |
37 row_y_(0) { | 37 row_y_(0) { |
38 } | 38 } |
39 | 39 |
40 DecoderRowBased::~DecoderRowBased() { | 40 DecoderRowBased::~DecoderRowBased() { |
41 } | 41 } |
42 | 42 |
43 void DecoderRowBased::Reset() { | 43 void DecoderRowBased::Reset() { |
44 frame_ = NULL; | 44 frame_ = NULL; |
45 decompressor_->Reset(); | 45 decompressor_->Reset(); |
46 state_ = kUninitialized; | 46 state_ = kUninitialized; |
47 updated_region_.setEmpty(); | 47 updated_rects_.clear(); |
48 } | 48 } |
49 | 49 |
50 bool DecoderRowBased::IsReadyForData() { | 50 bool DecoderRowBased::IsReadyForData() { |
51 switch (state_) { | 51 switch (state_) { |
52 case kUninitialized: | 52 case kUninitialized: |
53 case kError: | 53 case kError: |
54 return false; | 54 return false; |
55 case kReady: | 55 case kReady: |
56 case kProcessing: | 56 case kProcessing: |
57 case kPartitionDone: | 57 case kPartitionDone: |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 } | 121 } |
122 } | 122 } |
123 | 123 |
124 if (state_ == kPartitionDone || state_ == kDone) { | 124 if (state_ == kPartitionDone || state_ == kDone) { |
125 if (row_y_ < clip_.height()) { | 125 if (row_y_ < clip_.height()) { |
126 state_ = kError; | 126 state_ = kError; |
127 LOG(WARNING) << "Received LAST_PACKET, but didn't get enough data."; | 127 LOG(WARNING) << "Received LAST_PACKET, but didn't get enough data."; |
128 return DECODE_ERROR; | 128 return DECODE_ERROR; |
129 } | 129 } |
130 | 130 |
131 updated_region_.op(clip_, SkRegion::kUnion_Op); | 131 updated_rects_.push_back(clip_); |
132 decompressor_->Reset(); | 132 decompressor_->Reset(); |
133 } | 133 } |
134 | 134 |
135 if (state_ == kDone) { | 135 if (state_ == kDone) { |
136 return DECODE_DONE; | 136 return DECODE_DONE; |
137 } else { | 137 } else { |
138 return DECODE_IN_PROGRESS; | 138 return DECODE_IN_PROGRESS; |
139 } | 139 } |
140 } | 140 } |
141 | 141 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 state_ = kError; | 179 state_ = kError; |
180 LOG(WARNING) << "Received unexpected LAST_PARTITION."; | 180 LOG(WARNING) << "Received unexpected LAST_PARTITION."; |
181 return; | 181 return; |
182 } | 182 } |
183 state_ = kDone; | 183 state_ = kDone; |
184 } | 184 } |
185 | 185 |
186 return; | 186 return; |
187 } | 187 } |
188 | 188 |
189 void DecoderRowBased::GetUpdatedRegion(SkRegion* region) { | 189 void DecoderRowBased::GetUpdatedRects(RectVector* rects) { |
190 region->swap(updated_region_); | 190 rects->swap(updated_rects_); |
191 updated_region_.setEmpty(); | 191 updated_rects_.clear(); |
192 } | 192 } |
193 | 193 |
194 VideoPacketFormat::Encoding DecoderRowBased::Encoding() { | 194 VideoPacketFormat::Encoding DecoderRowBased::Encoding() { |
195 return encoding_; | 195 return encoding_; |
196 } | 196 } |
197 | 197 |
198 } // namespace remoting | 198 } // namespace remoting |
OLD | NEW |