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

Unified Diff: src/core/SkMaskFilter.cpp

Issue 109823012: Pass ctm when performing image filtering in GPU backend. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Rob's comments Created 6 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 | « include/core/SkMaskFilter.h ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMaskFilter.cpp
diff --git a/src/core/SkMaskFilter.cpp b/src/core/SkMaskFilter.cpp
index 1bc17bb47fa69da7cfbee04104dff76d56f5bb2a..ebcdbea4d2818a01681dc26c01dc73706b15a98b 100644
--- a/src/core/SkMaskFilter.cpp
+++ b/src/core/SkMaskFilter.cpp
@@ -298,7 +298,7 @@ SkMaskFilter::filterRectsToNine(const SkRect[], int count, const SkMatrix&,
}
#if SK_SUPPORT_GPU
-bool SkMaskFilter::asNewEffect(GrEffectRef** effect, GrTexture*) const {
+bool SkMaskFilter::asNewEffect(GrEffectRef** effect, GrTexture*, const SkMatrix&) const {
return false;
}
@@ -309,58 +309,9 @@ bool SkMaskFilter::canFilterMaskGPU(const SkRect& devBounds,
return false;
}
-bool SkMaskFilter::filterMaskGPU(GrContext* context,
- const SkBitmap& srcBM,
- const SkRect& maskRect,
- SkBitmap* resultBM) const {
- SkAutoTUnref<GrTexture> src;
- bool canOverwriteSrc = false;
- if (NULL == srcBM.getTexture()) {
- GrTextureDesc desc;
- // Needs to be a render target to be overwritten in filterMaskGPU
- desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit;
- desc.fConfig = SkBitmapConfig2GrPixelConfig(srcBM.config());
- desc.fWidth = srcBM.width();
- desc.fHeight = srcBM.height();
-
- // TODO: right now this is exact to guard against out of bounds reads
- // by the filter code. More thought needs to be devoted to the
- // "filterMaskGPU" contract and then enforced (i.e., clamp the code
- // in "filterMaskGPU" so it never samples beyond maskRect)
- GrAutoScratchTexture ast(context, desc, GrContext::kExact_ScratchTexMatch);
- if (NULL == ast.texture()) {
- return false;
- }
-
- SkAutoLockPixels alp(srcBM);
- ast.texture()->writePixels(0, 0, srcBM.width(), srcBM.height(),
- desc.fConfig,
- srcBM.getPixels(), srcBM.rowBytes());
-
- src.reset(ast.detach());
- canOverwriteSrc = true;
- } else {
- src.reset((GrTexture*) srcBM.getTexture());
- src.get()->ref();
- }
- GrTexture* dst;
-
- bool result = this->filterMaskGPU(src, maskRect, &dst, canOverwriteSrc);
- if (!result) {
- return false;
- }
- SkAutoUnref aur(dst);
-
- SkImageInfo info;
- resultBM->setConfig(srcBM.config(), dst->width(), dst->height());
- if (!resultBM->asImageInfo(&info)) {
- return false;
- }
- resultBM->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, dst)))->unref();
- return true;
-}
bool SkMaskFilter::filterMaskGPU(GrTexture* src,
+ const SkMatrix& ctm,
const SkRect& maskRect,
GrTexture** result,
bool canOverwriteSrc) const {
« no previous file with comments | « include/core/SkMaskFilter.h ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698