OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkBBoxHierarchy.h" | 8 #include "SkBBoxHierarchy.h" |
9 #include "SkBlurImageFilter.h" | 9 #include "SkBlurImageFilter.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1902 SkASSERT(immut.isImmutable()); | 1902 SkASSERT(immut.isImmutable()); |
1903 | 1903 |
1904 // No one can hold a ref on our pixels yet. | 1904 // No one can hold a ref on our pixels yet. |
1905 REPORTER_ASSERT(r, mut.pixelRef()->unique()); | 1905 REPORTER_ASSERT(r, mut.pixelRef()->unique()); |
1906 REPORTER_ASSERT(r, immut.pixelRef()->unique()); | 1906 REPORTER_ASSERT(r, immut.pixelRef()->unique()); |
1907 | 1907 |
1908 SkPictureRecorder rec; | 1908 SkPictureRecorder rec; |
1909 SkCanvas* canvas = rec.beginRecording(1920, 1200); | 1909 SkCanvas* canvas = rec.beginRecording(1920, 1200); |
1910 canvas->drawBitmap(mut, 0, 0); | 1910 canvas->drawBitmap(mut, 0, 0); |
1911 canvas->drawBitmap(immut, 800, 600); | 1911 canvas->drawBitmap(immut, 800, 600); |
1912 SkAutoTDelete<const SkPicture> pic(rec.endRecording()); | 1912 SkAutoTUnref<const SkPicture> pic(rec.endRecording()); |
1913 | 1913 |
1914 // The picture shares the immutable pixels but copies the mutable ones. | 1914 // The picture shares the immutable pixels but copies the mutable ones. |
1915 REPORTER_ASSERT(r, mut.pixelRef()->unique()); | 1915 REPORTER_ASSERT(r, mut.pixelRef()->unique()); |
1916 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); | 1916 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); |
1917 | 1917 |
1918 // When the picture goes away, it's just our bitmaps holding the refs. | 1918 // When the picture goes away, it's just our bitmaps holding the refs. |
1919 pic.reset(NULL); | 1919 pic.reset(NULL); |
1920 REPORTER_ASSERT(r, mut.pixelRef()->unique()); | 1920 REPORTER_ASSERT(r, mut.pixelRef()->unique()); |
1921 REPORTER_ASSERT(r, immut.pixelRef()->unique()); | 1921 REPORTER_ASSERT(r, immut.pixelRef()->unique()); |
1922 } | 1922 } |
OLD | NEW |