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

Unified Diff: remoting/base/decoder_vp8.cc

Issue 7992011: Move us fully from gfx:: over to skia types for consistency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for bad DEPS Created 9 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/base/decoder_vp8.h ('k') | remoting/base/encoder_row_based.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/base/decoder_vp8.cc
diff --git a/remoting/base/decoder_vp8.cc b/remoting/base/decoder_vp8.cc
index 234fc079799e2735f0e70e08d204dc55b4a2e599..4befd6944ed543aeea1a00aa657a39ae0551b2d9 100644
--- a/remoting/base/decoder_vp8.cc
+++ b/remoting/base/decoder_vp8.cc
@@ -89,13 +89,14 @@ Decoder::DecodeResult DecoderVp8::DecodePacket(const VideoPacket* packet) {
}
last_image_ = image;
- std::vector<gfx::Rect> rects;
+ RectVector rects;
+ rects.reserve(packet->dirty_rects_size());
for (int i = 0; i < packet->dirty_rects_size(); ++i) {
- gfx::Rect r = gfx::Rect(packet->dirty_rects(i).x(),
- packet->dirty_rects(i).y(),
- packet->dirty_rects(i).width(),
- packet->dirty_rects(i).height());
- rects.push_back(r);
+ Rect remoting_rect = packet->dirty_rects(i);
+ rects.push_back(SkIRect::MakeXYWH(remoting_rect.x(),
+ remoting_rect.y(),
+ remoting_rect.width(),
+ remoting_rect.height()));
}
if (!DoScaling())
@@ -105,7 +106,7 @@ Decoder::DecodeResult DecoderVp8::DecodePacket(const VideoPacket* packet) {
return DECODE_DONE;
}
-void DecoderVp8::GetUpdatedRects(UpdatedRects* rects) {
+void DecoderVp8::GetUpdatedRects(RectVector* rects) {
rects->swap(updated_rects_);
}
@@ -136,11 +137,11 @@ void DecoderVp8::SetScaleRatios(double horizontal_ratio,
vertical_scale_ratio_ = vertical_ratio;
}
-void DecoderVp8::SetClipRect(const gfx::Rect& clip_rect) {
+void DecoderVp8::SetClipRect(const SkIRect& clip_rect) {
clip_rect_ = clip_rect;
}
-void DecoderVp8::RefreshRects(const std::vector<gfx::Rect>& rects) {
+void DecoderVp8::RefreshRects(const RectVector& rects) {
if (!DoScaling())
ConvertRects(rects, &updated_rects_);
else
@@ -151,8 +152,8 @@ bool DecoderVp8::DoScaling() const {
return horizontal_scale_ratio_ != 1.0 || vertical_scale_ratio_ != 1.0;
}
-void DecoderVp8::ConvertRects(const UpdatedRects& rects,
- UpdatedRects* output_rects) {
+void DecoderVp8::ConvertRects(const RectVector& rects,
+ RectVector* output_rects) {
if (!last_image_)
return;
@@ -160,24 +161,24 @@ void DecoderVp8::ConvertRects(const UpdatedRects& rects,
const int stride = frame_->stride(media::VideoFrame::kRGBPlane);
output_rects->clear();
+ output_rects->reserve(rects.size());
for (size_t i = 0; i < rects.size(); ++i) {
+ // Clip by the clipping rectangle first.
+ SkIRect dest_rect = rects[i];
+ if (!dest_rect.intersect(clip_rect_))
+ continue;
+
// Round down the image width and height.
int image_width = RoundToTwosMultiple(last_image_->d_w);
int image_height = RoundToTwosMultiple(last_image_->d_h);
- // Clip by the clipping rectangle first.
- gfx::Rect dest_rect = rects[i].Intersect(clip_rect_);
-
// Then clip by the rounded down dimension of the image for safety.
- dest_rect = dest_rect.Intersect(
- gfx::Rect(0, 0, image_width, image_height));
+ if (!dest_rect.intersect(SkIRect::MakeWH(image_width, image_height)))
+ continue;
// Align the rectangle to avoid artifacts in color space conversion.
dest_rect = AlignRect(dest_rect);
- if (dest_rect.IsEmpty())
- continue;
-
ConvertYUVToRGB32WithRect(last_image_->planes[0],
last_image_->planes[1],
last_image_->planes[2],
@@ -190,8 +191,8 @@ void DecoderVp8::ConvertRects(const UpdatedRects& rects,
}
}
-void DecoderVp8::ScaleAndConvertRects(const UpdatedRects& rects,
- UpdatedRects* output_rects) {
+void DecoderVp8::ScaleAndConvertRects(const RectVector& rects,
+ RectVector* output_rects) {
if (!last_image_)
return;
@@ -199,24 +200,23 @@ void DecoderVp8::ScaleAndConvertRects(const UpdatedRects& rects,
const int stride = frame_->stride(media::VideoFrame::kRGBPlane);
output_rects->clear();
+ output_rects->reserve(rects.size());
for (size_t i = 0; i < rects.size(); ++i) {
// Round down the image width and height.
int image_width = RoundToTwosMultiple(last_image_->d_w);
int image_height = RoundToTwosMultiple(last_image_->d_h);
// Clip by the rounded down dimension of the image for safety.
- gfx::Rect dest_rect =
- rects[i].Intersect(gfx::Rect(0, 0, image_width, image_height));
+ SkIRect dest_rect = rects[i];
+ if (!dest_rect.intersect(SkIRect::MakeWH(image_width, image_height)))
+ continue;
// Align the rectangle to avoid artifacts in color space conversion.
dest_rect = AlignRect(dest_rect);
- if (dest_rect.IsEmpty())
- continue;
-
- gfx::Rect scaled_rect = ScaleRect(dest_rect,
- horizontal_scale_ratio_,
- vertical_scale_ratio_);
+ SkIRect scaled_rect = ScaleRect(dest_rect,
+ horizontal_scale_ratio_,
+ vertical_scale_ratio_);
ScaleYUVToRGB32WithRect(last_image_->planes[0],
last_image_->planes[1],
« no previous file with comments | « remoting/base/decoder_vp8.h ('k') | remoting/base/encoder_row_based.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698