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

Side by Side Diff: src/core/SkImageFilter.cpp

Issue 1813813002: Add SkSpecialImage::makeTextureImage entry point & update filterInput (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix possible nullptr dereference Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/core/SkSpecialImage.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The Android Open Source Project 2 * Copyright 2012 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkImageFilter.h" 8 #include "SkImageFilter.h"
9 #include "SkImageFilterCacheKey.h" 9 #include "SkImageFilterCacheKey.h"
10 10
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 589
590 SkSpecialImage* SkImageFilter::filterInput(int index, 590 SkSpecialImage* SkImageFilter::filterInput(int index,
591 SkSpecialImage* src, 591 SkSpecialImage* src,
592 const Context& ctx, 592 const Context& ctx,
593 SkIPoint* offset) const { 593 SkIPoint* offset) const {
594 SkImageFilter* input = this->getInput(index); 594 SkImageFilter* input = this->getInput(index);
595 if (!input) { 595 if (!input) {
596 return SkRef(src); 596 return SkRef(src);
597 } 597 }
598 598
599 return input->filterImage(src, this->mapContext(ctx), offset); 599 SkAutoTUnref<SkSpecialImage> result(input->filterImage(src, this->mapContext (ctx), offset));
600
601 #if SK_SUPPORT_GPU
602 if (src->peekTexture() && result && !result->peekTexture()) {
603 // Keep the result on the GPU - this is still required for some
604 // image filters that don't support GPU in all cases
605 GrContext* context = src->peekTexture()->getContext();
606 return result->makeTextureImage(src->internal_getProxy(), context).relea se();
607 }
608 #endif
609
610 return result.release();
600 } 611 }
601 612
602 #if SK_SUPPORT_GPU 613 #if SK_SUPPORT_GPU
603 614
604 bool SkImageFilter::filterInputGPUDeprecated(int index, SkImageFilter::Proxy* pr oxy, 615 bool SkImageFilter::filterInputGPUDeprecated(int index, SkImageFilter::Proxy* pr oxy,
605 const SkBitmap& src, const Context& ctx, 616 const SkBitmap& src, const Context& ctx,
606 SkBitmap* result, SkIPoint* offset) const { 617 SkBitmap* result, SkIPoint* offset) const {
607 SkImageFilter* input = this->getInput(index); 618 SkImageFilter* input = this->getInput(index);
608 if (!input) { 619 if (!input) {
609 return true; 620 return true;
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 } 822 }
812 return dev; 823 return dev;
813 } 824 }
814 825
815 bool SkImageFilter::DeviceProxy::filterImage(const SkImageFilter* filter, const SkBitmap& src, 826 bool SkImageFilter::DeviceProxy::filterImage(const SkImageFilter* filter, const SkBitmap& src,
816 const SkImageFilter::Context& ctx, 827 const SkImageFilter::Context& ctx,
817 SkBitmap* result, SkIPoint* offset) { 828 SkBitmap* result, SkIPoint* offset) {
818 return fDevice->filterImage(filter, src, ctx, result, offset); 829 return fDevice->filterImage(filter, src, ctx, result, offset);
819 } 830 }
820 831
OLDNEW
« no previous file with comments | « no previous file | src/core/SkSpecialImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698