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 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 | 1187 |
1188 static void draw_bitmaps(const SkBitmap bitmap, SkCanvas* canvas) { | 1188 static void draw_bitmaps(const SkBitmap bitmap, SkCanvas* canvas) { |
1189 const SkPaint paint; | 1189 const SkPaint paint; |
1190 const SkRect rect = { 5.0f, 5.0f, 8.0f, 8.0f }; | 1190 const SkRect rect = { 5.0f, 5.0f, 8.0f, 8.0f }; |
1191 const SkIRect irect = { 2, 2, 3, 3 }; | 1191 const SkIRect irect = { 2, 2, 3, 3 }; |
1192 | 1192 |
1193 // Don't care what these record, as long as they're legal. | 1193 // Don't care what these record, as long as they're legal. |
1194 canvas->drawBitmap(bitmap, 0.0f, 0.0f, &paint); | 1194 canvas->drawBitmap(bitmap, 0.0f, 0.0f, &paint); |
1195 canvas->drawBitmapRect(bitmap, rect, rect, &paint, SkCanvas::kStrict_SrcRect
Constraint); | 1195 canvas->drawBitmapRect(bitmap, rect, rect, &paint, SkCanvas::kStrict_SrcRect
Constraint); |
1196 canvas->drawBitmapNine(bitmap, irect, rect, &paint); | 1196 canvas->drawBitmapNine(bitmap, irect, rect, &paint); |
1197 canvas->drawBitmap(bitmap, 1, 1); // drawSprite | 1197 canvas->drawSprite(bitmap, 1, 1); |
1198 } | 1198 } |
1199 | 1199 |
1200 static void test_draw_bitmaps(SkCanvas* canvas) { | 1200 static void test_draw_bitmaps(SkCanvas* canvas) { |
1201 SkBitmap empty; | 1201 SkBitmap empty; |
1202 draw_bitmaps(empty, canvas); | 1202 draw_bitmaps(empty, canvas); |
1203 empty.setInfo(SkImageInfo::MakeN32Premul(10, 10)); | 1203 empty.setInfo(SkImageInfo::MakeN32Premul(10, 10)); |
1204 draw_bitmaps(empty, canvas); | 1204 draw_bitmaps(empty, canvas); |
1205 } | 1205 } |
1206 | 1206 |
1207 DEF_TEST(Picture_EmptyBitmap, r) { | 1207 DEF_TEST(Picture_EmptyBitmap, r) { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 | 1380 |
1381 SkAutoTDelete<SkStream> rstream(wstream.detachAsStream()); | 1381 SkAutoTDelete<SkStream> rstream(wstream.detachAsStream()); |
1382 SkAutoTUnref<SkPicture> deserializedPicture(SkPicture::CreateFromStream(rstr
eam)); | 1382 SkAutoTUnref<SkPicture> deserializedPicture(SkPicture::CreateFromStream(rstr
eam)); |
1383 | 1383 |
1384 REPORTER_ASSERT(r, SkToBool(deserializedPicture)); | 1384 REPORTER_ASSERT(r, SkToBool(deserializedPicture)); |
1385 REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1); | 1385 REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1); |
1386 REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2); | 1386 REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2); |
1387 REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3); | 1387 REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3); |
1388 REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4); | 1388 REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4); |
1389 } | 1389 } |
OLD | NEW |