Hash :
25390156
Author :
Date :
2025-08-21T00:13:19
Suppress unsafe buffers on a file-by-file basis in src/ [1 of N] In this CL, we suppress many files but stop short of actually enabling the warning by not removing the line from the unsafe_buffers_paths.txt file. That will happen in a follow-on CL, along with resolving any stragglers missed here. This is mostly a manual change so as to familiarize myself with the kinds of issues faced by the Angle codebase when applying buffer safety warnings. -- Re-generate affected hashes. -- Clang-format applied to all changed files. -- Add a few missing .reserve() calls to vectors as noticed. -- Fix some mismatches between file names and header comments. -- Be more consistent with header comment format (blank lines and trailing //-only lines when a filename comment adjoins license boilerplate). Bug: b/436880895 Change-Id: I3bde5cc2059acbe8345057289214f1a26f1c34aa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6869022 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507
//
// Copyright 2023 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// LoadToNative_unittest.cpp: Unit tests for pixel loading functions.
#ifdef UNSAFE_BUFFERS_BUILD
# pragma allow_unsafe_buffers
#endif
#include <gmock/gmock.h>
#include <vector>
#include "common/debug.h"
#include "common/mathutil.h"
#include "image_util/loadimage.h"
using namespace angle;
using namespace testing;
namespace
{
template <typename Type>
void initializeRGBInput(std::vector<Type> &rgbInput,
size_t width,
size_t height,
size_t depth,
size_t inputPixelBytes,
size_t inputByteOffset,
size_t inputRowPitch,
size_t inputDepthPitch)
{
ASSERT(rgbInput.size() == inputDepthPitch * depth + inputByteOffset);
for (size_t z = 0; z < depth; z++)
{
for (size_t y = 0; y < height; y++)
{
for (size_t x = 0; x < width; x++)
{
size_t inputIndex =
inputByteOffset + z * inputDepthPitch + y * inputRowPitch + x * inputPixelBytes;
rgbInput[inputIndex] = x % 256;
rgbInput[inputIndex + 1] = y % 256;
rgbInput[inputIndex + 2] = z % 256;
}
}
}
}
template <typename Type, uint8_t fourthValue>
void verifyRGBToRGBAResults(const char *strCase,
std::vector<Type> &rgbInput,
std::vector<Type> &rgbaOutput,
size_t width,
size_t height,
size_t depth,
size_t inputPixelBytes,
size_t inputByteOffset,
size_t inputRowPitch,
size_t inputDepthPitch,
size_t outputPixelBytes,
size_t outputByteOffset,
size_t outputRowPitch,
size_t outputDepthPitch)
{
ASSERT(rgbInput.size() == inputDepthPitch * depth + inputByteOffset);
ASSERT(rgbaOutput.size() == outputDepthPitch * depth + outputByteOffset);
for (size_t z = 0; z < depth; z++)
{
for (size_t y = 0; y < height; y++)
{
for (size_t x = 0; x < width; x++)
{
size_t inputIndex =
inputByteOffset + z * inputDepthPitch + y * inputRowPitch + x * inputPixelBytes;
size_t outputIndex = outputByteOffset + z * outputDepthPitch + y * outputRowPitch +
x * outputPixelBytes;
bool rMatch = rgbInput[inputIndex] == rgbaOutput[outputIndex];
bool gMatch = rgbInput[inputIndex + 1] == rgbaOutput[outputIndex + 1];
bool bMatch = rgbInput[inputIndex + 2] == rgbaOutput[outputIndex + 2];
bool aMatch = rgbaOutput[outputIndex + 3] == fourthValue;
EXPECT_TRUE(rMatch && gMatch && bMatch && aMatch)
<< "Case " << strCase << ": Mismatch at Index (" << x << ", " << y << ", " << z
<< ")" << std::endl
<< "Expected output: (" << static_cast<uint32_t>(rgbInput[inputIndex]) << ", "
<< static_cast<uint32_t>(rgbInput[inputIndex + 1]) << ", "
<< static_cast<uint32_t>(rgbInput[inputIndex + 2]) << ", "
<< static_cast<uint32_t>(fourthValue) << ")" << std::endl
<< "Actual output: (" << static_cast<uint32_t>(rgbaOutput[outputIndex]) << ", "
<< static_cast<uint32_t>(rgbaOutput[outputIndex + 1]) << ", "
<< static_cast<uint32_t>(rgbaOutput[outputIndex + 2]) << ", "
<< static_cast<uint32_t>(rgbaOutput[outputIndex + 3]) << ")";
}
}
}
}
template <uint8_t fourthValue>
void TestLoadUbyteRGBToRGBA(ImageLoadContext &context,
const char *strCase,
size_t width,
size_t height,
size_t depth,
size_t inputByteOffset,
size_t outputByteOffset,
size_t inputRowAlignment)
{
constexpr uint8_t kInitialByteValue = 0xAA;
size_t inputPixelBytes = 3;
size_t inputRowPitch = rx::roundUpPow2(width * inputPixelBytes, inputRowAlignment);
size_t inputDepthPitch = height * inputRowPitch;
size_t inputActualBytes = depth * inputDepthPitch;
size_t outputPixelBytes = 4;
size_t outputRowPitch = width * outputPixelBytes;
size_t outputDepthPitch = height * outputRowPitch;
size_t outputActualBytes = depth * outputDepthPitch;
// Prepare the RGB input and RGBA output for copy. The offset values are used to add unused
// bytes to the beginning of the input and output data, in order to test address alignments.
std::vector<uint8_t> rgbInput(inputByteOffset + inputActualBytes, kInitialByteValue);
initializeRGBInput<uint8_t>(rgbInput, width, height, depth, inputPixelBytes, inputByteOffset,
inputRowPitch, inputDepthPitch);
std::vector<uint8_t> rgbaOutput(outputByteOffset + outputActualBytes, kInitialByteValue);
// Call loading function.
LoadToNative3To4<uint8_t, fourthValue>(
context, width, height, depth, rgbInput.data() + inputByteOffset, inputRowPitch,
inputDepthPitch, rgbaOutput.data() + outputByteOffset, outputRowPitch, outputDepthPitch);
// Compare the input and output data.
verifyRGBToRGBAResults<uint8_t, fourthValue>(
strCase, rgbInput, rgbaOutput, width, height, depth, inputPixelBytes, inputByteOffset,
inputRowPitch, inputDepthPitch, outputPixelBytes, outputByteOffset, outputRowPitch,
outputDepthPitch);
}
template <uint8_t fourthValue>
void TestLoadSbyteRGBToRGBA(ImageLoadContext &context,
const char *strCase,
size_t width,
size_t height,
size_t depth,
size_t inputByteOffset,
size_t outputByteOffset,
size_t inputRowAlignment)
{
constexpr int8_t kInitialByteValue = 0xAA;
size_t inputPixelBytes = 3;
size_t inputRowPitch = rx::roundUpPow2(width * inputPixelBytes, inputRowAlignment);
size_t inputDepthPitch = height * inputRowPitch;
size_t inputActualBytes = depth * inputDepthPitch;
size_t outputPixelBytes = 4;
size_t outputRowPitch = width * outputPixelBytes;
size_t outputDepthPitch = height * outputRowPitch;
size_t outputActualBytes = depth * outputDepthPitch;
// Prepare the RGB input and RGBA output for copy. The offset values are used to add unused
// bytes to the beginning of the input and output data, in order to test address alignments.
std::vector<int8_t> rgbInput(inputByteOffset + inputActualBytes, kInitialByteValue);
initializeRGBInput<int8_t>(rgbInput, width, height, depth, inputPixelBytes, inputByteOffset,
inputRowPitch, inputDepthPitch);
std::vector<int8_t> rgbaOutput(outputByteOffset + outputActualBytes, kInitialByteValue);
// Call loading function.
LoadToNative3To4<int8_t, fourthValue>(
context, width, height, depth,
reinterpret_cast<uint8_t *>(rgbInput.data() + inputByteOffset), inputRowPitch,
inputDepthPitch, reinterpret_cast<uint8_t *>(rgbaOutput.data() + outputByteOffset),
outputRowPitch, outputDepthPitch);
// Compare the input and output data.
verifyRGBToRGBAResults<int8_t, fourthValue>(strCase, rgbInput, rgbaOutput, width, height, depth,
inputPixelBytes, inputByteOffset, inputRowPitch,
inputDepthPitch, outputPixelBytes, outputByteOffset,
outputRowPitch, outputDepthPitch);
}
void TestLoadByteRGBToRGBAForAllCases(ImageLoadContext &context,
size_t inputCase,
size_t width,
size_t height,
size_t depth,
size_t inputByteOffset,
size_t outputByteOffset,
size_t inputRowAlignment)
{
std::string strCaseUFF = "UFF_" + std::to_string(inputCase);
TestLoadUbyteRGBToRGBA<0xFF>(context, strCaseUFF.c_str(), width, height, depth, inputByteOffset,
outputByteOffset, inputRowAlignment);
std::string strCaseU01 = "U01_" + std::to_string(inputCase);
TestLoadUbyteRGBToRGBA<0x01>(context, strCaseU01.c_str(), width, height, depth, inputByteOffset,
outputByteOffset, inputRowAlignment);
std::string strCaseS7F = "S7F_" + std::to_string(inputCase);
TestLoadSbyteRGBToRGBA<0x7F>(context, strCaseS7F.c_str(), width, height, depth, inputByteOffset,
outputByteOffset, inputRowAlignment);
std::string strCaseS01 = "S01_" + std::to_string(inputCase);
TestLoadSbyteRGBToRGBA<0x01>(context, strCaseS01.c_str(), width, height, depth, inputByteOffset,
outputByteOffset, inputRowAlignment);
}
// Tests the ubyte (0xFF) RGB to RGBA loading function for one RGB pixel.
TEST(LoadToNative3To4, LoadUbyteRGBToRGBADataOnePixelWithFourthCompOfFF)
{
ImageLoadContext context;
uint8_t rgbInput[] = {1, 2, 3};
uint8_t rgbaOutput[] = {0, 0, 0, 0};
constexpr uint8_t kFourthValue = 0xFF;
LoadToNative3To4<uint8_t, kFourthValue>(context, 1, 1, 1, rgbInput, 3, 3, rgbaOutput, 4, 4);
EXPECT_TRUE(rgbaOutput[0] == rgbInput[0] && rgbaOutput[1] == rgbInput[1] &&
rgbaOutput[2] == rgbInput[2] && rgbaOutput[3] == kFourthValue)
<< "Pixel mismatch";
}
// Tests the ubyte (0x01) RGB to RGBA loading function for one RGB pixel.
TEST(LoadToNative3To4, LoadUbyteRGBToRGBADataOnePixelWithFourthCompOf01)
{
ImageLoadContext context;
uint8_t rgbInput[] = {1, 2, 3};
uint8_t rgbaOutput[] = {0, 0, 0, 0};
constexpr uint8_t kFourthValue = 0x01;
LoadToNative3To4<uint8_t, kFourthValue>(context, 1, 1, 1, rgbInput, 3, 3, rgbaOutput, 4, 4);
EXPECT_TRUE(rgbaOutput[0] == rgbInput[0] && rgbaOutput[1] == rgbInput[1] &&
rgbaOutput[2] == rgbInput[2] && rgbaOutput[3] == kFourthValue)
<< "Pixel mismatch";
}
// Tests the sbyte (0x7F) RGB to RGBA loading function for one RGB pixel.
TEST(LoadToNative3To4, LoadSbyteRGBToRGBADataOnePixelWithFourthCompOf7F)
{
ImageLoadContext context;
int8_t rgbInput[] = {1, 2, 3};
int8_t rgbaOutput[] = {0, 0, 0, 0};
constexpr uint8_t kFourthValue = 0x01;
LoadToNative3To4<int8_t, kFourthValue>(context, 1, 1, 1, reinterpret_cast<uint8_t *>(rgbInput),
3, 3, reinterpret_cast<uint8_t *>(rgbaOutput), 4, 4);
EXPECT_TRUE(rgbaOutput[0] == rgbInput[0] && rgbaOutput[1] == rgbInput[1] &&
rgbaOutput[2] == rgbInput[2] && rgbaOutput[3] == static_cast<int8_t>(kFourthValue))
<< "Pixel mismatch";
}
// Tests the sbyte (0x01) RGB to RGBA loading function for one RGB pixel.
TEST(LoadToNative3To4, LoadSbyteRGBToRGBADataOnePixelWithFourthCompOf01)
{
ImageLoadContext context;
int8_t rgbInput[] = {1, 2, 3};
int8_t rgbaOutput[] = {0, 0, 0, 0};
constexpr uint8_t kFourthValue = 0x01;
LoadToNative3To4<int8_t, kFourthValue>(context, 1, 1, 1, reinterpret_cast<uint8_t *>(rgbInput),
3, 3, reinterpret_cast<uint8_t *>(rgbaOutput), 4, 4);
EXPECT_TRUE(rgbaOutput[0] == rgbInput[0] && rgbaOutput[1] == rgbInput[1] &&
rgbaOutput[2] == rgbInput[2] && rgbaOutput[3] == static_cast<int8_t>(kFourthValue))
<< "Pixel mismatch";
}
// Tests the ubyte (0xFF) RGB to RGBA loading function for 4 RGB pixels, which should be read
// together.
TEST(LoadToNative3To4, LoadUbyteRGBToRGBADataFourPixelsWithFourthCompOfFF)
{
ImageLoadContext context;
constexpr uint8_t kPixelCount = 4;
std::vector<uint8_t> rgbInput(kPixelCount * 3);
std::vector<uint8_t> rgbaOutput(kPixelCount * 4, 0);
size_t index = 0;
for (auto &inputComponent : rgbInput)
{
inputComponent = ++index;
}
constexpr uint8_t kFourthValue = 0xFF;
LoadToNative3To4<uint8_t, kFourthValue>(context, 4, 1, 1, rgbInput.data(), 3, 3,
rgbaOutput.data(), 4, 4);
for (index = 0; index < kPixelCount; index++)
{
EXPECT_TRUE(rgbaOutput[index * 4] == rgbInput[index * 3] &&
rgbaOutput[index * 4 + 1] == rgbInput[index * 3 + 1] &&
rgbaOutput[index * 4 + 2] == rgbInput[index * 3 + 2] &&
rgbaOutput[index * 4 + 3] == kFourthValue)
<< "Mismatch at pixel " << index;
}
}
// Tests the ubyte (0x01) RGB to RGBA loading function for 4 RGB pixels, which should be read
// together.
TEST(LoadToNative3To4, LoadUbyteRGBToRGBADataFourPixelsWithFourthCompOf01)
{
ImageLoadContext context;
constexpr uint8_t kPixelCount = 4;
std::vector<uint8_t> rgbInput(kPixelCount * 3);
std::vector<uint8_t> rgbaOutput(kPixelCount * 4, 0);
size_t index = 0;
for (auto &inputComponent : rgbInput)
{
inputComponent = ++index;
}
constexpr uint8_t kFourthValue = 0x01;
LoadToNative3To4<uint8_t, kFourthValue>(context, 4, 1, 1, rgbInput.data(), 3, 3,
rgbaOutput.data(), 4, 4);
for (index = 0; index < kPixelCount; index++)
{
EXPECT_TRUE(rgbaOutput[index * 4] == rgbInput[index * 3] &&
rgbaOutput[index * 4 + 1] == rgbInput[index * 3 + 1] &&
rgbaOutput[index * 4 + 2] == rgbInput[index * 3 + 2] &&
rgbaOutput[index * 4 + 3] == kFourthValue)
<< "Mismatch at pixel " << index;
}
}
// Tests the sbyte (0x7F) RGB to RGBA loading function for 4 RGB pixels, which should be read
// together.
TEST(LoadToNative3To4, LoadSbyteRGBToRGBADataFourPixelsWithFourthCompOf7F)
{
ImageLoadContext context;
constexpr uint8_t kPixelCount = 4;
std::vector<int8_t> rgbInput(kPixelCount * 3);
std::vector<int8_t> rgbaOutput(kPixelCount * 4, 0);
size_t index = 0;
for (auto &inputComponent : rgbInput)
{
inputComponent = ++index;
}
constexpr uint8_t kFourthValue = 0x01;
LoadToNative3To4<int8_t, kFourthValue>(context, 4, 1, 1,
reinterpret_cast<uint8_t *>(rgbInput.data()), 3, 3,
reinterpret_cast<uint8_t *>(rgbaOutput.data()), 4, 4);
for (index = 0; index < kPixelCount; index++)
{
EXPECT_TRUE(rgbaOutput[index * 4] == rgbInput[index * 3] &&
rgbaOutput[index * 4 + 1] == rgbInput[index * 3 + 1] &&
rgbaOutput[index * 4 + 2] == rgbInput[index * 3 + 2] &&
rgbaOutput[index * 4 + 3] == static_cast<int8_t>(kFourthValue))
<< "Mismatch at pixel " << index;
}
}
// Tests the sbyte (0x01) RGB to RGBA loading function for 4 RGB pixels, which should be read
// together.
TEST(LoadToNative3To4, LoadSbyteRGBToRGBADataFourPixelsWithFourthCompOf01)
{
ImageLoadContext context;
constexpr uint8_t kPixelCount = 4;
std::vector<int8_t> rgbInput(kPixelCount * 3);
std::vector<int8_t> rgbaOutput(kPixelCount * 4, 0);
size_t index = 0;
for (auto &inputComponent : rgbInput)
{
inputComponent = ++index;
}
constexpr uint8_t kFourthValue = 0x01;
LoadToNative3To4<int8_t, kFourthValue>(context, 4, 1, 1,
reinterpret_cast<uint8_t *>(rgbInput.data()), 3, 3,
reinterpret_cast<uint8_t *>(rgbaOutput.data()), 4, 4);
for (index = 0; index < kPixelCount; index++)
{
EXPECT_TRUE(rgbaOutput[index * 4] == rgbInput[index * 3] &&
rgbaOutput[index * 4 + 1] == rgbInput[index * 3 + 1] &&
rgbaOutput[index * 4 + 2] == rgbInput[index * 3 + 2] &&
rgbaOutput[index * 4 + 3] == static_cast<int8_t>(kFourthValue))
<< "Mismatch at pixel " << index;
}
}
// Tests the byte RGB to RGBA loading function when the width is 4-byte aligned. This loading
// function can copy 4 bytes at a time in a row.
TEST(LoadToNative3To4, LoadByteRGBToRGBADataAlignedWidth)
{
ImageLoadContext context;
size_t alignedTestWidths[] = {4, 20, 128, 1000, 4096};
for (auto &width : alignedTestWidths)
{
ASSERT(width % 4 == 0);
TestLoadByteRGBToRGBAForAllCases(context, width, width, 3, 1, 0, 0, 1);
}
}
// Tests the byte RGB to RGBA loading function when the width is not 4-byte aligned, which will
// cause the loading function to copy some bytes in the beginning and end of some rows individually.
TEST(LoadToNative3To4, LoadByteRGBToRGBADataUnalignedWidth)
{
ImageLoadContext context;
size_t unalignedTestWidths[] = {5, 22, 127, 1022, 4097};
for (auto &width : unalignedTestWidths)
{
ASSERT(width % 4 != 0);
TestLoadByteRGBToRGBAForAllCases(context, width, width, 3, 1, 0, 0, 1);
}
}
// Tests the byte RGB to RGBA loading function when there is depth.
TEST(LoadToNative3To4, LoadByteRGBToRGBADataWithDepth)
{
ImageLoadContext context;
size_t unalignedTestDepths[] = {3};
for (auto &depth : unalignedTestDepths)
{
TestLoadByteRGBToRGBAForAllCases(context, depth, 3, 3, depth, 0, 0, 1);
}
}
// Tests the byte RGB to RGBA loading function when the width is less than 4 bytes. Therefore the
// loading function will copy data one byte at a time.
TEST(LoadToNative3To4, LoadByteRGBToRGBADataWidthLessThanUint32)
{
ImageLoadContext context;
size_t smallTestWidths[] = {1, 2, 3};
for (auto &width : smallTestWidths)
{
TestLoadByteRGBToRGBAForAllCases(context, width, width, 3, 1, 0, 0, 1);
}
}
// Tests the byte RGB to RGBA loading function when when the width is 4-byte-aligned and the input
// address has an offset.
TEST(LoadToNative3To4, LoadByteRGBToRGBAWithAlignedWidthAndInputAddressOffset)
{
ImageLoadContext context;
size_t inputOffsetList[] = {1, 2, 3};
for (auto &inputOffset : inputOffsetList)
{
TestLoadByteRGBToRGBAForAllCases(context, inputOffset, 8, 8, 1, inputOffset, 0, 1);
}
}
// Tests the byte RGB to RGBA loading function when when the width is not 4-byte-aligned and the
// input address has an offset.
TEST(LoadToNative3To4, LoadByteRGBToRGBAWithUnalignedWidthAndInputAddressOffset)
{
ImageLoadContext context;
size_t inputOffsetList[] = {1, 2, 3};
for (auto &inputOffset : inputOffsetList)
{
TestLoadByteRGBToRGBAForAllCases(context, inputOffset, 7, 7, 1, inputOffset, 0, 1);
}
}
// Tests the byte RGB to RGBA loading function when the width is 4-byte-aligned and the output
// address has an offset.
TEST(LoadToNative3To4, LoadByteRGBToRGBAWithAlignedWidthAndOutputAddressOffset)
{
ImageLoadContext context;
size_t outputOffsetList[] = {1, 2, 3};
for (auto &outputOffset : outputOffsetList)
{
TestLoadByteRGBToRGBAForAllCases(context, outputOffset, 8, 8, 1, 0, outputOffset, 1);
}
}
// Tests the byte RGB to RGBA loading function when the width is not 4-byte-aligned and the output
// address has an offset.
TEST(LoadToNative3To4, LoadByteRGBToRGBAWithUnalignedWidthAndOutputAddressOffset)
{
ImageLoadContext context;
size_t outputOffsetList[] = {1, 2, 3};
for (auto &outputOffset : outputOffsetList)
{
TestLoadByteRGBToRGBAForAllCases(context, outputOffset, 7, 7, 1, 0, outputOffset, 1);
}
}
// Tests the byte RGB to RGBA loading function when the width is 4-byte-aligned and the input row
// alignment is 4.
TEST(LoadToNative3To4, LoadByteRGBToRGBAWithAlignedWidthAndAlignment4)
{
ImageLoadContext context;
size_t inputRowAlignmentList[] = {4};
for (auto &alignment : inputRowAlignmentList)
{
TestLoadByteRGBToRGBAForAllCases(context, alignment, 4, 4, 1, 0, 0, alignment);
}
}
// Tests the byte RGB to RGBA loading function when the width is not 4-byte-aligned and the input
// row alignment is 4.
TEST(LoadToNative3To4, LoadByteRGBToRGBAWithUnalignedWidthAndAlignment4)
{
ImageLoadContext context;
size_t inputRowAlignmentList[] = {4};
for (auto &alignment : inputRowAlignmentList)
{
TestLoadByteRGBToRGBAForAllCases(context, alignment, 5, 5, 1, 0, 0, alignment);
}
}
} // namespace