Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1697)

Issue 5720060: Refactor Gaussian blur and morphology into GrContext (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 8 months ago by Stephen White
Modified:
12 years, 8 months ago
Reviewers:
bsalomon
CC:
skia-review_google.com
Base URL:
http://skia.googlecode.com/svn/trunk/
Visibility:
Public.

Description

These functions don't really belong in SkGpuDevice.

Patch Set 1 #

Total comments: 5

Patch Set 2 : Make 1D morphology and convolution passes internal to GrContext #

Unified diffs Side-by-side diffs Delta from patch set Stats (+279 lines, -273 lines) Patch
M include/gpu/GrContext.h View 1 2 chunks +34 lines, -24 lines 0 comments Download
M src/gpu/GrContext.cpp View 1 3 chunks +229 lines, -43 lines 0 comments Download
M src/gpu/SkGpuDevice.cpp View 1 5 chunks +16 lines, -206 lines 0 comments Download

Messages

Total messages: 7
Stephen White
12 years, 8 months ago (2012-03-02 22:35:14 UTC) #1
bsalomon
http://codereview.appspot.com/5720060/diff/1/include/gpu/GrContext.h File include/gpu/GrContext.h (right): http://codereview.appspot.com/5720060/diff/1/include/gpu/GrContext.h#newcode593 include/gpu/GrContext.h:593: GrAutoScratchTexture* temp1, Why does this take GrASTs while the ...
12 years, 8 months ago (2012-03-05 14:44:16 UTC) #2
Stephen White
Thanks for your comments. http://codereview.appspot.com/5720060/diff/1/include/gpu/GrContext.h File include/gpu/GrContext.h (right): http://codereview.appspot.com/5720060/diff/1/include/gpu/GrContext.h#newcode593 include/gpu/GrContext.h:593: GrAutoScratchTexture* temp1, On 2012/03/05 14:44:17, ...
12 years, 8 months ago (2012-03-05 15:33:02 UTC) #3
bsalomon
http://codereview.appspot.com/5720060/diff/1/include/gpu/GrContext.h File include/gpu/GrContext.h (right): http://codereview.appspot.com/5720060/diff/1/include/gpu/GrContext.h#newcode593 include/gpu/GrContext.h:593: GrAutoScratchTexture* temp1, On 2012/03/05 15:33:02, Stephen White wrote: > ...
12 years, 8 months ago (2012-03-05 15:54:05 UTC) #4
Stephen White
On 2012/03/05 15:54:05, bsalomon wrote: > http://codereview.appspot.com/5720060/diff/1/include/gpu/GrContext.h > File include/gpu/GrContext.h (right): > > http://codereview.appspot.com/5720060/diff/1/include/gpu/GrContext.h#newcode593 > ...
12 years, 8 months ago (2012-03-05 16:41:28 UTC) #5
bsalomon
On 2012/03/05 16:41:28, Stephen White wrote: > On 2012/03/05 15:54:05, bsalomon wrote: > > http://codereview.appspot.com/5720060/diff/1/include/gpu/GrContext.h ...
12 years, 8 months ago (2012-03-05 16:52:43 UTC) #6
Stephen White
12 years, 8 months ago (2012-03-05 22:51:09 UTC) #7
On 2012/03/05 16:52:43, bsalomon wrote:
> On 2012/03/05 16:41:28, Stephen White wrote:
> > On 2012/03/05 15:54:05, bsalomon wrote:
> > > http://codereview.appspot.com/5720060/diff/1/include/gpu/GrContext.h
> > > File include/gpu/GrContext.h (right):
> > > 
> > >
> >
>
http://codereview.appspot.com/5720060/diff/1/include/gpu/GrContext.h#newcode593
> > > include/gpu/GrContext.h:593: GrAutoScratchTexture* temp1,
> > > On 2012/03/05 15:33:02, Stephen White wrote:
> > > > On 2012/03/05 14:44:17, bsalomon wrote:
> > > > > Why does this take GrASTs while the morphology takes GrTextures? More
> > > broadly,
> > > > > is there an advantage to having the caller provide the textures?
> > > > 
> > > > The blur needs to grow its temporary textures by a variable margin in
> order
> > to
> > > > accommodate scaling and/or convolution margins which the caller doesn't
> > know;
> > > > the morphology doesn't.
> > > > 
> > > > I'd like just to return a GrTexture*, do all allocation of temporaries
> > > > internally, and not require the caller to allocate anything, but the
> > > refcounting
> > > > is a little murky.  E.g., I could just ref whatever I return (so it
> doesn't
> > > get
> > > > freed inadvertently), but then the srcTexture would have two refs, while
a
> > > > temporary would only have one.  That's probably still the right thing to
> do,
> > > > though.  What do you think?
> > > 
> > > 
> > > Maybe we new class (or replacement for GrAutoScratchTexture) that can
> properly
> > > release a texture from two possible creations types:
> > > 
> > > 1) just passed a GrTexture, unrefs on destructor
> > > 2) cached texture initialized by GrContext:TextureCacheEntry, calls
> > > context->unlockTexture()
> > > 
> > > Then the interface could look something like
> > > 
> > > void guassianBlur(GrTexture* src, bool preserveSrc, const SkRect& rect,
> float
> > > sigmaX, float sigmaY, GrNewTextureThingy* result)
> > > 
> > > where result gets initialized in the call, either by an additional
reference
> > on
> > > src, or to a scratch texture locked by the function.
> > > 
> > >  
> > > > 
> > > > The other thing is that the scratch textures would get unlocked by
> > > > gaussianBlur() before returning, and one of them might be the return
> value. 
> > I
> > > > assume that's ok as long as I don't try to allocate anything else from
> cache
> > > > before it's used?
> > > 
> > > I think if the scratch is returned it has to remain locked until the
caller
> is
> > > done with it. In theory it could be deleted as soon as it is unlocked.
> > > 
> > > > 
> > > > > if gaussianBlur should take a enum or bool indicating whether the
> > srcTexture
> > > > > must be preserved and no textures. It would narrow the API a little
bit
> > and
> > > > > prevent some accidental bad usage (e.g. improperly sized textures or
> > > textures
> > > > > with an incorrect pixel format).
> > > > 
> > > > A good idea.  I was planning to do all of the above in a followup
change,
> > and
> > > > keep this one to simply moving code around.
> > > 
> > > That's fine to checkin as is and modify later.
> > 
> > OK, uploaded as patchset #2; PTAL (not sure if it sent an email).
> 
> 
> LGTM. It's OK to make a second anonymous namespace closer to the call site if
> you like.

Landed with r3327 (and mop-up in r3329); closed.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b