Always store pixels of mutable bitmaps when recording a SkPicture.
authordjsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 27 Jul 2012 15:58:23 +0000 (15:58 +0000)
committerdjsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 27 Jul 2012 15:58:23 +0000 (15:58 +0000)
commit7dade42e6f2e35dd27b4090fd7894322d755d4db
tree0581859868d08ff07cbf44fb0a6477b445073373
parent1c6d64b78b24083ee9fd7411dac8a4a7e2d03a3c
Always store pixels of mutable bitmaps when recording a SkPicture.

Prior to this CL mutable bitmaps only saved a copy of their pixels
if a flag was set at recording time.  That flag has been removed
and the default behavior when recording a mutable bitmap is to
make a copy of it's pixels. This is the only way to ensure that
the pixels are not manipulated before we playback their contents.

However, enabling this behavior breaks the recording of extracted
bitmaps in SkPicture. This is because we currently cache bitmaps
within a picture based only on their pixelRef. This results in
false positive cache hit when drawing an extracted bitmap as it
shares a pixelRef with its orginating bitmap.  Therefore we must
update the index of the bitmap cache to be both the pixelRef AND
the size and offset of the bitmap using those pixels.

BUG=
TEST=extractbitmap.cpp

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

git-svn-id: http://skia.googlecode.com/svn/trunk@4809 2bbb7eff-a529-9590-31e7-b0007b416f81
include/core/SkPicture.h
src/core/SkPicture.cpp
src/core/SkPictureRecord.cpp
src/core/SkPictureRecord.h
src/utils/SkDeferredCanvas.cpp
tests/CanvasTest.cpp