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

Side by Side Diff: tests/PictureTest.cpp

Issue 1992283002: Add drawBitmapLattice() API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rewrite picture impls Created 4 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
« no previous file with comments | « src/pdf/SkPDFCanvas.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "SkBigPicture.h" 8 #include "SkBigPicture.h"
9 #include "SkBBoxHierarchy.h" 9 #include "SkBBoxHierarchy.h"
10 #include "SkBlurImageFilter.h" 10 #include "SkBlurImageFilter.h"
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 test_clip_expansion(reporter); 987 test_clip_expansion(reporter);
988 test_hierarchical(reporter); 988 test_hierarchical(reporter);
989 test_gen_id(reporter); 989 test_gen_id(reporter);
990 test_cull_rect_reset(reporter); 990 test_cull_rect_reset(reporter);
991 } 991 }
992 992
993 static void draw_bitmaps(const SkBitmap bitmap, SkCanvas* canvas) { 993 static void draw_bitmaps(const SkBitmap bitmap, SkCanvas* canvas) {
994 const SkPaint paint; 994 const SkPaint paint;
995 const SkRect rect = { 5.0f, 5.0f, 8.0f, 8.0f }; 995 const SkRect rect = { 5.0f, 5.0f, 8.0f, 8.0f };
996 const SkIRect irect = { 2, 2, 3, 3 }; 996 const SkIRect irect = { 2, 2, 3, 3 };
997 int divs[] = { 2, 3 };
998 SkCanvas::Lattice lattice;
999 lattice.fXCount = lattice.fYCount = 2;
1000 lattice.fXDivs = lattice.fYDivs = divs;
997 1001
998 // Don't care what these record, as long as they're legal. 1002 // Don't care what these record, as long as they're legal.
999 canvas->drawBitmap(bitmap, 0.0f, 0.0f, &paint); 1003 canvas->drawBitmap(bitmap, 0.0f, 0.0f, &paint);
1000 canvas->drawBitmapRect(bitmap, rect, rect, &paint, SkCanvas::kStrict_SrcRect Constraint); 1004 canvas->drawBitmapRect(bitmap, rect, rect, &paint, SkCanvas::kStrict_SrcRect Constraint);
1001 canvas->drawBitmapNine(bitmap, irect, rect, &paint); 1005 canvas->drawBitmapNine(bitmap, irect, rect, &paint);
1002 canvas->drawBitmap(bitmap, 1, 1); // drawSprite 1006 canvas->drawBitmap(bitmap, 1, 1); // drawSprite
1007 canvas->drawBitmapLattice(bitmap, lattice, rect, &paint);
1003 } 1008 }
1004 1009
1005 static void test_draw_bitmaps(SkCanvas* canvas) { 1010 static void test_draw_bitmaps(SkCanvas* canvas) {
1006 SkBitmap empty; 1011 SkBitmap empty;
1007 draw_bitmaps(empty, canvas); 1012 draw_bitmaps(empty, canvas);
1008 empty.setInfo(SkImageInfo::MakeN32Premul(10, 10)); 1013 empty.setInfo(SkImageInfo::MakeN32Premul(10, 10));
1009 draw_bitmaps(empty, canvas); 1014 draw_bitmaps(empty, canvas);
1010 } 1015 }
1011 1016
1012 DEF_TEST(Picture_EmptyBitmap, r) { 1017 DEF_TEST(Picture_EmptyBitmap, r) {
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 SkPictureRecorder rec; 1305 SkPictureRecorder rec;
1301 proc(rec.beginRecording(cull)); 1306 proc(rec.beginRecording(cull));
1302 sk_sp<SkDrawable> dr = rec.finishRecordingAsDrawable( 1307 sk_sp<SkDrawable> dr = rec.finishRecordingAsDrawable(
1303 SkPictureRecorder::kReturnNullF orEmpty_FinishFlag); 1308 SkPictureRecorder::kReturnNullF orEmpty_FinishFlag);
1304 REPORTER_ASSERT(r, !dr.get()); 1309 REPORTER_ASSERT(r, !dr.get());
1305 } 1310 }
1306 } 1311 }
1307 } 1312 }
1308 #endif 1313 #endif
1309 1314
OLDNEW
« no previous file with comments | « src/pdf/SkPDFCanvas.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698