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

Issue 262703002: add default impl for context methods on shader (Closed)

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

Description

add default impl for context methods on shader These are reasonable return values, since both of these methods can return a known value (0) which means that no context can be created. This also makes it easier for chrome's subclasses which already do not want to create a context, but having them actually overridden makes changing the virtual signatures much harder. BUG=skia: Committed: http://code.google.com/p/skia/source/detail?r=14491

Patch Set 1 #

Total comments: 2

Patch Set 2 : update dox, keep contextSize() defaulting to 0 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+17 lines, -2 lines) Patch
M include/core/SkShader.h View 1 1 chunk +8 lines, -2 lines 0 comments Download
M src/core/SkShader.cpp View 1 1 chunk +9 lines, -0 lines 2 comments Download

Messages

Total messages: 13 (0 generated)
reed1
6 years, 7 months ago (2014-04-30 18:41:42 UTC) #1
scroggo
https://codereview.chromium.org/262703002/diff/1/include/core/SkShader.h File include/core/SkShader.h (right): https://codereview.chromium.org/262703002/diff/1/include/core/SkShader.h#newcode221 include/core/SkShader.h:221: * Base class implementation returns 0. Due to a ...
6 years, 7 months ago (2014-04-30 18:52:02 UTC) #2
reed1
On 2014/04/30 18:52:02, scroggo wrote: > https://codereview.chromium.org/262703002/diff/1/include/core/SkShader.h > File include/core/SkShader.h (right): > > https://codereview.chromium.org/262703002/diff/1/include/core/SkShader.h#newcode221 > ...
6 years, 7 months ago (2014-04-30 18:56:45 UTC) #3
scroggo
On 2014/04/30 18:56:45, reed1 wrote: > On 2014/04/30 18:52:02, scroggo wrote: > > https://codereview.chromium.org/262703002/diff/1/include/core/SkShader.h > ...
6 years, 7 months ago (2014-04-30 19:10:59 UTC) #4
reed1
On 2014/04/30 19:10:59, scroggo wrote: > On 2014/04/30 18:56:45, reed1 wrote: > > On 2014/04/30 ...
6 years, 7 months ago (2014-04-30 19:21:58 UTC) #5
scroggo
On 2014/04/30 19:21:58, reed1 wrote: > On 2014/04/30 19:10:59, scroggo wrote: > > On 2014/04/30 ...
6 years, 7 months ago (2014-04-30 19:36:00 UTC) #6
reed1
updated dox, kept the def contextSize at 0 ptal
6 years, 7 months ago (2014-04-30 21:18:32 UTC) #7
scroggo
On 2014/04/30 21:18:32, reed1 wrote: > updated dox, kept the def contextSize at 0 > ...
6 years, 7 months ago (2014-04-30 21:35:20 UTC) #8
scroggo
I like the comments. If we want pixel_ref_utils_unittest.cc to work without asserting, we may need ...
6 years, 7 months ago (2014-04-30 21:38:22 UTC) #9
reed2
The CQ bit was checked by reed@chromium.org
6 years, 7 months ago (2014-04-30 23:22:01 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/reed@google.com/262703002/20001
6 years, 7 months ago (2014-04-30 23:22:23 UTC) #11
commit-bot: I haz the power
Change committed as 14491
6 years, 7 months ago (2014-04-30 23:29:04 UTC) #12
Dominik Grewe
6 years, 7 months ago (2014-05-01 09:18:43 UTC) #13
Message was sent while issue was closed.
https://codereview.chromium.org/262703002/diff/20001/src/core/SkShader.cpp
File src/core/SkShader.cpp (right):

https://codereview.chromium.org/262703002/diff/20001/src/core/SkShader.cpp#ne...
src/core/SkShader.cpp:72: return 0;
On 2014/04/30 21:38:23, scroggo wrote:
> This may assert in skia/ext/pixel_ref_utils_unittest.cc after
> https://codereview.chromium.org/264463003/

Yes, this will fail if a subclass doesn't overwrite this method. In [1] we'd
pass 0 as the allocation size to SkSmallAllocator which requires that the
allocation size is at least the size of T (= SkShader::Context).
Could we return 'sizeof(SkShader::Context)' instead? Otherwise we'd have to
check for 'contextSize() == 0' before trying to allocate.

[1]
https://code.google.com/p/chromium/codesearch#chromium/src/third_party/skia/s...

Powered by Google App Engine
This is Rietveld 408576698