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

Side by Side Diff: tests/SpecialImageTest.cpp

Issue 1762013002: Swap over to using SkImageFilter::filterImage instead of filterImageDeprecated (Closed) Base URL: https://skia.googlesource.com/skia.git@if-fragment
Patch Set: Fix no-GPU build Created 4 years, 9 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 | « tests/ImageFilterTest.cpp ('k') | tests/TestingSpecialImageAccess.h » ('j') | 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkImage.h" 10 #include "SkImage.h"
11 #include "SkSpecialImage.h" 11 #include "SkSpecialImage.h"
12 #include "SkSpecialSurface.h" 12 #include "SkSpecialSurface.h"
13 #include "Test.h" 13 #include "Test.h"
14 #include "TestingSpecialImageAccess.h"
14 15
15 #if SK_SUPPORT_GPU 16 #if SK_SUPPORT_GPU
16 #include "GrContext.h" 17 #include "GrContext.h"
17 #endif 18 #endif
18 19
19 class TestingSpecialImageAccess {
20 public:
21 static const SkIRect& Subset(const SkSpecialImage* img) {
22 return img->subset();
23 }
24
25 static bool PeekPixels(const SkSpecialImage* img, SkPixmap* pixmap) {
26 return img->peekPixels(pixmap);
27 }
28
29 static GrTexture* PeekTexture(const SkSpecialImage* img) {
30 return img->peekTexture();
31 }
32 };
33 20
34 // This test creates backing resources exactly sized to [kFullSize x kFullSize]. 21 // This test creates backing resources exactly sized to [kFullSize x kFullSize].
35 // It then wraps them in an SkSpecialImage with only the center (red) region bei ng active. 22 // It then wraps them in an SkSpecialImage with only the center (red) region bei ng active.
36 // It then draws the SkSpecialImage to a full sized (all blue) canvas and checks that none 23 // It then draws the SkSpecialImage to a full sized (all blue) canvas and checks that none
37 // of the inactive (green) region leaked out. 24 // of the inactive (green) region leaked out.
38 25
39 static const int kSmallerSize = 10; 26 static const int kSmallerSize = 10;
40 static const int kPad = 3; 27 static const int kPad = 3;
41 static const int kFullSize = kSmallerSize + 2 * kPad; 28 static const int kFullSize = kSmallerSize + 2 * kPad;
42 29
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 130
144 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller Size); 131 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller Size);
145 132
146 SkAutoTUnref<SkSpecialImage> img(SkSpecialImage::NewFromGpu(nullptr, subset, 133 SkAutoTUnref<SkSpecialImage> img(SkSpecialImage::NewFromGpu(nullptr, subset,
147 kNeedNewImageUni queID_SpecialImage, 134 kNeedNewImageUni queID_SpecialImage,
148 texture)); 135 texture));
149 test_image(img, reporter, false, true); 136 test_image(img, reporter, false, true);
150 } 137 }
151 138
152 #endif 139 #endif
OLDNEW
« no previous file with comments | « tests/ImageFilterTest.cpp ('k') | tests/TestingSpecialImageAccess.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698