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

Issue 652016: Added the bulk of the algorithm for GPU accelerated 2D vector curve... (Closed)

Created:
10 years, 10 months ago by Ken Russell (switch to Gerrit)
Modified:
9 years, 7 months ago
CC:
o3d-review_googlegroups.com
Visibility:
Public.

Description

Added the bulk of the algorithm for GPU accelerated 2D vector curve rendering from "Rendering Vector Art on the GPU" by Loop and Blinn, GPU Gems 3, Chapter 25. The main entry point to the algorithm is the PathProcessor, which takes in a Skia path and converts it to two triangle meshes: one for the exterior region of the shape containing the curve segments, and one for the interior region of the shape which is filled with constant (1.0) alpha. The o3d.ProcessedPath class is the internal object which exposes the needed entry points to JavaScript. However, o3djs.gpu2d is the user-level entry point to the algorithm. This exposes a Path primitive to which line, quadratic curve and cubic curve segments can be added, and simple fills (currently only a solid color). An SVG loader in samples/gpu2d/svgloader.js illustrates how content might be imported at run time. Several samples and regression tests demonstrate the current state of the implementation. More work is planned. Some small generalizations to the O3D code were necessary to support two-dimensional vertices. Note that I plan to submit gpu2d.js and/or svgloader.js for JavaScript readability. I have run both through the JS compiler and have fixed as many of the doc generation errors as possible in svgloader.js without pulling this file into the o3djs namespace. Tested in O3D on Windows and Mac OS X. BUG=none TEST=various SVG based tests Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=40079

Patch Set 1 #

Total comments: 136

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 28

Patch Set 4 : '' #

Patch Set 5 : '' #

