In SkBitmapHeap, defer adding owners for new bitmaps.
authorscroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 16 Nov 2012 20:34:37 +0000 (20:34 +0000)
committerscroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 16 Nov 2012 20:34:37 +0000 (20:34 +0000)
commit013c5d9107a4abd50e879ca66cf60b0c3a8256d4
tree9a24b4c1fd6f8dd984801044ed7b9b060e9fcd67
parent6ec1526680bcc05b8b8b2c7ad9f78ba247e123b7
In SkBitmapHeap, defer adding owners for new bitmaps.

When using an SkFlatDictionary to flatten shaders, the
dictionary can try to insert a duplicate bitmap shader
that uses a bitmap which has been removed from the
bitmap heap.

This change was originally suggested by junov in
https://codereview.appspot.com/6713048/.

Add a test to verify that deferring the owners works.
Without the change to bitmap heap the test would fail
(and crash in debug mode).

Also remove an unused function from SkFlatDictionary.

BUG=http://code.google.com/p/chromium/issues/detail?id=143923

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

git-svn-id: http://skia.googlecode.com/svn/trunk@6471 2bbb7eff-a529-9590-31e7-b0007b416f81
gyp/tests.gyp
src/core/SkBitmapHeap.cpp
src/core/SkBitmapHeap.h
src/core/SkPictureFlat.h
tests/BitmapHeapTest.cpp [new file with mode: 0644]