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 "media/filters/skcanvas_video_renderer.h" | 5 #include "media/filters/skcanvas_video_renderer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "media/base/video_frame.h" | 8 #include "media/base/video_frame.h" |
9 #include "media/base/yuv_convert.h" | 9 #include "media/base/yuv_convert.h" |
10 #include "third_party/skia/include/core/SkCanvas.h" | 10 #include "third_party/skia/include/core/SkCanvas.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 const SkMatrix& total_matrix = canvas->getTotalMatrix(); | 50 const SkMatrix& total_matrix = canvas->getTotalMatrix(); |
51 // Perform the following checks here: | 51 // Perform the following checks here: |
52 // 1. Check for skewing factors of the transformation matrix. They should be | 52 // 1. Check for skewing factors of the transformation matrix. They should be |
53 // zero. | 53 // zero. |
54 // 2. Check for mirroring and flipping. Make sure they are greater than zero. | 54 // 2. Check for mirroring and flipping. Make sure they are greater than zero. |
55 if (SkScalarNearlyZero(total_matrix.getSkewX()) && | 55 if (SkScalarNearlyZero(total_matrix.getSkewX()) && |
56 SkScalarNearlyZero(total_matrix.getSkewY()) && | 56 SkScalarNearlyZero(total_matrix.getSkewY()) && |
57 total_matrix.getScaleX() > 0 && | 57 total_matrix.getScaleX() > 0 && |
58 total_matrix.getScaleY() > 0) { | 58 total_matrix.getScaleY() > 0) { |
59 SkDevice* device = canvas->getDevice(); | 59 SkBaseDevice* device = canvas->getDevice(); |
60 const SkBitmap::Config config = device->config(); | 60 const SkBitmap::Config config = device->config(); |
61 | 61 |
62 if (config == SkBitmap::kARGB_8888_Config && device->isOpaque()) { | 62 if (config == SkBitmap::kARGB_8888_Config && device->isOpaque()) { |
63 return true; | 63 return true; |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 return false; | 67 return false; |
68 } | 68 } |
69 | 69 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 ConvertVideoFrameToBitmap(video_frame, &last_frame_); | 315 ConvertVideoFrameToBitmap(video_frame, &last_frame_); |
316 last_frame_timestamp_ = video_frame->GetTimestamp(); | 316 last_frame_timestamp_ = video_frame->GetTimestamp(); |
317 } | 317 } |
318 | 318 |
319 // Do a slower paint using |last_frame_|. | 319 // Do a slower paint using |last_frame_|. |
320 paint.setFilterBitmap(true); | 320 paint.setFilterBitmap(true); |
321 canvas->drawBitmapRect(last_frame_, NULL, dest, &paint); | 321 canvas->drawBitmapRect(last_frame_, NULL, dest, &paint); |
322 } | 322 } |
323 | 323 |
324 } // namespace media | 324 } // namespace media |
OLD | NEW |