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

Side by Side Diff: src/core/SkBitmap.cpp

Issue 24159009: Add SkDivMod with a special case for ARM. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: appease gcc on 10.6 Created 7 years, 2 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 | « include/core/SkMath.h ('k') | src/core/SkScaledImageCache.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 bool get_upper_left_from_offset(SkBitmap::Config config, size_t offset, size_t r owBytes, 904 bool get_upper_left_from_offset(SkBitmap::Config config, size_t offset, size_t r owBytes,
905 int32_t* x, int32_t* y); 905 int32_t* x, int32_t* y);
906 bool get_upper_left_from_offset(SkBitmap::Config config, size_t offset, size_t r owBytes, 906 bool get_upper_left_from_offset(SkBitmap::Config config, size_t offset, size_t r owBytes,
907 int32_t* x, int32_t* y) { 907 int32_t* x, int32_t* y) {
908 SkASSERT(x != NULL && y != NULL); 908 SkASSERT(x != NULL && y != NULL);
909 if (0 == offset) { 909 if (0 == offset) {
910 *x = *y = 0; 910 *x = *y = 0;
911 return true; 911 return true;
912 } 912 }
913 // Use integer division to find the correct y position. 913 // Use integer division to find the correct y position.
914 *y = SkToS32(offset / rowBytes);
915 // The remainder will be the x position, after we reverse get_sub_offset. 914 // The remainder will be the x position, after we reverse get_sub_offset.
916 *x = SkToS32(offset % rowBytes); 915 SkTDivMod(offset, rowBytes, y, x);
917 switch (config) { 916 switch (config) {
918 case SkBitmap::kA8_Config: 917 case SkBitmap::kA8_Config:
919 // Fall through. 918 // Fall through.
920 case SkBitmap::kIndex8_Config: 919 case SkBitmap::kIndex8_Config:
921 // x is unmodified 920 // x is unmodified
922 break; 921 break;
923 922
924 case SkBitmap::kRGB_565_Config: 923 case SkBitmap::kRGB_565_Config:
925 // Fall through. 924 // Fall through.
926 case SkBitmap::kARGB_4444_Config: 925 case SkBitmap::kARGB_4444_Config:
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 if (NULL != uri) { 1699 if (NULL != uri) {
1701 str->appendf(" uri:\"%s\"", uri); 1700 str->appendf(" uri:\"%s\"", uri);
1702 } else { 1701 } else {
1703 str->appendf(" pixelref:%p", pr); 1702 str->appendf(" pixelref:%p", pr);
1704 } 1703 }
1705 } 1704 }
1706 1705
1707 str->append(")"); 1706 str->append(")");
1708 } 1707 }
1709 #endif 1708 #endif
OLDNEW
« no previous file with comments | « include/core/SkMath.h ('k') | src/core/SkScaledImageCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698