aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SerializationTest.cpp
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2016-06-15 14:28:17 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-15 14:28:18 -0700
commit4132de7069b0088665af52ffea3a42b055f51b79 (patch)
tree1fdb5f8f93dcb02779d796fee39de9f5ec1c68c8 /tests/SerializationTest.cpp
parent963632f686cd642344429f64e6a53262fe592828 (diff)
Revert of Refactoring of GPU NormalMap handling out into its own class (patchset #9 id:160001 of https://codereview.chromium.org/2043393002/ )
Reason for revert: break deps roll Original issue's description: > Refactoring of GPU NormalMap handling out into its own class. > > The purpose of this change is to refactor the handling of normal maps out of SkLightingShader, laying the groundwork to eventually allow for multiple normal sources. > > What this CL includes: > > - Created a new 'NormalMapFP', out of the existing normal map reading behavior in LightingFP. > > - Encapsulates this new fragment processor on a new class NormalMapSource. > > - Created a NormalSource abstraction that will interface with SkLightingShader. > > - Adapted SkLightingShader to use the normals from its NormalSource field ON THE GPU SIDE. No changes done to the CPU side yet. > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2043393002 > > Committed: https://skia.googlesource.com/skia/+/87b0dd00cf9409c5fc990f5d0bb7c0df837f08da > Committed: https://skia.googlesource.com/skia/+/a7d1e2a57aef2aa4913d4380646d60bbab761318 TBR=reed@google.com,dvonbeck@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review-Url: https://codereview.chromium.org/2068983005
Diffstat (limited to 'tests/SerializationTest.cpp')
-rw-r--r--tests/SerializationTest.cpp43
1 files changed, 2 insertions, 41 deletions
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index e4e1a7acd7..9e9b221cd2 100644
--- a/tests/SerializationTest.cpp
+++ b/tests/SerializationTest.cpp
@@ -5,14 +5,13 @@
* found in the LICENSE file.
*/
-#include "Resources.h"
#include "SkAnnotationKeys.h"
+#include "Resources.h"
#include "SkCanvas.h"
#include "SkFixed.h"
#include "SkFontDescriptor.h"
#include "SkImage.h"
#include "SkImageSource.h"
-#include "SkLightingShader.h"
#include "SkMallocPixelRef.h"
#include "SkOSFile.h"
#include "SkPictureRecorder.h"
@@ -22,7 +21,6 @@
#include "SkWriteBuffer.h"
#include "SkValidatingReadBuffer.h"
#include "SkXfermodeImageFilter.h"
-#include "sk_tool_utils.h"
#include "Test.h"
static const uint32_t kArraySize = 64;
@@ -184,8 +182,8 @@ static T* TestFlattenableSerialization(T* testObj, bool shouldSucceed,
size_t bytesWritten = writer.bytesWritten();
REPORTER_ASSERT(reporter, SkAlign4(bytesWritten) == bytesWritten);
- SkASSERT(bytesWritten <= 4096);
unsigned char dataWritten[4096];
+ SkASSERT(bytesWritten <= sizeof(dataWritten));
writer.writeToMemory(dataWritten);
// Make sure this fails when it should (test with smaller size, but still multiple of 4)
@@ -548,43 +546,6 @@ DEF_TEST(Serialization, reporter) {
}
TestPictureTypefaceSerialization(reporter);
-
- // Test SkLightingShader/NormalMapSource serialization
- {
- const int kTexSize = 2;
-
- SkLights::Builder builder;
-
- builder.add(SkLights::Light(SkColor3f::Make(1.0f, 1.0f, 1.0f),
- SkVector3::Make(1.0f, 0.0f, 0.0f)));
- builder.add(SkLights::Light(SkColor3f::Make(0.2f, 0.2f, 0.2f)));
-
- sk_sp<SkLights> fLights = builder.finish();
-
- SkBitmap diffuse = sk_tool_utils::create_checkerboard_bitmap(
- kTexSize, kTexSize,
- sk_tool_utils::color_to_565(0x0),
- sk_tool_utils::color_to_565(0xFF804020),
- 8);
-
- SkRect bitmapBounds = SkRect::MakeIWH(diffuse.width(), diffuse.height());
-
- SkMatrix matrix;
- SkRect r = SkRect::MakeWH(SkIntToScalar(kTexSize), SkIntToScalar(kTexSize));
- matrix.setRectToRect(bitmapBounds, r, SkMatrix::kFill_ScaleToFit);
-
- SkVector invNormRotation = { SkScalarSqrt(0.3f), SkScalarSqrt(0.7f) };
- SkBitmap normals;
- normals.allocN32Pixels(kTexSize, kTexSize);
-
- sk_tool_utils::create_frustum_normal_map(&normals, SkIRect::MakeWH(kTexSize, kTexSize));
- sk_sp<SkShader> lightingShader = SkLightingShader::Make(diffuse, normals, fLights,
- invNormRotation, &matrix, &matrix);
-
- SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get(), true, reporter));
- // TODO test equality?
-
- }
}
///////////////////////////////////////////////////////////////////////////////////////////////////