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

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

Issue 105893012: change offset to xy for pixelref subsetting (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 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/SkOrderedWriteBuffer.cpp ('k') | src/gpu/SkGpuDevice.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 "SkOnce.h" 10 #include "SkOnce.h"
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 362
363 /** 363 /**
364 This function finds the bounds of the bitmap *within its pixelRef*. 364 This function finds the bounds of the bitmap *within its pixelRef*.
365 If the bitmap lacks a pixelRef, it will return an empty rect, since 365 If the bitmap lacks a pixelRef, it will return an empty rect, since
366 that doesn't make sense. This may be a useful enough function that 366 that doesn't make sense. This may be a useful enough function that
367 it should be somewhere else (in SkBitmap?). */ 367 it should be somewhere else (in SkBitmap?). */
368 static SkIRect get_bounds_from_bitmap(const SkBitmap& bm) { 368 static SkIRect get_bounds_from_bitmap(const SkBitmap& bm) {
369 if (!(bm.pixelRef())) { 369 if (!(bm.pixelRef())) {
370 return SkIRect::MakeEmpty(); 370 return SkIRect::MakeEmpty();
371 } 371 }
372 size_t x, y; 372 SkIPoint origin = bm.pixelRefOrigin();
373 SkTDivMod(bm.pixelRefOffset(), bm.rowBytes(), &y, &x); 373 return SkIRect::MakeXYWH(origin.fX, origin.fY, bm.width(), bm.height());
374 x >>= bm.shiftPerPixel();
375 return SkIRect::MakeXYWH(x, y, bm.width(), bm.height());
376 } 374 }
377 375
378 376
379 SkScaledImageCache::ID* SkScaledImageCache::findAndLock(uint32_t genID, 377 SkScaledImageCache::ID* SkScaledImageCache::findAndLock(uint32_t genID,
380 int32_t width, 378 int32_t width,
381 int32_t height, 379 int32_t height,
382 SkBitmap* bitmap) { 380 SkBitmap* bitmap) {
383 Rec* rec = this->findAndLock(genID, SK_Scalar1, SK_Scalar1, 381 Rec* rec = this->findAndLock(genID, SK_Scalar1, SK_Scalar1,
384 SkIRect::MakeWH(width, height)); 382 SkIRect::MakeWH(width, height));
385 if (rec) { 383 if (rec) {
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 return SkScaledImageCache::GetBytesUsed(); 792 return SkScaledImageCache::GetBytesUsed();
795 } 793 }
796 794
797 size_t SkGraphics::GetImageCacheByteLimit() { 795 size_t SkGraphics::GetImageCacheByteLimit() {
798 return SkScaledImageCache::GetByteLimit(); 796 return SkScaledImageCache::GetByteLimit();
799 } 797 }
800 798
801 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) { 799 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) {
802 return SkScaledImageCache::SetByteLimit(newLimit); 800 return SkScaledImageCache::SetByteLimit(newLimit);
803 } 801 }
OLDNEW
« no previous file with comments | « src/core/SkOrderedWriteBuffer.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698