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

Unified Diff: remoting/codec/video_decoder_verbatim.cc

Issue 23440046: Remove dependency on Skia from chromoting client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/codec/video_decoder_verbatim.h ('k') | remoting/codec/video_decoder_vp8.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/codec/video_decoder_verbatim.cc
diff --git a/remoting/codec/video_decoder_verbatim.cc b/remoting/codec/video_decoder_verbatim.cc
index 0431dc294117b20135c77565afeee1c580f37c27..05af0ceeaba2825a2ad47b285dd872f134ed0324 100644
--- a/remoting/codec/video_decoder_verbatim.cc
+++ b/remoting/codec/video_decoder_verbatim.cc
@@ -9,18 +9,17 @@
namespace remoting {
-VideoDecoderVerbatim::VideoDecoderVerbatim()
- : screen_size_(SkISize::Make(0, 0)) {}
+VideoDecoderVerbatim::VideoDecoderVerbatim() {}
VideoDecoderVerbatim::~VideoDecoderVerbatim() {}
-void VideoDecoderVerbatim::Initialize(const SkISize& screen_size) {
- updated_region_.setEmpty();
+void VideoDecoderVerbatim::Initialize(const webrtc::DesktopSize& screen_size) {
+ updated_region_.Clear();
screen_buffer_.reset();
screen_size_ = screen_size;
// Allocate the screen buffer, if necessary.
- if (!screen_size_.isEmpty()) {
+ if (!screen_size_.is_empty()) {
screen_buffer_.reset(
new uint8[screen_size_.width() * screen_size_.height() *
kBytesPerPixel]);
@@ -28,27 +27,28 @@ void VideoDecoderVerbatim::Initialize(const SkISize& screen_size) {
}
bool VideoDecoderVerbatim::DecodePacket(const VideoPacket& packet) {
- SkRegion region;
+ webrtc::DesktopRegion region;
const char* in = packet.data().data();
int stride = kBytesPerPixel * screen_size_.width();
for (int i = 0; i < packet.dirty_rects_size(); ++i) {
Rect proto_rect = packet.dirty_rects(i);
- SkIRect rect = SkIRect::MakeXYWH(proto_rect.x(),
- proto_rect.y(),
- proto_rect.width(),
- proto_rect.height());
- region.op(rect, SkRegion::kUnion_Op);
-
- if (!SkIRect::MakeSize(screen_size_).contains(rect)) {
+ webrtc::DesktopRect rect =
+ webrtc::DesktopRect::MakeXYWH(proto_rect.x(),
+ proto_rect.y(),
+ proto_rect.width(),
+ proto_rect.height());
+ region.AddRect(rect);
+
+ if (!DoesRectContain(webrtc::DesktopRect::MakeSize(screen_size_), rect)) {
LOG(ERROR) << "Invalid packet received";
return false;
}
int rect_row_size = kBytesPerPixel * rect.width();
- uint8_t* out = screen_buffer_.get() + rect.y() * stride +
- rect.x() * kBytesPerPixel;
- for (int y = rect.y(); y < rect.y() + rect.height(); ++y) {
+ uint8_t* out = screen_buffer_.get() + rect.top() * stride +
+ rect.left() * kBytesPerPixel;
+ for (int y = rect.top(); y < rect.top() + rect.height(); ++y) {
if (in + rect_row_size > packet.data().data() + packet.data().size()) {
LOG(ERROR) << "Invalid packet received";
return false;
@@ -64,33 +64,36 @@ bool VideoDecoderVerbatim::DecodePacket(const VideoPacket& packet) {
return false;
}
- updated_region_.op(region, SkRegion::kUnion_Op);
+ updated_region_.AddRegion(region);
return true;
}
-void VideoDecoderVerbatim::Invalidate(const SkISize& view_size,
- const SkRegion& region) {
- updated_region_.op(region, SkRegion::kUnion_Op);
+void VideoDecoderVerbatim::Invalidate(const webrtc::DesktopSize& view_size,
+ const webrtc::DesktopRegion& region) {
+ updated_region_.AddRegion(region);
}
-void VideoDecoderVerbatim::RenderFrame(const SkISize& view_size,
- const SkIRect& clip_area,
+void VideoDecoderVerbatim::RenderFrame(const webrtc::DesktopSize& view_size,
+ const webrtc::DesktopRect& clip_area,
uint8* image_buffer,
int image_stride,
- SkRegion* output_region) {
- output_region->setEmpty();
+ webrtc::DesktopRegion* output_region) {
+ output_region->Clear();
// TODO(alexeypa): scaling is not implemented.
- SkIRect clip_rect = SkIRect::MakeSize(screen_size_);
- if (!clip_rect.intersect(clip_area))
+ webrtc::DesktopRect clip_rect = webrtc::DesktopRect::MakeSize(screen_size_);
+ clip_rect.IntersectWith(clip_area);
+ if (clip_rect.is_empty())
return;
int screen_stride = screen_size_.width() * kBytesPerPixel;
- for (SkRegion::Iterator i(updated_region_); !i.done(); i.next()) {
- SkIRect rect(i.rect());
- if (!rect.intersect(clip_rect))
+ for (webrtc::DesktopRegion::Iterator i(updated_region_);
+ !i.IsAtEnd(); i.Advance()) {
+ webrtc::DesktopRect rect(i.rect());
+ rect.IntersectWith(clip_rect);
+ if (rect.is_empty())
continue;
CopyRGB32Rect(screen_buffer_.get(), screen_stride,
@@ -98,13 +101,13 @@ void VideoDecoderVerbatim::RenderFrame(const SkISize& view_size,
image_buffer, image_stride,
clip_area,
rect);
- output_region->op(rect, SkRegion::kUnion_Op);
+ output_region->AddRect(rect);
}
- updated_region_.setEmpty();
+ updated_region_.Clear();
}
-const SkRegion* VideoDecoderVerbatim::GetImageShape() {
+const webrtc::DesktopRegion* VideoDecoderVerbatim::GetImageShape() {
return NULL;
}
« no previous file with comments | « remoting/codec/video_decoder_verbatim.h ('k') | remoting/codec/video_decoder_vp8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698