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 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1786 } | 1786 } |
1787 | 1787 |
1788 static void draw_bitmaps(const SkBitmap bitmap, SkCanvas* canvas) { | 1788 static void draw_bitmaps(const SkBitmap bitmap, SkCanvas* canvas) { |
1789 const SkPaint paint; | 1789 const SkPaint paint; |
1790 const SkRect rect = { 5.0f, 5.0f, 8.0f, 8.0f }; | 1790 const SkRect rect = { 5.0f, 5.0f, 8.0f, 8.0f }; |
1791 const SkIRect irect = { 2, 2, 3, 3 }; | 1791 const SkIRect irect = { 2, 2, 3, 3 }; |
1792 | 1792 |
1793 // Don't care what these record, as long as they're legal. | 1793 // Don't care what these record, as long as they're legal. |
1794 canvas->drawBitmap(bitmap, 0.0f, 0.0f, &paint); | 1794 canvas->drawBitmap(bitmap, 0.0f, 0.0f, &paint); |
1795 canvas->drawBitmapRectToRect(bitmap, &rect, rect, &paint, SkCanvas::kNone_Dr
awBitmapRectFlag); | 1795 canvas->drawBitmapRectToRect(bitmap, &rect, rect, &paint, SkCanvas::kNone_Dr
awBitmapRectFlag); |
1796 canvas->drawBitmapMatrix(bitmap, SkMatrix::I(), &paint); | |
1797 canvas->drawBitmapNine(bitmap, irect, rect, &paint); | 1796 canvas->drawBitmapNine(bitmap, irect, rect, &paint); |
1798 canvas->drawSprite(bitmap, 1, 1); | 1797 canvas->drawSprite(bitmap, 1, 1); |
1799 } | 1798 } |
1800 | 1799 |
1801 static void test_draw_bitmaps(SkCanvas* canvas) { | 1800 static void test_draw_bitmaps(SkCanvas* canvas) { |
1802 SkBitmap empty; | 1801 SkBitmap empty; |
1803 draw_bitmaps(empty, canvas); | 1802 draw_bitmaps(empty, canvas); |
1804 empty.setInfo(SkImageInfo::MakeN32Premul(10, 10)); | 1803 empty.setInfo(SkImageInfo::MakeN32Premul(10, 10)); |
1805 draw_bitmaps(empty, canvas); | 1804 draw_bitmaps(empty, canvas); |
1806 } | 1805 } |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1933 | 1932 |
1934 // The picture shares the immutable pixels but copies the mutable ones. | 1933 // The picture shares the immutable pixels but copies the mutable ones. |
1935 REPORTER_ASSERT(r, mut.pixelRef()->unique()); | 1934 REPORTER_ASSERT(r, mut.pixelRef()->unique()); |
1936 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); | 1935 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); |
1937 | 1936 |
1938 // When the picture goes away, it's just our bitmaps holding the refs. | 1937 // When the picture goes away, it's just our bitmaps holding the refs. |
1939 pic.reset(NULL); | 1938 pic.reset(NULL); |
1940 REPORTER_ASSERT(r, mut.pixelRef()->unique()); | 1939 REPORTER_ASSERT(r, mut.pixelRef()->unique()); |
1941 REPORTER_ASSERT(r, immut.pixelRef()->unique()); | 1940 REPORTER_ASSERT(r, immut.pixelRef()->unique()); |
1942 } | 1941 } |
OLD | NEW |