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 "ui/gfx/skbitmap_operations.h" | 5 #include "ui/gfx/skbitmap_operations.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 SkBitmap::kARGB_8888_Config, source.width(), source.height()); | 830 SkBitmap::kARGB_8888_Config, source.width(), source.height()); |
831 break; | 831 break; |
832 case ROTATION_270_CW: | 832 case ROTATION_270_CW: |
833 angle = SkFloatToScalar(-270.0f); | 833 angle = SkFloatToScalar(-270.0f); |
834 result.setConfig( | 834 result.setConfig( |
835 SkBitmap::kARGB_8888_Config, source.height(), source.width()); | 835 SkBitmap::kARGB_8888_Config, source.height(), source.width()); |
836 break; | 836 break; |
837 } | 837 } |
838 result.allocPixels(); | 838 result.allocPixels(); |
839 SkCanvas canvas(result); | 839 SkCanvas canvas(result); |
| 840 canvas.clear(SkColorSetARGB(0, 0, 0, 0)); |
840 | 841 |
841 canvas.translate(SkFloatToScalar(result.width() * 0.5f), | 842 canvas.translate(SkFloatToScalar(result.width() * 0.5f), |
842 SkFloatToScalar(result.height() * 0.5f)); | 843 SkFloatToScalar(result.height() * 0.5f)); |
843 canvas.rotate(angle); | 844 canvas.rotate(angle); |
844 canvas.translate(-SkFloatToScalar(source.width() * 0.5f), | 845 canvas.translate(-SkFloatToScalar(source.width() * 0.5f), |
845 -SkFloatToScalar(source.height() * 0.5f)); | 846 -SkFloatToScalar(source.height() * 0.5f)); |
846 canvas.drawBitmap(source, 0, 0); | 847 canvas.drawBitmap(source, 0, 0); |
847 canvas.flush(); | 848 canvas.flush(); |
848 | 849 |
849 return result; | 850 return result; |
850 } | 851 } |
OLD | NEW |