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

Side by Side Diff: ui/gfx/skbitmap_operations.cc

Issue 11644033: Rotated Images (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 12 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/resources/ash_resources.grd ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « ash/resources/ash_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698