diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-01-08 15:42:01 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-01-08 15:42:01 +0000 |
commit | 672588b684d484dce6ae251e9e163e4a46924322 (patch) | |
tree | c0fd674c6a905b9f7e4f9f8e58326653ab3fe816 /src/gpu | |
parent | c75b25af9e46019b13cde1e642a63b7c253ea5f4 (diff) |
change offset to xy for pixelref subsetting
BUG=
R=scroggo@google.com
Review URL: https://codereview.chromium.org/105893012
git-svn-id: http://skia.googlecode.com/svn/trunk@12958 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 4 | ||||
-rw-r--r-- | src/gpu/SkGr.cpp | 19 |
2 files changed, 12 insertions, 11 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 680dd89984..25aacca509 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -219,7 +219,7 @@ void SkGpuDevice::initFromRenderTarget(GrContext* context, surface->asImageInfo(&info); SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (info, surface, cached)); - this->setPixelRef(pr, 0)->unref(); + this->setPixelRef(pr)->unref(); } SkGpuDevice::SkGpuDevice(GrContext* context, @@ -266,7 +266,7 @@ SkGpuDevice::SkGpuDevice(GrContext* context, // wrap the bitmap with a pixelref to expose our texture SkGrPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (info, texture)); - this->setPixelRef(pr, 0)->unref(); + this->setPixelRef(pr)->unref(); } else { GrPrintf("--- failed to create gpu-offscreen [%d %d]\n", width, height); diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index a3f0eefa91..fa9fa71326 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -65,18 +65,19 @@ static void generate_bitmap_cache_id(const SkBitmap& bitmap, GrCacheID* id) { // Our id includes the offset, width, and height so that bitmaps created by extractSubset() // are unique. uint32_t genID = bitmap.getGenerationID(); - size_t offset = bitmap.pixelRefOffset(); - int16_t width = static_cast<int16_t>(bitmap.width()); - int16_t height = static_cast<int16_t>(bitmap.height()); + SkIPoint origin = bitmap.pixelRefOrigin(); + int16_t width = SkToS16(bitmap.width()); + int16_t height = SkToS16(bitmap.height()); GrCacheID::Key key; - memcpy(key.fData8, &genID, 4); - memcpy(key.fData8 + 4, &width, 2); - memcpy(key.fData8 + 6, &height, 2); - memcpy(key.fData8 + 8, &offset, sizeof(size_t)); - static const size_t kKeyDataSize = 8 + sizeof(size_t); + memcpy(key.fData8 + 0, &genID, 4); + memcpy(key.fData8 + 4, &origin.fX, 4); + memcpy(key.fData8 + 8, &origin.fY, 4); + memcpy(key.fData8 + 12, &width, 2); + memcpy(key.fData8 + 14, &height, 2); + static const size_t kKeyDataSize = 16; memset(key.fData8 + kKeyDataSize, 0, sizeof(key) - kKeyDataSize); - GR_STATIC_ASSERT(sizeof(key) >= 8 + sizeof(size_t)); + GR_STATIC_ASSERT(sizeof(key) >= kKeyDataSize); static const GrCacheID::Domain gBitmapTextureDomain = GrCacheID::GenerateDomain(); id->reset(gBitmapTextureDomain, key); } |