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

Side by Side Diff: tests/PictureTest.cpp

Issue 1992283002: Add drawBitmapLattice() API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add implementation for SkRecorder and SkPictureRecord Created 4 years, 5 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
« include/core/SkCanvas.h ('K') | « src/core/SkRecorder.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 "SkBBoxHierarchy.h" 8 #include "SkBBoxHierarchy.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 test_hierarchical(reporter); 1191 test_hierarchical(reporter);
1192 test_gen_id(reporter); 1192 test_gen_id(reporter);
1193 test_savelayer_extraction(reporter); 1193 test_savelayer_extraction(reporter);
1194 test_cull_rect_reset(reporter); 1194 test_cull_rect_reset(reporter);
1195 } 1195 }
1196 1196
1197 static void draw_bitmaps(const SkBitmap bitmap, SkCanvas* canvas) { 1197 static void draw_bitmaps(const SkBitmap bitmap, SkCanvas* canvas) {
1198 const SkPaint paint; 1198 const SkPaint paint;
1199 const SkRect rect = { 5.0f, 5.0f, 8.0f, 8.0f }; 1199 const SkRect rect = { 5.0f, 5.0f, 8.0f, 8.0f };
1200 const SkIRect irect = { 2, 2, 3, 3 }; 1200 const SkIRect irect = { 2, 2, 3, 3 };
1201 int divs[] = { 2, 3 };
1202 SkCanvas::NinePatchDivs npDivs;
1203 npDivs.fXCount = npDivs.fYCount = 2;
1204 npDivs.fXDivs = npDivs.fYDivs = divs;
1201 1205
1202 // Don't care what these record, as long as they're legal. 1206 // Don't care what these record, as long as they're legal.
1203 canvas->drawBitmap(bitmap, 0.0f, 0.0f, &paint); 1207 canvas->drawBitmap(bitmap, 0.0f, 0.0f, &paint);
1204 canvas->drawBitmapRect(bitmap, rect, rect, &paint, SkCanvas::kStrict_SrcRect Constraint); 1208 canvas->drawBitmapRect(bitmap, rect, rect, &paint, SkCanvas::kStrict_SrcRect Constraint);
1205 canvas->drawBitmapNine(bitmap, irect, rect, &paint); 1209 canvas->drawBitmapNine(bitmap, irect, rect, &paint);
1206 canvas->drawBitmap(bitmap, 1, 1); // drawSprite 1210 canvas->drawBitmap(bitmap, 1, 1); // drawSprite
1211 canvas->drawBitmapNine(bitmap, npDivs, rect, &paint);
1207 } 1212 }
1208 1213
1209 static void test_draw_bitmaps(SkCanvas* canvas) { 1214 static void test_draw_bitmaps(SkCanvas* canvas) {
1210 SkBitmap empty; 1215 SkBitmap empty;
1211 draw_bitmaps(empty, canvas); 1216 draw_bitmaps(empty, canvas);
1212 empty.setInfo(SkImageInfo::MakeN32Premul(10, 10)); 1217 empty.setInfo(SkImageInfo::MakeN32Premul(10, 10));
1213 draw_bitmaps(empty, canvas); 1218 draw_bitmaps(empty, canvas);
1214 } 1219 }
1215 1220
1216 DEF_TEST(Picture_EmptyBitmap, r) { 1221 DEF_TEST(Picture_EmptyBitmap, r) {
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 } 1505 }
1501 { 1506 {
1502 SkPictureRecorder rec; 1507 SkPictureRecorder rec;
1503 proc(rec.beginRecording(cull)); 1508 proc(rec.beginRecording(cull));
1504 sk_sp<SkDrawable> dr = rec.finishRecordingAsDrawable( 1509 sk_sp<SkDrawable> dr = rec.finishRecordingAsDrawable(
1505 SkPictureRecorder::kReturnNullF orEmpty_FinishFlag); 1510 SkPictureRecorder::kReturnNullF orEmpty_FinishFlag);
1506 REPORTER_ASSERT(r, !dr.get()); 1511 REPORTER_ASSERT(r, !dr.get());
1507 } 1512 }
1508 } 1513 }
1509 } 1514 }
OLDNEW
« include/core/SkCanvas.h ('K') | « src/core/SkRecorder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698