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

Side by Side Diff: tests/SpecialImageTest.cpp

Issue 2158913004: remove unused MakeFromPixmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
« no previous file with comments | « src/core/SkSpecialImage.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 2016 Google Inc. 2 * Copyright 2016 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 "SkAutoPixmapStorage.h" 8 #include "SkAutoPixmapStorage.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeFromImage(subset, ful lImage)); 170 sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeFromImage(subset, ful lImage));
171 test_image(subSImg1, reporter, nullptr, false, kPad, kFullSize); 171 test_image(subSImg1, reporter, nullptr, false, kPad, kFullSize);
172 } 172 }
173 173
174 { 174 {
175 sk_sp<SkSpecialImage> subSImg2(fullSImage->makeSubset(subset)); 175 sk_sp<SkSpecialImage> subSImg2(fullSImage->makeSubset(subset));
176 test_image(subSImg2, reporter, nullptr, false, 0, kSmallerSize); 176 test_image(subSImg2, reporter, nullptr, false, 0, kSmallerSize);
177 } 177 }
178 } 178 }
179 179
180 DEF_TEST(SpecialImage_Pixmap, reporter) {
181 SkAutoPixmapStorage pixmap;
182
183 const SkImageInfo info = SkImageInfo::MakeN32(kFullSize, kFullSize, kOpaque_ SkAlphaType);
184 pixmap.alloc(info);
185 pixmap.erase(SK_ColorGREEN);
186
187 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller Size);
188
189 pixmap.erase(SK_ColorRED, subset);
190
191 {
192 sk_sp<SkSpecialImage> img(SkSpecialImage::MakeFromPixmap(subset, pixmap,
193 nullptr, nullpt r));
194 test_image(img, reporter, nullptr, false, kPad, kFullSize);
195 }
196 }
197
198
199 #if SK_SUPPORT_GPU 180 #if SK_SUPPORT_GPU
200 181
201 static void test_texture_backed(skiatest::Reporter* reporter, 182 static void test_texture_backed(skiatest::Reporter* reporter,
202 const sk_sp<SkSpecialImage>& orig, 183 const sk_sp<SkSpecialImage>& orig,
203 const sk_sp<SkSpecialImage>& gpuBacked) { 184 const sk_sp<SkSpecialImage>& gpuBacked) {
204 REPORTER_ASSERT(reporter, gpuBacked); 185 REPORTER_ASSERT(reporter, gpuBacked);
205 REPORTER_ASSERT(reporter, gpuBacked->isTextureBacked()); 186 REPORTER_ASSERT(reporter, gpuBacked->isTextureBacked());
206 REPORTER_ASSERT(reporter, gpuBacked->uniqueID() == orig->uniqueID()); 187 REPORTER_ASSERT(reporter, gpuBacked->uniqueID() == orig->uniqueID());
207 REPORTER_ASSERT(reporter, gpuBacked->subset().width() == orig->subset().widt h() && 188 REPORTER_ASSERT(reporter, gpuBacked->subset().width() == orig->subset().widt h() &&
208 gpuBacked->subset().height() == orig->subset().hei ght()); 189 gpuBacked->subset().height() == orig->subset().hei ght());
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 test_image(subSImg1, reporter, context, true, kPad, kFullSize); 284 test_image(subSImg1, reporter, context, true, kPad, kFullSize);
304 } 285 }
305 286
306 { 287 {
307 sk_sp<SkSpecialImage> subSImg2(fullSImg->makeSubset(subset)); 288 sk_sp<SkSpecialImage> subSImg2(fullSImg->makeSubset(subset));
308 test_image(subSImg2, reporter, context, true, kPad, kFullSize); 289 test_image(subSImg2, reporter, context, true, kPad, kFullSize);
309 } 290 }
310 } 291 }
311 292
312 #endif 293 #endif
OLDNEW
« no previous file with comments | « src/core/SkSpecialImage.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698