| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "core/fxcodec/codec/codec_int.h" | 9 #include "core/fxcodec/codec/codec_int.h" |
| 10 #include "testing/fx_string_testhelpers.h" | 10 #include "testing/fx_string_testhelpers.h" |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 y.prec = 8; | 489 y.prec = 8; |
| 490 y.bpp = 8; | 490 y.bpp = 8; |
| 491 opj_image_t img; | 491 opj_image_t img; |
| 492 memset(&img, 0, sizeof(img)); | 492 memset(&img, 0, sizeof(img)); |
| 493 img.numcomps = 3; | 493 img.numcomps = 3; |
| 494 img.color_space = OPJ_CLRSPC_SYCC; | 494 img.color_space = OPJ_CLRSPC_SYCC; |
| 495 img.comps = FX_Alloc(opj_image_comp_t, 3); | 495 img.comps = FX_Alloc(opj_image_comp_t, 3); |
| 496 const struct { | 496 const struct { |
| 497 OPJ_UINT32 w; | 497 OPJ_UINT32 w; |
| 498 bool expected; | 498 bool expected; |
| 499 } cases[] = {{0, false}, {1, false}, {30, false}, {31, true}, | 499 } cases[] = {{0, false}, {1, false}, {30, false}, {31, true}, |
| 500 {32, true}, {33, true}, {34, false}, {UINT_MAX, false}}; | 500 {32, true}, {33, false}, {34, false}, {UINT_MAX, false}}; |
| 501 for (int i = 0; i < sizeof(cases) / sizeof(cases[0]); ++i) { | 501 for (int i = 0; i < sizeof(cases) / sizeof(cases[0]); ++i) { |
| 502 y.w = cases[i].w; | 502 y.w = cases[i].w; |
| 503 y.h = y.w; | 503 y.h = y.w; |
| 504 img.x1 = y.w; | 504 img.x1 = y.w; |
| 505 img.y1 = y.h; | 505 img.y1 = y.h; |
| 506 y.data = FX_Alloc(OPJ_INT32, y.w * y.h); | 506 y.data = FX_Alloc(OPJ_INT32, y.w * y.h); |
| 507 memset(y.data, 1, y.w * y.h * sizeof(OPJ_INT32)); | 507 memset(y.data, 1, y.w * y.h * sizeof(OPJ_INT32)); |
| 508 u.data = FX_Alloc(OPJ_INT32, u.w * u.h); | 508 u.data = FX_Alloc(OPJ_INT32, u.w * u.h); |
| 509 memset(u.data, 0, u.w * u.h * sizeof(OPJ_INT32)); | 509 memset(u.data, 0, u.w * u.h * sizeof(OPJ_INT32)); |
| 510 v.data = FX_Alloc(OPJ_INT32, v.w * v.h); | 510 v.data = FX_Alloc(OPJ_INT32, v.w * v.h); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 523 EXPECT_NE(img.comps[0].h, img.comps[1].h); | 523 EXPECT_NE(img.comps[0].h, img.comps[1].h); |
| 524 EXPECT_NE(img.comps[0].w, img.comps[2].w); | 524 EXPECT_NE(img.comps[0].w, img.comps[2].w); |
| 525 EXPECT_NE(img.comps[0].h, img.comps[2].h); | 525 EXPECT_NE(img.comps[0].h, img.comps[2].h); |
| 526 } | 526 } |
| 527 FX_Free(img.comps[0].data); | 527 FX_Free(img.comps[0].data); |
| 528 FX_Free(img.comps[1].data); | 528 FX_Free(img.comps[1].data); |
| 529 FX_Free(img.comps[2].data); | 529 FX_Free(img.comps[2].data); |
| 530 } | 530 } |
| 531 FX_Free(img.comps); | 531 FX_Free(img.comps); |
| 532 } | 532 } |
| OLD | NEW |