Chromium Code Reviews| 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; | |
|
alexeypa (please no reviews)
2012/03/02 19:59:04
I guess we should make the same check in DecoderRo
Sergey Ulanov
2012/03/02 20:03:27
Need {} around this line (multi-line condition)
Wez
2012/03/02 22:15:31
Done.
Wez
2012/03/02 22:15:31
DecoderRowBased currently doesn't support scaling
| |
| 131 | |
| 124 for (SkRegion::Iterator i(updated_region_); !i.done(); i.next()) { | 132 for (SkRegion::Iterator i(updated_region_); !i.done(); i.next()) { |
| 125 // Determine the scaled area affected by this rectangle changing. | 133 // Determine the scaled area affected by this rectangle changing. |
| 126 SkIRect rect = i.rect(); | 134 SkIRect rect = i.rect(); |
| 127 if (!rect.intersect(source_clip)) | 135 if (!rect.intersect(source_clip)) |
| 128 continue; | 136 continue; |
| 129 rect = ScaleRect(rect, screen_size_, view_size); | 137 rect = ScaleRect(rect, screen_size_, view_size); |
| 130 if (!rect.intersect(clip_area)) | 138 if (!rect.intersect(clip_area)) |
| 131 continue; | 139 continue; |
| 132 | 140 |
| 133 ConvertAndScaleYUVToRGB32Rect(last_image_->planes[0], | 141 ConvertAndScaleYUVToRGB32Rect(last_image_->planes[0], |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 144 rect); | 152 rect); |
| 145 | 153 |
| 146 output_region->op(rect, SkRegion::kUnion_Op); | 154 output_region->op(rect, SkRegion::kUnion_Op); |
| 147 } | 155 } |
| 148 | 156 |
| 149 updated_region_.op(ScaleRect(clip_area, view_size, screen_size_), | 157 updated_region_.op(ScaleRect(clip_area, view_size, screen_size_), |
| 150 SkRegion::kDifference_Op); | 158 SkRegion::kDifference_Op); |
| 151 } | 159 } |
| 152 | 160 |
| 153 } // namespace remoting | 161 } // namespace remoting |
| OLD | NEW |