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

Unified Diff: tests/FloatingPointTextureTest.cpp

Issue 871623002: Move FP texture test buffers to heap. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/FloatingPointTextureTest.cpp
diff --git a/tests/FloatingPointTextureTest.cpp b/tests/FloatingPointTextureTest.cpp
index 346c7379929be483060ab118f0ae2c341f285f4e..15f2e2eafa61601c05a79d6866dbe560d5718a7e 100644
--- a/tests/FloatingPointTextureTest.cpp
+++ b/tests/FloatingPointTextureTest.cpp
@@ -28,8 +28,10 @@ static const float kMaxIntegerRepresentableInSPFloatingPoint = 16777216; // 2 ^
static const SkIRect DEV_RECT = SkIRect::MakeWH(DEV_W, DEV_H);
DEF_GPUTEST(FloatingPointTextureTest, reporter, factory) {
- float controlPixelData[FP_CONTROL_ARRAY_SIZE];
- float readBuffer[FP_CONTROL_ARRAY_SIZE];
+ SkTDArray<float> controlPixelData, readBuffer;
+ controlPixelData.setCount(FP_CONTROL_ARRAY_SIZE);
+ readBuffer.setCount(FP_CONTROL_ARRAY_SIZE);
+
for (int i = 0; i < FP_CONTROL_ARRAY_SIZE; i += 4) {
controlPixelData[i] = FLT_MIN;
controlPixelData[i + 1] = FLT_MAX;
@@ -70,8 +72,8 @@ DEF_GPUTEST(FloatingPointTextureTest, reporter, factory) {
}
// write square
- fpTexture->writePixels(0, 0, DEV_W, DEV_H, desc.fConfig, controlPixelData, 0);
- fpTexture->readPixels(0, 0, DEV_W, DEV_H, desc.fConfig, readBuffer, 0);
+ fpTexture->writePixels(0, 0, DEV_W, DEV_H, desc.fConfig, controlPixelData.begin(), 0);
+ fpTexture->readPixels(0, 0, DEV_W, DEV_H, desc.fConfig, readBuffer.begin(), 0);
for (int j = 0; j < FP_CONTROL_ARRAY_SIZE; ++j) {
REPORTER_ASSERT(reporter, readBuffer[j] == controlPixelData[j]);
}
@@ -82,8 +84,10 @@ DEF_GPUTEST(FloatingPointTextureTest, reporter, factory) {
static const int HALF_CONTROL_ARRAY_SIZE = DEV_W * DEV_H;
DEF_GPUTEST(HalfFloatTextureTest, reporter, factory) {
- SkHalf controlPixelData[HALF_CONTROL_ARRAY_SIZE];
- SkHalf readBuffer[HALF_CONTROL_ARRAY_SIZE];
+ SkTDArray<SkHalf> controlPixelData, readBuffer;
+ controlPixelData.setCount(HALF_CONTROL_ARRAY_SIZE);
+ readBuffer.setCount(HALF_CONTROL_ARRAY_SIZE);
+
for (int i = 0; i < HALF_CONTROL_ARRAY_SIZE; i += 4) {
controlPixelData[i] = SK_HalfMin;
controlPixelData[i + 1] = SK_HalfMax;
@@ -124,8 +128,8 @@ DEF_GPUTEST(HalfFloatTextureTest, reporter, factory) {
}
// write square
- fpTexture->writePixels(0, 0, DEV_W, DEV_H, desc.fConfig, controlPixelData, 0);
- fpTexture->readPixels(0, 0, DEV_W, DEV_H, desc.fConfig, readBuffer, 0);
+ fpTexture->writePixels(0, 0, DEV_W, DEV_H, desc.fConfig, controlPixelData.begin(), 0);
+ fpTexture->readPixels(0, 0, DEV_W, DEV_H, desc.fConfig, readBuffer.begin(), 0);
for (int j = 0; j < HALF_CONTROL_ARRAY_SIZE; ++j) {
REPORTER_ASSERT(reporter, readBuffer[j] == controlPixelData[j]);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698