31 if (smaller->
size() > larger->
size()) {
35 size_t size_diff = larger->
size() -
size;
36 for (
size_t i = 0;
i <= size_diff; ++
i) {
49 INFOF(r,
"\n%s: Resource '%s' can not be found.\n",
62 const char test[] =
"SkPDF_JpegEmbedTest";
68 if (!mandrillData || !cmykData || !yuvICCData || !cmykICCData) {
75 SkCanvas* canvas = document->beginPage(642, 2048);
99 #ifndef SK_PDF_BASE85_BINARY
137 SkISize jpegSize = codec->dimensions();
152DEF_TEST(SkPDF_JpegIdentification, r) {
158 {
"images/color_wheel.jpg",
true, SkJFIFInfo::kYCbCr},
160 {
"images/mandrill_512_q075.jpg",
true, SkJFIFInfo::kYCbCr},
161 {
"images/randPixels.jpg",
true, SkJFIFInfo::kYCbCr}};
168 bool isJfif = SkIsJFIF(
data.get(), &
info);
169 if (isJfif != kTests[
i].isJfif) {
170 ERRORF(r,
"%s failed isJfif test", kTests[
i].
path);
177 ERRORF(r,
"%s failed jfif type test", kTests[
i].
path);
180 INFOF(r,
"\nJpegIdentification: %s [%d x %d]\n", kTests[
i].
path,
181 info.fSize.width(),
info.fSize.height());
187 static const char goodJpeg[] =
188 "\377\330\377\340\0\20JFIF\0\1\1\0\0\1\0\1\0\0\377\333\0C\0\20\13\14"
189 "\16\14\n\20\16\r\16\22\21\20\23\30(\32\30\26\26\0301#%\35(:3=<9387"
190 "@H\\N@DWE78PmQW_bghg>Mqypdx\\egc\377\333\0C\1\21\22\22\30\25\30/\32"
191 "\32/cB8Bcccccccccccccccccccccccccccccccccccccccccccccccccc\377\300"
192 "\0\21\10\0\10\0\10\3\1\"\0\2\21\1\3\21\1\377\304\0\37\0\0\1\5\1\1\1"
193 "\1\1\1\0\0\0\0\0\0\0\0\1\2\3\4\5\6\7\10\t\n\13\377\304\0\265\20\0\2"
194 "\1\3\3\2\4\3\5\5\4\4\0\0\1}\1\2\3\0\4\21\5\22!1A\6\23Qa\7\"q\0242\201"
195 "\221\241\10#B\261\301\25R\321\360$3br\202\t\n\26\27\30\31\32%&'()*"
196 "456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz\203\204\205\206\207\210\211"
197 "\212\222\223\224\225\226\227\230\231\232\242\243\244\245\246\247\250"
198 "\251\252\262\263\264\265\266\267\270\271\272\302\303\304\305\306\307"
199 "\310\311\312\322\323\324\325\326\327\330\331\332\341\342\343\344\345"
200 "\346\347\350\351\352\361\362\363\364\365\366\367\370\371\372\377\304"
201 "\0\37\1\0\3\1\1\1\1\1\1\1\1\1\0\0\0\0\0\0\1\2\3\4\5\6\7\10\t\n\13\377"
202 "\304\0\265\21\0\2\1\2\4\4\3\4\7\5\4\4\0\1\2w\0\1\2\3\21\4\5!1\6\22"
203 "AQ\7aq\23\"2\201\10\24B\221\241\261\301\t#3R\360\25br\321\n\26$4\341"
204 "%\361\27\30\31\32&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz\202\203"
205 "\204\205\206\207\210\211\212\222\223\224\225\226\227\230\231\232\242"
206 "\243\244\245\246\247\250\251\252\262\263\264\265\266\267\270\271\272"
207 "\302\303\304\305\306\307\310\311\312\322\323\324\325\326\327\330\331"
208 "\332\342\343\344\345\346\347\350\351\352\362\363\364\365\366\367\370"
209 "\371\372\377\332\0\14\3\1\0\2\21\3\21\0?\0\216M\352\214\25\271\224"
210 "\262\310\253\363tl\22209\35O~\237\\\24QZ\306Mh\216\252i\364ml\177\377"
212 size_t goodJpegLength = 659;
240 static const char jpeg[] =
241 "\377\330\377\340\0\20JFIX\0\1\1\0\0\1\0\1\0\0\377\333\0C\0\10\6\6\7"
242 "\6\5\10\7\7\7\t\t\10\n\14\24\r\14\13\13\14\31\22\23\17\24\35\32\37"
243 "\36\35\32\34\34 $.' \",#\34\34(7),01444\37'9=82<.342\377\333\0C\1\t"
244 "\t\t\14\13\14\30\r\r\0302!\34!222222222222222222222222222222222222"
245 "22222222222222\377\300\0\21\10\2\0\2\0\3\1\"\0\2\21\1\3\21\001";
246 size_t jpegLength = 177;
252 static const char jpeg[] =
253 "\377\330\377\340\0\5JFIF\0\1\1\0\0\1\0\1\0\0\377\333\0C\0\10\6\6\7"
254 "\6\5\10\7\7\7\t\t\10\n\14\24\r\14\13\13\14\31\22\23\17\24\35\32\37"
255 "\36\35\32\34\34 $.' \",#\34\34(7),01444\37'9=82<.342\377\333\0C\1\t"
256 "\t\t\14\13\14\30\r\r\0302!\34!222222222222222222222222222222222222"
257 "22222222222222\377\300\0\21\10\2\0\2\0\3\1\"\0\2\21\1\3\21\001";
258 size_t jpegLength = 177;
264 static const char jpeg[] =
265 "\377\330\377\340\0\20JFIF\0\1\1\0\0\1\0\1\0\0\377\333\0C\0\10\6\6\7"
266 "\6\5\10\7\7\7\t\t\10\n\14\24\r\14\13\13\14\31\22\23\17\24\35\32\37"
267 "\36\35\32\34\34 $.' \",#\34\34(7),01444\37'9=82<.342\377\333\0C\1\t"
268 "\t\t\14\13\14\30\r\r\0302!\34!222222222222222222222222222222222222"
269 "22222222222222\377\300\0\5\10\2\0\2\0\3\1\"\0\2\21\1\3\21\001";
270 size_t jpegLength = 177;
276 static const char jpeg[] =
277 "\377\330\377\340\0\20JFIF\0\1\1\0\0\1\0\1\0\0\377\333\0C\0\10\6\6\7"
278 "\6\5\10\7\7\7\t\t\10\n\14\24\r\14\13\13\14\31\22\23\17\24\35\32\37"
279 "\36\35\32\34\34 $.' \",#\34\34(7),01444\37'9=82<.342\377\333\0C\1\t"
280 "\t\t\14\13\14\30\r\r\0302!\34!222222222222222222222222222222222222"
281 "22222222222222\377\300\0\21\14\2\0\2\0\3\1\"\0\2\21\1\3\21\001";
282 size_t jpegLength = 177;
288 static const char jpeg[] =
289 "\377\330\377\340\0\20JFIF\0\1\1\0\0\1\0\1\0\0\377\333\0C\0\10\6\6\7"
290 "\6\5\10\7\7\7\t\t\10\n\14\24\r\14\13\13\14\31\22\23\17\24\35\32\37"
291 "\36\35\32\34\34 $.' \",#\34\34(7),01444\37'9=82<.342\377\333\0C\1\t"
292 "\t\t\14\13\14\30\r\r\0302!\34!222222222222222222222222222222222222"
293 "22222222222222\377\300\0\21\10\2\0\2\0\2\1\"\0\2\21\1\3\21\001";
294 size_t jpegLength = 177;
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static sk_sp< SkData > load_resource(skiatest::Reporter *r, const char *test, const char *filename)
DEF_TEST(SkPDF_JpegEmbedTest, r)
static bool is_subset_of(SkData *smaller, SkData *larger)
sk_sp< SkData > GetResourceAsData(const char *resource)
constexpr SkColor SK_ColorLTGRAY
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
@ kTopLeft_SkEncodedOrigin
sk_sp< T > sk_ref_sp(T *obj)
#define REPORTER_ASSERT(r, cond,...)
#define REQUIRE_PDF_DOCUMENT(TEST_NAME, REPORTER)
#define INFOF(REPORTER,...)
void drawRect(const SkRect &rect, const SkPaint &paint)
void clear(SkColor color)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
static std::unique_ptr< SkCodec > MakeFromData(sk_sp< SkData >, SkSpan< const SkCodecs::Decoder > decoders, SkPngChunkReader *=nullptr)
static sk_sp< SkData > MakeWithoutCopy(const void *data, size_t length)
const uint8_t * bytes() const
const void * data() const
sk_sp< SkData > detachAsData()
static const SkEncodedInfo & GetEncodedInfo(SkCodec &)
void setColor(SkColor color)
SK_API sk_sp< SkImage > DeferredFromEncodedData(sk_sp< SkData > encoded, std::optional< SkAlphaType > alphaType=std::nullopt)
constexpr SkCodecs::Decoder Decoder()
SK_API sk_sp< SkDocument > MakeDocument(SkWStream *stream, const Metadata &metadata)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
std::shared_ptr< const fml::Mapping > data