Patch Set 6 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+5909 lines, -23 lines) Patch
M DEPS View 1 2 3 2 chunks +4 lines, -1 line 0 comments Download
M core/core.gyp View 1 2 3 3 chunks +7 lines, -0 lines 0 comments Download
M core/cross/class_manager.cc View 1 2 3 2 chunks +2 lines, -0 lines 0 comments Download
M core/cross/gpu2d/cubic_math_utils.h View 1 2 3 1 chunk +11 lines, -0 lines 0 comments Download
M core/cross/gpu2d/cubic_math_utils.cc View 1 2 3 2 chunks +91 lines, -0 lines 0 comments Download
A core/cross/gpu2d/path_cache.h View 1 1 chunk +120 lines, -0 lines 0 comments Download
A core/cross/gpu2d/path_cache.cc View 1 1 chunk +105 lines, -0 lines 0 comments Download
A core/cross/gpu2d/path_processor.h View 1 1 chunk +126 lines, -0 lines 0 comments Download
A core/cross/gpu2d/path_processor.cc View 1 2 1 chunk +1251 lines, -0 lines 0 comments Download
M core/cross/primitive.cc View 1 2 3 5 chunks +65 lines, -22 lines 0 comments Download
A core/cross/processed_path.h View 1 2 1 chunk +115 lines, -0 lines 0 comments Download
A core/cross/processed_path.cc View 1 2 3 1 chunk +159 lines, -0 lines 0 comments Download
A plugin/idl/processed_path.idl View 1 1 chunk +119 lines, -0 lines 0 comments Download
M plugin/idl_list.manifest View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
A samples/gpu2d/Google_Logo.svg View 1 chunk +134 lines, -0 lines 0 comments Download
A samples/gpu2d/a.svg View 1 chunk +72 lines, -0 lines 0 comments Download
A samples/gpu2d/basic.html View 1 2 3 1 chunk +229 lines, -0 lines 0 comments Download
A samples/gpu2d/crescent.svg View 1 chunk +19 lines, -0 lines 0 comments Download
A samples/gpu2d/javalogo.svg View 1 chunk +58 lines, -0 lines 0 comments Download
A samples/gpu2d/regression-tests/curve-subdivision-bug-1.html View 1 chunk +51 lines, -0 lines 0 comments Download
A samples/gpu2d/regression-tests/curve-subdivision-bug-1.svg View 1 chunk +17 lines, -0 lines 0 comments Download
A samples/gpu2d/regression-tests/curve-subdivision-bug-2.html View 1 chunk +51 lines, -0 lines 0 comments Download
A samples/gpu2d/regression-tests/curve-subdivision-bug-2.svg View 1 chunk +17 lines, -0 lines 0 comments Download
A samples/gpu2d/regression-tests/curve-subdivision-bug-3.html View 1 chunk +51 lines, -0 lines 0 comments Download
A samples/gpu2d/regression-tests/curve-subdivision-bug-3.svg View 1 chunk +17 lines, -0 lines 0 comments Download
A samples/gpu2d/regression-tests/orientation-bug-1.html View 1 chunk +51 lines, -0 lines 0 comments Download
A samples/gpu2d/regression-tests/orientation-bug-1.svg View 1 chunk +72 lines, -0 lines 0 comments Download
A samples/gpu2d/svg_a.html View 1 chunk +51 lines, -0 lines 0 comments Download
A samples/gpu2d/svg_crescent.html View 1 chunk +51 lines, -0 lines 0 comments Download
A samples/gpu2d/svg_google_logo.html View 1 chunk +51 lines, -0 lines 0 comments Download
A samples/gpu2d/svg_java_logo.html View 1 chunk +51 lines, -0 lines 0 comments Download
A samples/gpu2d/svg_thin_crescent.html View 1 chunk +51 lines, -0 lines 0 comments Download
A samples/gpu2d/svgloader.js View 1 2 3 1 chunk +974 lines, -0 lines 0 comments Download
A samples/gpu2d/svgsample.js View 1 2 3 4 5 1 chunk +226 lines, -0 lines 0 comments Download
A samples/gpu2d/thincrescent.svg View 1 chunk +22 lines, -0 lines 0 comments Download
A samples/o3djs/gpu2d.js View 1 2 3 4 1 chunk +680 lines, -0 lines 0 comments Download
M samples/o3djs/js_list.manifest View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
A samples/third_party/xmljs/COPYING View 1 chunk +491 lines, -0 lines 0 comments Download
A samples/third_party/xmljs/tinyxmlsax.js View 1 chunk +245 lines, -0 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
Ken Russell (switch to Gerrit)
Please review. Thanks.
10 years, 10 months ago (2010-02-20 04:23:50 UTC) #1
apatrick_chromium
I'm sure I missed a bunch of stuff. This CL is huge! It's cool though. ...
10 years, 10 months ago (2010-02-23 18:46:26 UTC) #2
greggman
Very cool. I stopped reviewing at the end of the C++ stuff because some of ...
10 years, 10 months ago (2010-02-24 02:50:03 UTC) #3
greggman
http://codereview.chromium.org/652016/diff/1/13 File plugin/idl/processed_path.idl (right): http://codereview.chromium.org/652016/diff/1/13#newcode109 plugin/idl/processed_path.idl:109: void Update(); On 2010/02/24 02:50:03, greggman wrote: > You ...
10 years, 10 months ago (2010-02-24 22:04:07 UTC) #4
Ken Russell (switch to Gerrit)
http://codereview.chromium.org/652016/diff/1/9 File core/cross/gpu2d/cubic_math_utils.cc (right): http://codereview.chromium.org/652016/diff/1/9#newcode74 core/cross/gpu2d/cubic_math_utils.cc:74: if (e >= 0 && e <= f) { ...
10 years, 10 months ago (2010-02-25 06:01:11 UTC) #5
apatrick_chromium
LGTM for my part.
10 years, 10 months ago (2010-02-25 20:01:12 UTC) #6
greggman
Looking good. Just a few more questions http://codereview.chromium.org/652016/diff/5051/4017 File core/cross/processed_path.cc (right): http://codereview.chromium.org/652016/diff/5051/4017#newcode123 core/cross/processed_path.cc:123: Buffer* buffer ...
10 years, 10 months ago (2010-02-25 22:26:02 UTC) #7
Ken Russell (switch to Gerrit)
http://codereview.chromium.org/652016/diff/5051/4017 File core/cross/processed_path.cc (right): http://codereview.chromium.org/652016/diff/5051/4017#newcode123 core/cross/processed_path.cc:123: Buffer* buffer = position_field->buffer(); On 2010/02/25 22:26:02, greggman wrote: ...
10 years, 10 months ago (2010-02-25 23:48:23 UTC) #8
greggman
LGTM http://codereview.chromium.org/652016/diff/5051/4051 File samples/gpu2d/svgsample.js (right): http://codereview.chromium.org/652016/diff/5051/4051#newcode94 samples/gpu2d/svgsample.js:94: * @param clientElements the array of O3D client ...
10 years, 10 months ago (2010-02-25 23:54:09 UTC) #9
Ken Russell (switch to Gerrit)
10 years, 10 months ago (2010-02-26 00:25:21 UTC) #10
http://codereview.chromium.org/652016/diff/5051/4051
File samples/gpu2d/svgsample.js (right):

http://codereview.chromium.org/652016/diff/5051/4051#newcode94
samples/gpu2d/svgsample.js:94: * @param clientElements the array of O3D client
elements that have
On 2010/02/25 23:54:09, greggman wrote:
> On 2010/02/25 23:48:23, kbr wrote:
> > On 2010/02/25 22:26:02, greggman wrote:
> > > {!Array.<!Element>} clientElements?
> > 
> > No, per all of the other samples it's an array of some DOM objects, I think.
> > Copied the doc from one of the other samples.
> > 
> 
> Unfortunately most of those samples were written before anyone knew about
> Google's JavaScript Style Guide.
> 
> The style guide has it as "Element" for a generic element, or you could get
more
> specific as in "O3DElement"

I see. Changed.

Powered by Google App Engine
This is Rietveld 408576698