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 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1772 } | 1772 } |
1773 | 1773 |
1774 static void draw_bitmaps(const SkBitmap bitmap, SkCanvas* canvas) { | 1774 static void draw_bitmaps(const SkBitmap bitmap, SkCanvas* canvas) { |
1775 const SkPaint paint; | 1775 const SkPaint paint; |
1776 const SkRect rect = { 5.0f, 5.0f, 8.0f, 8.0f }; | 1776 const SkRect rect = { 5.0f, 5.0f, 8.0f, 8.0f }; |
1777 const SkIRect irect = { 2, 2, 3, 3 }; | 1777 const SkIRect irect = { 2, 2, 3, 3 }; |
1778 | 1778 |
1779 // Don't care what these record, as long as they're legal. | 1779 // Don't care what these record, as long as they're legal. |
1780 canvas->drawBitmap(bitmap, 0.0f, 0.0f, &paint); | 1780 canvas->drawBitmap(bitmap, 0.0f, 0.0f, &paint); |
1781 canvas->drawBitmapRectToRect(bitmap, &rect, rect, &paint, SkCanvas::kNone_Dr
awBitmapRectFlag); | 1781 canvas->drawBitmapRectToRect(bitmap, &rect, rect, &paint, SkCanvas::kNone_Dr
awBitmapRectFlag); |
1782 canvas->drawBitmapMatrix(bitmap, SkMatrix::I(), &paint); | |
1783 canvas->drawBitmapNine(bitmap, irect, rect, &paint); | 1782 canvas->drawBitmapNine(bitmap, irect, rect, &paint); |
1784 canvas->drawSprite(bitmap, 1, 1); | 1783 canvas->drawSprite(bitmap, 1, 1); |
1785 } | 1784 } |
1786 | 1785 |
1787 static void test_draw_bitmaps(SkCanvas* canvas) { | 1786 static void test_draw_bitmaps(SkCanvas* canvas) { |
1788 SkBitmap empty; | 1787 SkBitmap empty; |
1789 draw_bitmaps(empty, canvas); | 1788 draw_bitmaps(empty, canvas); |
1790 empty.setInfo(SkImageInfo::MakeN32Premul(10, 10)); | 1789 empty.setInfo(SkImageInfo::MakeN32Premul(10, 10)); |
1791 draw_bitmaps(empty, canvas); | 1790 draw_bitmaps(empty, canvas); |
1792 } | 1791 } |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1919 | 1918 |
1920 // The picture shares the immutable pixels but copies the mutable ones. | 1919 // The picture shares the immutable pixels but copies the mutable ones. |
1921 REPORTER_ASSERT(r, mut.pixelRef()->unique()); | 1920 REPORTER_ASSERT(r, mut.pixelRef()->unique()); |
1922 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); | 1921 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); |
1923 | 1922 |
1924 // When the picture goes away, it's just our bitmaps holding the refs. | 1923 // When the picture goes away, it's just our bitmaps holding the refs. |
1925 pic.reset(NULL); | 1924 pic.reset(NULL); |
1926 REPORTER_ASSERT(r, mut.pixelRef()->unique()); | 1925 REPORTER_ASSERT(r, mut.pixelRef()->unique()); |
1927 REPORTER_ASSERT(r, immut.pixelRef()->unique()); | 1926 REPORTER_ASSERT(r, immut.pixelRef()->unique()); |
1928 } | 1927 } |
OLD | NEW |