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

Side by Side Diff: src/core/SkScaledImageCache.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 | « src/core/SkBitmap.cpp ('k') | tests/MathTest.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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkScaledImageCache.h" 8 #include "SkScaledImageCache.h"
9 #include "SkMipMap.h" 9 #include "SkMipMap.h"
10 #include "SkPixelRef.h" 10 #include "SkPixelRef.h"
(...skipping 30 matching lines...) Expand all
41 return hash; 41 return hash;
42 } 42 }
43 43
44 struct Key { 44 struct Key {
45 bool init(const SkBitmap& bm, SkScalar scaleX, SkScalar scaleY) { 45 bool init(const SkBitmap& bm, SkScalar scaleX, SkScalar scaleY) {
46 SkPixelRef* pr = bm.pixelRef(); 46 SkPixelRef* pr = bm.pixelRef();
47 if (!pr) { 47 if (!pr) {
48 return false; 48 return false;
49 } 49 }
50 50
51 size_t offset = bm.pixelRefOffset(); 51 size_t x, y;
52 size_t rowBytes = bm.rowBytes(); 52 SkTDivMod(bm.pixelRefOffset(), bm.rowBytes(), &y, &x);
53 int x = (offset % rowBytes) >> 2; 53 x >>= 2;
54 int y = offset / rowBytes;
55 54
56 fGenID = pr->getGenerationID(); 55 fGenID = pr->getGenerationID();
57 fBounds.set(x, y, x + bm.width(), y + bm.height()); 56 fBounds.set(x, y, x + bm.width(), y + bm.height());
58 fScaleX = scaleX; 57 fScaleX = scaleX;
59 fScaleY = scaleY; 58 fScaleY = scaleY;
60 59
61 fHash = compute_hash(&fGenID, 7); 60 fHash = compute_hash(&fGenID, 7);
62 return true; 61 return true;
63 } 62 }
64 63
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 return SkScaledImageCache::GetBytesUsed(); 515 return SkScaledImageCache::GetBytesUsed();
517 } 516 }
518 517
519 size_t SkGraphics::GetImageCacheByteLimit() { 518 size_t SkGraphics::GetImageCacheByteLimit() {
520 return SkScaledImageCache::GetByteLimit(); 519 return SkScaledImageCache::GetByteLimit();
521 } 520 }
522 521
523 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) { 522 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) {
524 return SkScaledImageCache::SetByteLimit(newLimit); 523 return SkScaledImageCache::SetByteLimit(newLimit);
525 } 524 }
OLDNEW
« no previous file with comments | « src/core/SkBitmap.cpp ('k') | tests/MathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698