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

Issue 267923005: remove unneeded SkShader::validContext (Closed)

Created:
6 years, 7 months ago by reed2
Modified:
6 years, 7 months ago
Reviewers:
scroggo, reed1
CC:
skia-review_googlegroups.com
Visibility:
Public.

Description

remove unneeded SkShader::validContext moved to https://codereview.chromium.org/261773005

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Total comments: 16
Unified diffs Side-by-side diffs Delta from patch set Stats (+131 lines, -255 lines) Patch
M include/core/SkColorShader.h View 2 chunks +1 line, -2 lines 0 comments Download
M include/core/SkComposeShader.h View 2 chunks +1 line, -2 lines 0 comments Download
M include/core/SkEmptyShader.h View 1 2 3 3 chunks +6 lines, -12 lines 0 comments Download
M include/core/SkShader.h View 1 2 3 chunks +15 lines, -15 lines 0 comments Download
M include/effects/SkPerlinNoiseShader.h View 2 chunks +1 line, -1 line 0 comments Download
M include/effects/SkTransparentShader.h View 2 chunks +3 lines, -2 lines 2 comments Download
M src/core/SkBitmapProcShader.h View 2 chunks +1 line, -4 lines 0 comments Download
M src/core/SkBitmapProcShader.cpp View 1 1 chunk +11 lines, -24 lines 4 comments Download
M src/core/SkBlitter.cpp View 3 chunks +6 lines, -26 lines 0 comments Download
M src/core/SkComposeShader.cpp View 2 chunks +4 lines, -35 lines 4 comments Download
M src/core/SkDraw.cpp View 2 chunks +4 lines, -9 lines 2 comments Download
M src/core/SkFilterShader.h View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M src/core/SkFilterShader.cpp View 2 chunks +1 line, -9 lines 0 comments Download
M src/core/SkPictureShader.h View 3 chunks +22 lines, -21 lines 0 comments Download
M src/core/SkPictureShader.cpp View 1 chunk +21 lines, -28 lines 2 comments Download
M src/core/SkShader.cpp View 1 2 3 5 chunks +16 lines, -15 lines 2 comments Download
M src/effects/SkPerlinNoiseShader.cpp View 1 chunk +2 lines, -5 lines 0 comments Download
M src/effects/SkTransparentShader.cpp View 1 chunk +2 lines, -5 lines 0 comments Download
M src/effects/gradients/SkLinearGradient.h View 2 chunks +1 line, -1 line 0 comments Download
M src/effects/gradients/SkLinearGradient.cpp View 1 chunk +1 line, -5 lines 0 comments Download
M src/effects/gradients/SkRadialGradient.h View 2 chunks +1 line, -1 line 0 comments Download
M src/effects/gradients/SkRadialGradient.cpp View 1 chunk +1 line, -5 lines 0 comments Download
M src/effects/gradients/SkSweepGradient.h View 2 chunks +1 line, -1 line 0 comments Download
M src/effects/gradients/SkSweepGradient.cpp View 1 chunk +1 line, -5 lines 0 comments Download
M src/effects/gradients/SkTwoPointConicalGradient.h View 2 chunks +1 line, -1 line 0 comments Download
M src/effects/gradients/SkTwoPointConicalGradient.cpp View 1 chunk +2 lines, -6 lines 0 comments Download
M src/effects/gradients/SkTwoPointRadialGradient.h View 2 chunks +1 line, -2 lines 0 comments Download
M src/effects/gradients/SkTwoPointRadialGradient.cpp View 1 chunk +2 lines, -11 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
reed2
6 years, 7 months ago (2014-05-03 15:45:46 UTC) #1
scroggo
https://codereview.chromium.org/267923005/diff/60001/include/effects/SkTransparentShader.h File include/effects/SkTransparentShader.h (right): https://codereview.chromium.org/267923005/diff/60001/include/effects/SkTransparentShader.h#newcode13 include/effects/SkTransparentShader.h:13: class SK_API SkTransparentShader : public SkShader { Thoughts for ...
6 years, 7 months ago (2014-05-05 14:01:19 UTC) #2
reed1
moved to https://codereview.chromium.org/261773005
6 years, 7 months ago (2014-05-05 14:13:34 UTC) #3
reed1
6 years, 7 months ago (2014-05-05 15:10:00 UTC) #4
https://codereview.chromium.org/267923005/diff/60001/include/effects/SkTransp...
File include/effects/SkTransparentShader.h (right):

