Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: tests/PictureTest.cpp

Issue 1272713005: flag to use const& instead of const* for src-rect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 canvas->drawRect(r, p); 683 canvas->drawRect(r, p);
684 684
685 SkAutoTUnref<SkPicture> copy(SkPictureRecorderReplayTester::Copy(&record er)); 685 SkAutoTUnref<SkPicture> copy(SkPictureRecorderReplayTester::Copy(&record er));
686 686
687 REPORTER_ASSERT(reporter, !copy->willPlayBackBitmaps()); 687 REPORTER_ASSERT(reporter, !copy->willPlayBackBitmaps());
688 688
689 SkBitmap bm; 689 SkBitmap bm;
690 make_bm(&bm, 10, 10, SK_ColorRED, true); 690 make_bm(&bm, 10, 10, SK_ColorRED, true);
691 691
692 r.offset(5.0f, 5.0f); 692 r.offset(5.0f, 5.0f);
693 canvas->drawBitmapRect(bm, r); 693 canvas->drawBitmapRect(bm, r, nullptr);
694 694
695 SkAutoTUnref<SkPicture> final(recorder.endRecording()); 695 SkAutoTUnref<SkPicture> final(recorder.endRecording());
696 REPORTER_ASSERT(reporter, final->willPlayBackBitmaps()); 696 REPORTER_ASSERT(reporter, final->willPlayBackBitmaps());
697 697
698 REPORTER_ASSERT(reporter, copy->uniqueID() != final->uniqueID()); 698 REPORTER_ASSERT(reporter, copy->uniqueID() != final->uniqueID());
699 699
700 // The snapshot shouldn't pick up any operations added after it was made 700 // The snapshot shouldn't pick up any operations added after it was made
701 REPORTER_ASSERT(reporter, !copy->willPlayBackBitmaps()); 701 REPORTER_ASSERT(reporter, !copy->willPlayBackBitmaps());
702 } 702 }
703 703
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 test_cull_rect_reset(reporter); 1160 test_cull_rect_reset(reporter);
1161 } 1161 }
1162 1162
1163 static void draw_bitmaps(const SkBitmap bitmap, SkCanvas* canvas) { 1163 static void draw_bitmaps(const SkBitmap bitmap, SkCanvas* canvas) {
1164 const SkPaint paint; 1164 const SkPaint paint;
1165 const SkRect rect = { 5.0f, 5.0f, 8.0f, 8.0f }; 1165 const SkRect rect = { 5.0f, 5.0f, 8.0f, 8.0f };
1166 const SkIRect irect = { 2, 2, 3, 3 }; 1166 const SkIRect irect = { 2, 2, 3, 3 };
1167 1167
1168 // Don't care what these record, as long as they're legal. 1168 // Don't care what these record, as long as they're legal.
1169 canvas->drawBitmap(bitmap, 0.0f, 0.0f, &paint); 1169 canvas->drawBitmap(bitmap, 0.0f, 0.0f, &paint);
1170 canvas->drawBitmapRect(bitmap, &rect, rect, &paint, SkCanvas::kStrict_SrcRec tConstraint); 1170 canvas->drawBitmapRect(bitmap, rect, rect, &paint, SkCanvas::kStrict_SrcRect Constraint);
1171 canvas->drawBitmapNine(bitmap, irect, rect, &paint); 1171 canvas->drawBitmapNine(bitmap, irect, rect, &paint);
1172 canvas->drawSprite(bitmap, 1, 1); 1172 canvas->drawSprite(bitmap, 1, 1);
1173 } 1173 }
1174 1174
1175 static void test_draw_bitmaps(SkCanvas* canvas) { 1175 static void test_draw_bitmaps(SkCanvas* canvas) {
1176 SkBitmap empty; 1176 SkBitmap empty;
1177 draw_bitmaps(empty, canvas); 1177 draw_bitmaps(empty, canvas);
1178 empty.setInfo(SkImageInfo::MakeN32Premul(10, 10)); 1178 empty.setInfo(SkImageInfo::MakeN32Premul(10, 10));
1179 draw_bitmaps(empty, canvas); 1179 draw_bitmaps(empty, canvas);
1180 } 1180 }
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 1355
1356 SkAutoTDelete<SkStream> rstream(wstream.detachAsStream()); 1356 SkAutoTDelete<SkStream> rstream(wstream.detachAsStream());
1357 SkAutoTUnref<SkPicture> deserializedPicture(SkPicture::CreateFromStream(rstr eam)); 1357 SkAutoTUnref<SkPicture> deserializedPicture(SkPicture::CreateFromStream(rstr eam));
1358 1358
1359 REPORTER_ASSERT(r, SkToBool(deserializedPicture)); 1359 REPORTER_ASSERT(r, SkToBool(deserializedPicture));
1360 REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1); 1360 REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1);
1361 REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2); 1361 REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2);
1362 REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3); 1362 REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3);
1363 REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4); 1363 REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4);
1364 } 1364 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698