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

Unified Diff: src/effects/SkLightingShader.cpp

Issue 1270533003: Minor cleanup of SkLightingShader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 5 years, 5 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 | src/ports/SkGlobalInitialization_chromium.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkLightingShader.cpp
diff --git a/src/effects/SkLightingShader.cpp b/src/effects/SkLightingShader.cpp
index 7dcba959416751a22327e4a2186e3125dc23b30c..7b55626f55a3d5ae5e6b287b5fe74c17be40b65d 100644
--- a/src/effects/SkLightingShader.cpp
+++ b/src/effects/SkLightingShader.cpp
@@ -15,7 +15,7 @@
#include "SkReadBuffer.h"
#include "SkWriteBuffer.h"
-///////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////
/*
SkLightingShader TODOs:
@@ -93,7 +93,7 @@ public:
};
SK_TO_STRING_OVERRIDE()
- SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(LightingShader)
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLightingShaderImpl)
protected:
void flatten(SkWriteBuffer&) const override;
@@ -105,6 +105,8 @@ private:
SkLightingShader::Light fLight;
SkColor fAmbientColor; // linear (unpremul) color
+ friend class SkLightingShader;
+
typedef SkShader INHERITED;
};
@@ -447,9 +449,9 @@ void SkLightingShaderImpl::LightingShaderContext::shadeSpan(int x, int y,
for (int i = 0; i < n; ++i) {
SkASSERT(0xFF == SkColorGetA(tmpNormal2[i])); // opaque -> unpremul
- norm.set(SkIntToScalar(SkColorGetR(tmpNormal2[i]))-127.0f,
- SkIntToScalar(SkColorGetG(tmpNormal2[i]))-127.0f,
- SkIntToScalar(SkColorGetB(tmpNormal2[i]))-127.0f);
+ norm.set(SkIntToScalar(SkGetPackedR32(tmpNormal2[i]))-127.0f,
+ SkIntToScalar(SkGetPackedG32(tmpNormal2[i]))-127.0f,
+ SkIntToScalar(SkGetPackedB32(tmpNormal2[i]))-127.0f);
norm.normalize();
SkColor diffColor = SkUnPreMultiply::PMColorToColor(tmpColor2[i]);
@@ -582,3 +584,9 @@ SkShader* SkLightingShader::Create(const SkBitmap& diffuse, const SkBitmap& norm
}
///////////////////////////////////////////////////////////////////////////////
+
+SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader)
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl)
+SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
+
+///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « no previous file | src/ports/SkGlobalInitialization_chromium.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698