| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_vp8.h" | 5 #include "remoting/base/decoder_vp8.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "media/base/media.h" | 10 #include "media/base/media.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 | 116 |
| 117 void DecoderVp8::RenderFrame(const SkISize& view_size, | 117 void DecoderVp8::RenderFrame(const SkISize& view_size, |
| 118 const SkIRect& clip_area, | 118 const SkIRect& clip_area, |
| 119 uint8* image_buffer, | 119 uint8* image_buffer, |
| 120 int image_stride, | 120 int image_stride, |
| 121 SkRegion* output_region) { | 121 SkRegion* output_region) { |
| 122 SkIRect source_clip = SkIRect::MakeWH(last_image_->d_w, last_image_->d_h); | 122 SkIRect source_clip = SkIRect::MakeWH(last_image_->d_w, last_image_->d_h); |
| 123 | 123 |
| 124 // ScaleYUVToRGB32WithRect doesn't support up-scaling, and our web-app never |
| 125 // intentionally up-scales, so if we see up-scaling (e.g. during host resize |
| 126 // or if the user applies page zoom) just don't render anything. |
| 127 // TODO(wez): Remove this hack when ScaleYUVToRGB32WithRect can up-scale. |
| 128 if (source_clip.width() < view_size.width() || |
| 129 source_clip.height() < view_size.height()) { |
| 130 return; |
| 131 } |
| 132 |
| 124 for (SkRegion::Iterator i(updated_region_); !i.done(); i.next()) { | 133 for (SkRegion::Iterator i(updated_region_); !i.done(); i.next()) { |
| 125 // Determine the scaled area affected by this rectangle changing. | 134 // Determine the scaled area affected by this rectangle changing. |
| 126 SkIRect rect = i.rect(); | 135 SkIRect rect = i.rect(); |
| 127 if (!rect.intersect(source_clip)) | 136 if (!rect.intersect(source_clip)) |
| 128 continue; | 137 continue; |
| 129 rect = ScaleRect(rect, screen_size_, view_size); | 138 rect = ScaleRect(rect, screen_size_, view_size); |
| 130 if (!rect.intersect(clip_area)) | 139 if (!rect.intersect(clip_area)) |
| 131 continue; | 140 continue; |
| 132 | 141 |
| 133 ConvertAndScaleYUVToRGB32Rect(last_image_->planes[0], | 142 ConvertAndScaleYUVToRGB32Rect(last_image_->planes[0], |
| (...skipping 10 matching lines...) Expand all Loading... |
| 144 rect); | 153 rect); |
| 145 | 154 |
| 146 output_region->op(rect, SkRegion::kUnion_Op); | 155 output_region->op(rect, SkRegion::kUnion_Op); |
| 147 } | 156 } |
| 148 | 157 |
| 149 updated_region_.op(ScaleRect(clip_area, view_size, screen_size_), | 158 updated_region_.op(ScaleRect(clip_area, view_size, screen_size_), |
| 150 SkRegion::kDifference_Op); | 159 SkRegion::kDifference_Op); |
| 151 } | 160 } |
| 152 | 161 |
| 153 } // namespace remoting | 162 } // namespace remoting |
| OLD | NEW |