https://codereview.chromium.org/267923005/diff/60001/include/effects/SkTransp...
include/effects/SkTransparentShader.h:13: class SK_API SkTransparentShader :
public SkShader {
On 2014/05/05 14:01:19, scroggo wrote:
> Thoughts for a potential future <span id="abbrex-spnAbbr_16471"
class="abbrex-Abbr abbrex-Abbr_CL abbrex-AbbrUnknown
abbrex-AbbrUnknownVisible">CL</span>:
> 
> Do we need SkTransparentShader? I don't think Chrome or Android uses it. If we
> dropped it, I think we could drop fDevice from ContextRec.

Agreed, I bet we can remove it.

https://codereview.chromium.org/267923005/diff/60001/src/core/SkBitmapProcSha...
File src/core/SkBitmapProcShader.cpp (right):

https://codereview.chromium.org/267923005/diff/60001/src/core/SkBitmapProcSha...
src/core/SkBitmapProcShader.cpp:105: return NULL;
On 2014/05/05 14:01:19, scroggo wrote:
> Don't we need to call SkBitmapProcState's destructor here? Same with the other
> return <span id="abbrex-spnAbbr_16493" class="abbrex-Abbr abbrex-Abbr_NULL
abbrex-AbbrUnknown abbrex-AbbrUnknownVisible">NULL</span> from
computeTotalInverse. This is a good candidate for
> SkAutoTCallVProc (or SkAutoTCallIProc, which appears to be identical in
> implementation and comments).

Rearranged to fix this.

https://codereview.chromium.org/267923005/diff/60001/src/core/SkBitmapProcSha...
src/core/SkBitmapProcShader.cpp:108: // Make sure we can use totalInverse as a
cache.
On 2014/05/05 14:01:19, scroggo wrote:
> This comment no longer applies.

Done.

https://codereview.chromium.org/267923005/diff/60001/src/core/SkComposeShader...
File src/core/SkComposeShader.cpp (left):

https://codereview.chromium.org/267923005/diff/60001/src/core/SkComposeShader...
src/core/SkComposeShader.cpp:103: // TODO : must fix this to not "cheat" and
modify fPaint
On 2014/05/05 14:01:19, scroggo wrote:
> Did this get fixed? It seems like this may change the behavior.

Dang, good catch! Fill fix/restore

https://codereview.chromium.org/267923005/diff/60001/src/core/SkComposeShader...
File src/core/SkComposeShader.cpp (right):

https://codereview.chromium.org/267923005/diff/60001/src/core/SkComposeShader...
src/core/SkComposeShader.cpp:91: if (!contextA || !contextB) {
On 2014/05/05 14:01:19, scroggo wrote:
> If exactly one of these is <span id="abbrex-spnAbbr_16528" class="abbrex-Abbr
abbrex-Abbr_NULL abbrex-AbbrUnknown abbrex-AbbrUnknownVisible">NULL</span>, we
need to call the destructor on the other.

Doh! Good catch. Will fix.

https://codereview.chromium.org/267923005/diff/60001/src/core/SkDraw.cpp
File src/core/SkDraw.cpp (right):

https://codereview.chromium.org/267923005/diff/60001/src/core/SkDraw.cpp#newc...
src/core/SkDraw.cpp:2562: if (!blitter->resetShaderContext(*fBitmap, p,
*fMatrix)) {
On 2014/05/05 14:01:19, scroggo wrote:
> The SkSmallAllocator will eventually call ~Context() on whatever it points to.
> Now that it may point to NULL (since resetShaderContext can now destroy the
old
> one without creating a new one), we need to make sure we do not call
~Context()
> in that case.

Will change resetShaderContext to always have something valid in that buffer.

https://codereview.chromium.org/267923005/diff/60001/src/core/SkPictureShader...
File src/core/SkPictureShader.cpp (right):

https://codereview.chromium.org/267923005/diff/60001/src/core/SkPictureShader...
src/core/SkPictureShader.cpp:125: if (!ctx->isValid()) {
On 2014/05/05 14:01:19, scroggo wrote:
> Don't we have a general rule against creating an object that might be invalid
> and then querying it?
> 
> This could be simplified by creating the BitmapShaderContext outside of
> PictureShaderContext and passing it in.

Done.

https://codereview.chromium.org/267923005/diff/60001/src/core/SkShader.cpp
File src/core/SkShader.cpp (right):

https://codereview.chromium.org/267923005/diff/60001/src/core/SkShader.cpp#ne...
src/core/SkShader.cpp:48: bool SkShader::computeTotalInverse(const ContextRec&
rec, SkMatrix* totalInverse) const {
On 2014/05/05 14:01:19, scroggo wrote:
> Why does this take a ContextRec when it only looks at the ctm?

Preemptive, as the method returns the inverse of *all* of the rec, which today
only has matrix, but tomorrow may/will have more state. (e.g. localmatrix)

Powered by Google App Engine
This is Rietveld 408576698