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

Unified Diff: src/effects/SkLightingImageFilter.cpp

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 years, 8 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 | « src/effects/SkGpuBlurUtils.cpp ('k') | src/effects/SkLumaColorFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkLightingImageFilter.cpp
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index 1f120c04666ee788abcb7aca1f5a710bf1d2cab2..3c4391b634c255ab9cc364edcb9e38bee1130e12 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -327,7 +327,7 @@ protected:
virtual GrFragmentProcessor* getFragmentProcessor(GrTexture*,
const SkMatrix&,
const SkIRect& bounds,
- BoundaryMode boundaryMode) const = 0;
+ BoundaryMode boundaryMode, GrRenderTarget* dst) const = 0;
#endif
private:
#if SK_SUPPORT_GPU
@@ -352,16 +352,18 @@ void SkLightingImageFilterInternal::drawRect(GrDrawContext* drawContext,
const SkIRect& bounds) const {
SkRect srcRect = dstRect.makeOffset(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()));
GrPaint paint;
- GrFragmentProcessor* fp = this->getFragmentProcessor(src, matrix, bounds, boundaryMode);
+ GrFragmentProcessor* fp = this->getFragmentProcessor(src,
+ matrix, bounds, boundaryMode, drawContext->rt_remove_me());
paint.addColorFragmentProcessor(fp)->unref();
drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect);
}
+
bool SkLightingImageFilterInternal::filterImageGPU(Proxy* proxy,
const SkBitmap& src,
const Context& ctx,
- SkBitmap* result,
- SkIPoint* offset) const {
+ SkBitmap* result, SkIPoint* offset) const {
+
SkBitmap input = src;
SkIPoint srcOffset = SkIPoint::Make(0, 0);
if (!this->filterInputGPU(0, proxy, src, ctx, &input, &srcOffset)) {
@@ -424,6 +426,7 @@ bool SkLightingImageFilterInternal::filterImageGPU(Proxy* proxy,
this->drawRect(drawContext, srcTexture, matrix, clip, bottom, kBottom_BoundaryMode, bounds);
this->drawRect(drawContext, srcTexture, matrix, clip, bottomRight,
kBottomRight_BoundaryMode, bounds);
+
WrapTexture(dst, bounds.width(), bounds.height(), result);
return true;
}
@@ -447,7 +450,7 @@ protected:
SkBitmap* result, SkIPoint* offset) const override;
#if SK_SUPPORT_GPU
GrFragmentProcessor* getFragmentProcessor(GrTexture*, const SkMatrix&, const SkIRect& bounds,
- BoundaryMode) const override;
+ BoundaryMode, GrRenderTarget* dst) const override;
#endif
private:
@@ -474,8 +477,8 @@ protected:
bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
SkBitmap* result, SkIPoint* offset) const override;
#if SK_SUPPORT_GPU
- GrFragmentProcessor* getFragmentProcessor(GrTexture*, const SkMatrix&, const SkIRect& bounds,
- BoundaryMode) const override;
+ GrFragmentProcessor* getFragmentProcessor(GrTexture*, const SkMatrix&,
+ const SkIRect& bounds, BoundaryMode, GrRenderTarget* dst) const override;
#endif
private:
@@ -489,8 +492,8 @@ private:
class GrLightingEffect : public GrSingleTextureEffect {
public:
- GrLightingEffect(GrTexture* texture, const SkImageFilterLight* light, SkScalar surfaceScale,
- const SkMatrix& matrix, BoundaryMode boundaryMode);
+ GrLightingEffect(GrTexture* texture, const SkImageFilterLight* light,
+ SkScalar surfaceScale, const SkMatrix& matrix, BoundaryMode boundaryMode, GrRenderTarget* dst);
virtual ~GrLightingEffect();
const SkImageFilterLight* light() const { return fLight; }
@@ -522,8 +525,9 @@ public:
SkScalar surfaceScale,
const SkMatrix& matrix,
SkScalar kd,
- BoundaryMode boundaryMode) {
- return new GrDiffuseLightingEffect(texture, light, surfaceScale, matrix, kd, boundaryMode);
+ BoundaryMode boundaryMode, GrRenderTarget* dst) {
+ return new GrDiffuseLightingEffect(texture, light, surfaceScale, matrix,
+ kd, boundaryMode, dst);
}
const char* name() const override { return "DiffuseLighting"; }
@@ -542,7 +546,7 @@ private:
SkScalar surfaceScale,
const SkMatrix& matrix,
SkScalar kd,
- BoundaryMode boundaryMode);
+ BoundaryMode boundaryMode, GrRenderTarget* dst);
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
typedef GrLightingEffect INHERITED;
@@ -557,9 +561,9 @@ public:
const SkMatrix& matrix,
SkScalar ks,
SkScalar shininess,
- BoundaryMode boundaryMode) {
- return new GrSpecularLightingEffect(texture, light, surfaceScale, matrix, ks, shininess,
- boundaryMode);
+ BoundaryMode boundaryMode, GrRenderTarget* dst) {
+ return new GrSpecularLightingEffect(texture, light, surfaceScale, matrix,
+ ks, shininess, boundaryMode, dst);
}
const char* name() const override { return "SpecularLighting"; }
@@ -580,7 +584,7 @@ private:
const SkMatrix& matrix,
SkScalar ks,
SkScalar shininess,
- BoundaryMode boundaryMode);
+ BoundaryMode boundaryMode, GrRenderTarget* dst);
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
typedef GrLightingEffect INHERITED;
@@ -1252,11 +1256,11 @@ GrFragmentProcessor* SkDiffuseLightingImageFilter::getFragmentProcessor(
GrTexture* texture,
const SkMatrix& matrix,
const SkIRect&,
- BoundaryMode boundaryMode
-) const {
+ BoundaryMode boundaryMode,
+ GrRenderTarget* dst) const {
SkScalar scale = SkScalarMul(this->surfaceScale(), SkIntToScalar(255));
- return GrDiffuseLightingEffect::Create(texture, this->light(), scale, matrix, this->kd(),
- boundaryMode);
+ return GrDiffuseLightingEffect::Create(texture, this->light(), scale, matrix,
+ this->kd(), boundaryMode, dst);
}
#endif
@@ -1394,10 +1398,10 @@ GrFragmentProcessor* SkSpecularLightingImageFilter::getFragmentProcessor(
GrTexture* texture,
const SkMatrix& matrix,
const SkIRect&,
- BoundaryMode boundaryMode) const {
+ BoundaryMode boundaryMode, GrRenderTarget* dst) const {
SkScalar scale = SkScalarMul(this->surfaceScale(), SkIntToScalar(255));
- return GrSpecularLightingEffect::Create(texture, this->light(), scale, matrix, this->ks(),
- this->shininess(), boundaryMode);
+ return GrSpecularLightingEffect::Create(texture, this->light(), scale, matrix,
+ this->ks(), this->shininess(), boundaryMode, dst);
}
#endif
@@ -1573,8 +1577,8 @@ GrLightingEffect::GrLightingEffect(GrTexture* texture,
const SkImageFilterLight* light,
SkScalar surfaceScale,
const SkMatrix& matrix,
- BoundaryMode boundaryMode)
- : INHERITED(texture, GrCoordTransform::MakeDivByTextureWHMatrix(texture))
+ BoundaryMode boundaryMode, GrRenderTarget* dst)
+ : INHERITED(texture, GrCoordTransform::MakeDivByTextureWHMatrix(texture), kLocal_GrCoordSet, dst)
, fLight(light)
, fSurfaceScale(surfaceScale)
, fFilterMatrix(matrix)
@@ -1603,8 +1607,8 @@ GrDiffuseLightingEffect::GrDiffuseLightingEffect(GrTexture* texture,
SkScalar surfaceScale,
const SkMatrix& matrix,
SkScalar kd,
- BoundaryMode boundaryMode)
- : INHERITED(texture, light, surfaceScale, matrix, boundaryMode), fKD(kd) {
+ BoundaryMode boundaryMode, GrRenderTarget* dst)
+ : INHERITED(texture, light, surfaceScale, matrix, boundaryMode, dst), fKD(kd) {
this->initClassID<GrDiffuseLightingEffect>();
}
@@ -1635,7 +1639,7 @@ const GrFragmentProcessor* GrDiffuseLightingEffect::TestCreate(GrProcessorTestDa
}
BoundaryMode mode = static_cast<BoundaryMode>(d->fRandom->nextU() % kBoundaryModeCount);
return GrDiffuseLightingEffect::Create(d->fTextures[GrProcessorUnitTest::kAlphaTextureIdx],
- light, surfaceScale, matrix, kd, mode);
+ light, surfaceScale, matrix, kd, mode, NULL);
}
@@ -1801,8 +1805,8 @@ GrSpecularLightingEffect::GrSpecularLightingEffect(GrTexture* texture,
const SkMatrix& matrix,
SkScalar ks,
SkScalar shininess,
- BoundaryMode boundaryMode)
- : INHERITED(texture, light, surfaceScale, matrix, boundaryMode)
+ BoundaryMode boundaryMode, GrRenderTarget* dst)
+ : INHERITED(texture, light, surfaceScale, matrix, boundaryMode, dst)
, fKS(ks)
, fShininess(shininess) {
this->initClassID<GrSpecularLightingEffect>();
@@ -1837,7 +1841,7 @@ const GrFragmentProcessor* GrSpecularLightingEffect::TestCreate(GrProcessorTestD
}
BoundaryMode mode = static_cast<BoundaryMode>(d->fRandom->nextU() % kBoundaryModeCount);
return GrSpecularLightingEffect::Create(d->fTextures[GrProcessorUnitTest::kAlphaTextureIdx],
- light, surfaceScale, matrix, ks, shininess, mode);
+ light, surfaceScale, matrix, ks, shininess, mode, NULL);
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/effects/SkGpuBlurUtils.cpp ('k') | src/effects/SkLumaColorFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698