|
|
Created:
6 years, 10 months ago by jvanverth1 Modified:
6 years, 10 months ago CC:
skia-review_googlegroups.com Base URL:
https://skia.googlesource.com/skia.git@master Visibility:
Public. |
DescriptionAdd fallback code for TextContexts that don't support all features
BUG=skia:2018
NOTRY=true
Committed: http://code.google.com/p/skia/source/detail?r=13236
Patch Set 1 #
Total comments: 4
Patch Set 2 : Address Mike's concerns #
Total comments: 1
Patch Set 3 : Fix nits #
Messages
Total messages: 30 (0 generated)
This covers all the cases we talked about except for color fonts, which I'm not sure how to detect at this point.
https://codereview.chromium.org/135683006/diff/1/include/gpu/GrBitmapTextCont... File include/gpu/GrBitmapTextContext.h (right): https://codereview.chromium.org/135683006/diff/1/include/gpu/GrBitmapTextCont... include/gpu/GrBitmapTextContext.h:31: return !SkDraw::ShouldDrawTextAsPaths(paint, ctm); If we move this impl into the .cpp, can we not add SkDraw.h to the #include? I would like to make SkDraw.h private someday. https://codereview.chromium.org/135683006/diff/1/include/gpu/GrTextContext.h File include/gpu/GrTextContext.h (right): https://codereview.chromium.org/135683006/diff/1/include/gpu/GrTextContext.h#... include/gpu/GrTextContext.h:33: static bool CanDraw(const SkPaint&, const SkMatrix&) { return false; } all of these static-but-appear-to-be-overrides version of CanDraw a sligtly confusing in public headers. Why is this one (in particular) here, since it always returns false?
somewhat separate from this particular CL -- do we have good tests/gms to exercise distance-field drawing, and (now) to exercise the cases that force ganesh to fall back to masks?
This is going somewhat meta relative to this particular CL but I'm starting to question the value of creating a text context object for each text draw. It seemed to make sense when the pattern was: construct drawGlyph drawGlyph ... destroy But now it's always: construct drawSomeText destroy Would it make more sense to have a long lived text context with a drawSomeText function where drawSomeText takes the union of the stuff currently passed to the cons and the draw function? Probably as a struct since the number of params would start to get large. Then there could be a meta-text context that encapsulates a particular fallback pattern (e.g. distance-field->bmp->draw-as-paths. I'm thinking of something along the lines of the path renderer chain. Not saying this is the right answer, but throwing it out there as food for though.
On 2014/01/29 17:19:40, reed1 wrote: > somewhat separate from this particular CL -- do we have good tests/gms to > exercise distance-field drawing, and (now) to exercise the cases that force > ganesh to fall back to masks? There are about 70 GMs that include text in some form or another. There are 2 that use stroked text, 1 that uses blurred text, 1 that has rasterizers, and 1 that has color text. The remainder test a variety of font families and styles. I'm not sure what other cases we would have that force back to masks.
On 2014/01/29 17:18:55, reed1 wrote: > https://codereview.chromium.org/135683006/diff/1/include/gpu/GrBitmapTextCont... > File include/gpu/GrBitmapTextContext.h (right): > > https://codereview.chromium.org/135683006/diff/1/include/gpu/GrBitmapTextCont... > include/gpu/GrBitmapTextContext.h:31: return > !SkDraw::ShouldDrawTextAsPaths(paint, ctm); > If we move this impl into the .cpp, can we not add SkDraw.h to the #include? I > would like to make SkDraw.h private someday. Sure, I was allowing for the function to be inlined. > https://codereview.chromium.org/135683006/diff/1/include/gpu/GrTextContext.h > File include/gpu/GrTextContext.h (right): > > https://codereview.chromium.org/135683006/diff/1/include/gpu/GrTextContext.h#... > include/gpu/GrTextContext.h:33: static bool CanDraw(const SkPaint&, const > SkMatrix&) { return false; } > all of these static-but-appear-to-be-overrides version of CanDraw a sligtly > confusing in public headers. Why is this one (in particular) here, since it > always returns false? In retrospect it's not needed -- I can kill it. Alternatively, I can make them non-static methods if that would be less confusing.
On 2014/01/29 18:01:05, bsalomon wrote: > This is going somewhat meta relative to this particular CL but I'm starting to > question the value of creating a text context object for each text draw. It > seemed to make sense when the pattern was: > > construct > drawGlyph > drawGlyph > ... > destroy > > But now it's always: > construct > drawSomeText > destroy > > Would it make more sense to have a long lived text context with a drawSomeText > function where drawSomeText takes the union of the stuff currently passed to the > cons and the draw function? Probably as a struct since the number of params > would start to get large. > > Then there could be a meta-text context that encapsulates a particular fallback > pattern (e.g. distance-field->bmp->draw-as-paths. > > I'm thinking of something along the lines of the path renderer chain. Not saying > this is the right answer, but throwing it out there as food for though. I guess I see what you're saying. The construct and destroy are only conceptual, as it repeatedly calls placement new on an allocation, so it just as well could be part of the function call. My only issue is that it makes the drawText function parameter list rather long, but the struct could encapsulate that. I don't think there's a need for a meta-text context -- the pattern is fairly simple at the moment, so SkGpuDevice can handle it as I have it here (specialized->bitmap->paths). SkGpuDevice could have two TextContexts: the specialized one (distance or NVPR) and Bitmap.
https://codereview.chromium.org/135683006/diff/1/include/gpu/GrBitmapTextCont... File include/gpu/GrBitmapTextContext.h (right): https://codereview.chromium.org/135683006/diff/1/include/gpu/GrBitmapTextCont... include/gpu/GrBitmapTextContext.h:31: return !SkDraw::ShouldDrawTextAsPaths(paint, ctm); On 2014/01/29 17:18:56, reed1 wrote: > If we move this impl into the .cpp, can we not add SkDraw.h to the #include? I > would like to make SkDraw.h private someday. Done. https://codereview.chromium.org/135683006/diff/1/include/gpu/GrTextContext.h File include/gpu/GrTextContext.h (right): https://codereview.chromium.org/135683006/diff/1/include/gpu/GrTextContext.h#... include/gpu/GrTextContext.h:33: static bool CanDraw(const SkPaint&, const SkMatrix&) { return false; } On 2014/01/29 17:18:56, reed1 wrote: > all of these static-but-appear-to-be-overrides version of CanDraw a sligtly > confusing in public headers. Why is this one (in particular) here, since it > always returns false? I've removed this one. I left the others as static for now.
thanks. btw -- why are the first two include/gpu files in the review public?
On 2014/01/29 19:02:39, JimVV wrote: > I don't think there's a need for a meta-text context -- the pattern is fairly > simple at the moment, so SkGpuDevice can handle it as I have it here > (specialized->bitmap->paths). SkGpuDevice could have two TextContexts: the > specialized one (distance or NVPR) and Bitmap. I guess I wonder whether baking that logic into SkGpuDevice will be still be desirable when we have color bitmap font support and NVPR or DF. Maybe it's just a hard-coded chain where the first context type is specializable. Anyway, lgtm as it is now. https://codereview.chromium.org/135683006/diff/20001/src/gpu/GrDistanceFieldT... File src/gpu/GrDistanceFieldTextContext.cpp (right): https://codereview.chromium.org/135683006/diff/20001/src/gpu/GrDistanceFieldT... src/gpu/GrDistanceFieldTextContext.cpp:32: && paint.getStyle() == SkPaint::kFill_Style style nit: &&s on prev line.
On 2014/01/29 19:37:57, reed1 wrote: > thanks. > > btw -- why are the first two include/gpu files in the review public? I think the text context is public for historical reasons. It was part of the Sk/Gr glue layer. It should be made private.
On 2014/01/29 19:39:54, bsalomon wrote: > On 2014/01/29 19:37:57, reed1 wrote: > > thanks. > > > > btw -- why are the first two include/gpu files in the review public? > > > I think the text context is public for historical reasons. It was part of the > Sk/Gr glue layer. It should be made private. destroy all monsters == make all interfaces private
On 2014/01/29 19:40:32, reed1 wrote: > On 2014/01/29 19:39:54, bsalomon wrote: > > On 2014/01/29 19:37:57, reed1 wrote: > > > thanks. > > > > > > btw -- why are the first two include/gpu files in the review public? > > > > > > I think the text context is public for historical reasons. It was part of the > > Sk/Gr glue layer. It should be made private. > > destroy all monsters == make all interfaces private I'll create a new change to put all the Gr*TextContext.h files in src/gpu.
On 2014/01/29 19:40:32, reed1 wrote: > On 2014/01/29 19:39:54, bsalomon wrote: > > On 2014/01/29 19:37:57, reed1 wrote: > > > thanks. > > > > > > btw -- why are the first two include/gpu files in the review public? > > > > > > I think the text context is public for historical reasons. It was part of the > > Sk/Gr glue layer. It should be made private. > > destroy all monsters == make all interfaces private I'll create a new change to put all the Gr*TextContext.h files in src/gpu.
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/jvanverth@google.com/135683006/40001
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/jvanverth@google.com/135683006/40001
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/jvanverth@google.com/135683006/40001
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/jvanverth@google.com/135683006/40001
CQ bit was unchecked on CL. Ignoring.
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/jvanverth@google.com/135683006/40001
CQ bit was unchecked on CL. Ignoring.
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/jvanverth@google.com/135683006/40001
CQ bit was unchecked on CL. Ignoring.
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/jvanverth@google.com/135683006/40001
CQ bit was unchecked on CL. Ignoring.
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/jvanverth@google.com/135683006/40001
CQ bit was unchecked on CL. Ignoring.
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/jvanverth@google.com/135683006/40001
Message was sent while issue was closed.
Change committed as 13236
Message was sent while issue was closed.
CQ bit was unchecked on CL. Ignoring. |