OLD | NEW |
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" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 kSmallerSize+kPad-1)); | 103 kSmallerSize+kPad-1)); |
104 REPORTER_ASSERT(reporter, SK_ColorBLUE == bm.getColor(kSmallerSize+kPad, | 104 REPORTER_ASSERT(reporter, SK_ColorBLUE == bm.getColor(kSmallerSize+kPad, |
105 kSmallerSize+kPad)); | 105 kSmallerSize+kPad)); |
106 } | 106 } |
107 | 107 |
108 DEF_TEST(SpecialImage_Raster, reporter) { | 108 DEF_TEST(SpecialImage_Raster, reporter) { |
109 SkBitmap bm = create_bm(); | 109 SkBitmap bm = create_bm(); |
110 | 110 |
111 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller
Size); | 111 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller
Size); |
112 | 112 |
113 SkAutoTUnref<SkSpecialImage> img(SkSpecialImage::NewFromRaster(subset, bm)); | 113 SkAutoTUnref<SkSpecialImage> img(SkSpecialImage::NewFromRaster(nullptr, subs
et, bm)); |
114 test_image(img, reporter, true, false); | 114 test_image(img, reporter, true, false); |
115 } | 115 } |
116 | 116 |
117 DEF_TEST(SpecialImage_Image, reporter) { | 117 DEF_TEST(SpecialImage_Image, reporter) { |
118 SkBitmap bm = create_bm(); | 118 SkBitmap bm = create_bm(); |
119 | 119 |
120 SkAutoTUnref<SkImage> fullImage(SkImage::NewFromBitmap(bm)); | 120 SkAutoTUnref<SkImage> fullImage(SkImage::NewFromBitmap(bm)); |
121 | 121 |
122 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller
Size); | 122 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller
Size); |
123 | 123 |
(...skipping 12 matching lines...) Expand all Loading... |
136 desc.fHeight = kFullSize; | 136 desc.fHeight = kFullSize; |
137 | 137 |
138 SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(de
sc, false, | 138 SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(de
sc, false, |
139 bm
.getPixels(), 0)); | 139 bm
.getPixels(), 0)); |
140 if (!texture) { | 140 if (!texture) { |
141 return; | 141 return; |
142 } | 142 } |
143 | 143 |
144 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller
Size); | 144 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller
Size); |
145 | 145 |
146 SkAutoTUnref<SkSpecialImage> img(SkSpecialImage::NewFromGpu(subset, texture)
); | 146 SkAutoTUnref<SkSpecialImage> img(SkSpecialImage::NewFromGpu(nullptr, subset,
|
| 147 kNeedNewImageUni
queID_SpecialImage, |
| 148 texture)); |
147 test_image(img, reporter, false, true); | 149 test_image(img, reporter, false, true); |
148 } | 150 } |
149 | 151 |
150 #endif | 152 #endif |
OLD | NEW |