Fix some extract subset bugs.
authorscroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 7 Dec 2012 19:14:45 +0000 (19:14 +0000)
committerscroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 7 Dec 2012 19:14:45 +0000 (19:14 +0000)
commita2a31928470dfb642880f6ab2e4d34b1c7f5d476
treee40e2e7fcef0807301bec7f5b0970d54bdc3e3f7
parent7346df55c86a930afad54b0ff7aa6acf8f2a1e27
Fix some extract subset bugs.

In SkBitmap::extractSubset, perform a deepCopy, if the pixelRef supports it.

Fixes a bug in the 'extractbitmap' gm, which attempts to draw a subset of a texture backed bitmap (if the canvas is really an SkGpuCanvas).

Also fix some bugs that happen when there is a pixel offset. These fixes get bypassed by the deepCopy, but a user can still set a pixel offset manually.

When copying GPU backed bitmap with a pixel offset, copy the offset.

If the new config is the same as the old, copy fRowBytes as well.

Add a function to SkBitmap.cpp (getUpperLeftFromOffset) to find the x,y coordinate to use when copying to a new config.

Fix a bug where readPixels copied to the correct desired config and we were setting the generation ID to match even though the desired config was not the same as the original config (caught by my new tests!).

Add some tests to verify the correct behavior.

Review URL: https://codereview.appspot.com/6839043

git-svn-id: http://skia.googlecode.com/svn/trunk@6710 2bbb7eff-a529-9590-31e7-b0007b416f81
include/core/SkPixelRef.h
include/gpu/GrContext.h
include/gpu/SkGrPixelRef.h
src/core/SkBitmap.cpp
src/gpu/GrContext.cpp
src/gpu/SkGrPixelRef.cpp
tests/GpuBitmapCopyTest.cpp