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

Unified Diff: tests/SerializationTest.cpp

Issue 2063793002: API change to allow for NormalSource selection at the user level. (Closed) Base URL: https://skia.googlesource.com/skia@dvonbeck-normal-factor-out
Patch Set: Fixed CPU behavior when normal.Z=-1 Created 4 years, 6 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
« src/core/SkNormalSource.cpp ('K') | « src/core/SkNormalSource.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SerializationTest.cpp
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index e4e1a7acd7b0e0f1a408362ca846ccaadfac55ca..1e96eefd54c007ee4da5761b63cc9b5198bd0591 100644
--- a/tests/SerializationTest.cpp
+++ b/tests/SerializationTest.cpp
@@ -7,6 +7,7 @@
#include "Resources.h"
#include "SkAnnotationKeys.h"
+#include "SkBitmapProcShader.h"
#include "SkCanvas.h"
#include "SkFixed.h"
#include "SkFontDescriptor.h"
@@ -14,6 +15,7 @@
#include "SkImageSource.h"
#include "SkLightingShader.h"
#include "SkMallocPixelRef.h"
+#include "SkNormalSource.h"
#include "SkOSFile.h"
#include "SkPictureRecorder.h"
#include "SkTableColorFilter.h"
@@ -573,13 +575,18 @@ DEF_TEST(Serialization, reporter) {
SkRect r = SkRect::MakeWH(SkIntToScalar(kTexSize), SkIntToScalar(kTexSize));
matrix.setRectToRect(bitmapBounds, r, SkMatrix::kFill_ScaleToFit);
- SkVector invNormRotation = { SkScalarSqrt(0.3f), SkScalarSqrt(0.7f) };
+ SkMatrix ctm;
+ ctm.setRotate(45);
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);
+ sk_sp<SkShader> normalMap = SkMakeBitmapShader(normals, SkShader::kClamp_TileMode,
+ SkShader::kClamp_TileMode, &matrix, nullptr);
+ sk_sp<SkNormalSource> normalSource = SkNormalSource::MakeFromNormalMap(std::move(normalMap),
+ ctm);
+ sk_sp<SkShader> lightingShader = SkLightingShader::Make(diffuse, fLights, &matrix,
+ std::move(normalSource));
SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get(), true, reporter));
// TODO test equality?
« src/core/SkNormalSource.cpp ('K') | « src/core/SkNormalSource.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698