summaryrefslogtreecommitdiffstats
path: root/cc/math_util.cc
Commit message (Collapse)AuthorAgeFilesLines
* Implement unit tests and temporary MathUtil wrappers for transform functionalityshawnsingh@chromium.org2012-11-191-0/+158
| | | | | | | | | | | | | These unit tests and wrappers have a short-term home in MathUtil so that we can safely migrate from WebTransformationMatrix to gfx::Transform in a follow-up patch. After the migration, we will then proceed to phase out this temporary code and beef up ui/gfx/transform.h nicely. BUG=159972 Review URL: https://codereview.chromium.org/11316043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168571 0039d316-1c4b-4281-b951-d872f2087c98
* Remove WTF and WebCore from cc/ and webkit/compositor_bindings/piman@chromium.org2012-11-101-2/+0
| | | | | | | | | | | Ding, dong... BUG=154451 Review URL: https://chromiumcodereview.appspot.com/11410021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167071 0039d316-1c4b-4281-b951-d872f2087c98
* ui: Prefer +/- operators to apply offsets.danakj@chromium.org2012-11-101-10/+4
| | | | | | | | | | | | | | | | | Adds +/- operators to gfx::Rect that are applied to its origin Point. Removes gfx::Point method a.OffsetFrom(b) in favor of (b - a). Begin use +/- instead of Offset() in ui/gfx/ and cc/ New tests: ui_unittests:RectTest.Offset R=pkasting,enne BUG=158416 Review URL: https://codereview.chromium.org/11293194 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167012 0039d316-1c4b-4281-b951-d872f2087c98
* cc: Add some early outs to avoid expensive operationsdanakj@chromium.org2012-11-091-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | mapHomgenousPoint is not cheap. We can do faster in projectClippedRect similar to mapClippedRect. rectSubtractRegion constructs a Region to do subtraction from. If the subtraction's rvalue is empty, then there is nothing to do and we can avoid creating a Region structure at all. I measured time spent in calculateRenderPasses with a draw-heavy unit test. Baseline: 0.001148 seconds With these changes: 0.001116 seconds So, about 3% reduction in time spent in calculateRenderPasses. R=enne BUG=159718 Review URL: https://chromiumcodereview.appspot.com/11312154 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166841 0039d316-1c4b-4281-b951-d872f2087c98
* cc: Create a Region class that wraps SkRegion, to replace use of ↵danakj@chromium.org2012-11-081-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | WebCore::Region. We create a class in cc/ called Region which provides a gfx:: type-friendly API to SkRegion, and allows for easily swapping out region implementations in the future if required. During the process, I removed tests dependency on a "size()" method on Region, that used to give the number of rects in the Region's internal representation. Instead, we always create a Region in the tests from our expected rects, and compare the Regions directly. We use ToString() comparisons to get useful failure outputs, similar to the unit tests of other geometry types in ui/gfx. This uncovered a WTF::Vector holdout in the OcclusionTracker class, which is converted to a std::vector. Covered by existing tests; no change in behaviour. R=enne BUG=147395 Review URL: https://chromiumcodereview.appspot.com/11366094 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166617 0039d316-1c4b-4281-b951-d872f2087c98
* cc: Remove all remaining use of WebCore Rect/Point/Size types from the ↵danakj@chromium.org2012-11-051-10/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | compositor. This change removes all IntPoint/FloatRect/IntSize/etc from the compositor. There remains an indirect dependency on these types through the WebCore::Region class, which we wrap but need to replace. However, the wrapper there hides the WebCore types inside it, so there are now no references to the types from anywhere else in the compositor. I went back and forth on how to deal with scroll "positions". The name suggested that they should be Points, and that the deltas should be Vectors. However this lent itself to super awkward math at times. In the end, it was much cleaner to make all scroll "positions" into scroll "offsets" and represent everything as Vectors. Covered by existing tests; no change in behaviour. R=enne BUG=147395 Relanding: https://codereview.chromium.org/11367080/ Review URL: https://codereview.chromium.org/11366089 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166027 0039d316-1c4b-4281-b951-d872f2087c98
* cc: Fix style for comments at the end of namespacesdanakj@chromium.org2012-11-051-1/+1
| | | | | | | | | | | | Make sure we have a comment at the end of the namespace for each .cc file and that there are two spaces between the closing brace and the comment. R=enne Review URL: https://chromiumcodereview.appspot.com/11275153 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166005 0039d316-1c4b-4281-b951-d872f2087c98
* Revert "cc: Remove all remaining use of WebCore Rect/Point/Size types from ↵phajdan.jr@chromium.org2012-11-051-17/+10
| | | | | | | | the compositor." This reverts commit a76cb24ab8de742f70b83f6c045c2c23545eaae7. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165949 0039d316-1c4b-4281-b951-d872f2087c98
* cc: Remove all remaining use of WebCore Rect/Point/Size types from the ↵danakj@chromium.org2012-11-051-10/+17
| | | | | | | | | | | | | | | | | | | | | | | | | compositor. This change removes all IntPoint/FloatRect/IntSize/etc from the compositor. There remains an indirect dependency on these types through the WebCore::Region class, which we wrap but need to replace. However, the wrapper there hides the WebCore types inside it, so there are now no references to the types from anywhere else in the compositor. I went back and forth on how to deal with scroll "positions". The name suggested that they should be Points, and that the deltas should be Vectors. However this lent itself to super awkward math at times. In the end, it was much cleaner to make all scroll "positions" into scroll "offsets" and represent everything as Vectors. Covered by existing tests; no change in behaviour. R=enne BUG=147395 Review URL: https://codereview.chromium.org/11367080 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165947 0039d316-1c4b-4281-b951-d872f2087c98
* cc: Replace WebCore::FloatQuad with gfx::QuadF.danakj@chromium.org2012-11-021-16/+16
| | | | | | | | | | | | | | | | | | | | It does as it says it does. This depends on the QuadF CL found at https://codereview.chromium.org/11369043/ and is just search/replace after that, as I added all the equivalent functionality to QuadF that we made use of on FloatQuad. It is possible we may see some slight differences in behaviour from using FloatQuad, as we should benefit from increased precision, using doubles after multiplying floats, when using Contains(Point) or IsCounterClockwise(). Covered by existing tests; no dramatic change in behaviour. R=enne BUG=147395 Review URL: https://codereview.chromium.org/11364044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165735 0039d316-1c4b-4281-b951-d872f2087c98
* Remove most remaining references to IntRect and FloatRect.danakj@chromium.org2012-11-011-1/+1
| | | | | | | | | | | | | | | | The remaining uses are: - Dealing with the output of Region::rects() which gives a vector of WebCore::IntRects. - Using FloatRect::isExpressibleAsIntRect. Covered by existing tests; no new behaviour. BUG=147395 R=enne Review URL: https://codereview.chromium.org/11275113 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165542 0039d316-1c4b-4281-b951-d872f2087c98
* cc: Switch from WebCore::FloatPoint3D to gfx::Point3F and gfx::Vector3dF in ↵danakj@chromium.org2012-11-011-16/+16
| | | | | | | | | | | | | | | | | | the compositor This entirely removes our usage of FloatPoint3D, and removes the stub header as well. Covered by existing tests; just changing data types. This depends on https://codereview.chromium.org/11367025/ BUG=147395 R=enne Review URL: https://codereview.chromium.org/11369018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165484 0039d316-1c4b-4281-b951-d872f2087c98
* cc: Use gfx:: Geometry types for positions, bounds, and related things.danakj@chromium.org2012-11-011-29/+31
| | | | | | | | | | | | | | | | | | | | | | | This covers layers, layer tree hosts, and related classes. *phew* I intentionally avoided anything to do with scrolling or page scale. Those should be changed to be Vectors and need a bit more thought. This change should be pretty mindless. It converts to gfx Rect, Size, Vector, and Point classes. No change is made for FloatPoint3D or FloatQuad yet. I've added cc/geometry.h as a place for free functions that don't exist on gfx types yet, and that we should port over in the future. No change in behaviour; covered by existing tests. BUG=147395 R=enne Review URL: https://codereview.chromium.org/11264056 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165434 0039d316-1c4b-4281-b951-d872f2087c98
* Use gfx::Rect types for occlusion tracker and quad culler classes.danakj@chromium.org2012-10-311-1/+1
| | | | | | | | | | | | | This depends on the non-mutating methods for Rect operations: https://codereview.chromium.org/11270042/ Covered by existing tests, just changing data types. BUG=147395 R=enne Review URL: https://codereview.chromium.org/11272045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165220 0039d316-1c4b-4281-b951-d872f2087c98
* cc: Apply the layer's initial CSS scale to the contentsScale to render text ↵danakj@chromium.org2012-10-241-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | at the right resolution. Currently the transform does not affect the scale of a layer's contents. This means that when a layer with a scale on it becomes composited, its text is rendered at 1x and then scaled up during rendering, which makes for very fuzzy text. This change applies the scale from the layer's CSS transform to the contentsScale so that text is rendered at the same pixel resolution as it will be drawn on screen. Tests: cc_unittests:CCLayerTreeHostCommonTest.verifyContentsScale cc_unittests:CCLayerTreeHostCommonTest.verifyContentsScaleForSurfaces BUG=149943 R=enne Review URL: https://codereview.chromium.org/11230033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163873 0039d316-1c4b-4281-b951-d872f2087c98
* cc: Rename cc classes and members to match filenamesenne@chromium.org2012-10-221-14/+14
| | | | | | | | | | | Fixed reland of https://chromiumcodereview.appspot.com/11189043/ TBR=jam@chromium.org,jamesr@chromium.org BUG=155413 Review URL: https://codereview.chromium.org/11231054 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163429 0039d316-1c4b-4281-b951-d872f2087c98
* cc: Remove CC*.h temporary includes, part 4/4.tfarina@chromium.org2012-10-221-1/+1
| | | | | | | | | | | | BUG=155413 TEST=cc_unittests R=enne@chromium.org,jamesr@chromium.org TBR=jamesr@chromium.org Review URL: https://chromiumcodereview.appspot.com/11233025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163225 0039d316-1c4b-4281-b951-d872f2087c98
* Revert "cc: Rename cc classes and members to match filenames"enne@chromium.org2012-10-191-14/+14
| | | | | | This reverts commit 184fac5add06d5f4670fa6be4a4d3b39232d51bb. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163059 0039d316-1c4b-4281-b951-d872f2087c98
* cc: Rename cc classes and members to match filenamesenne@chromium.org2012-10-191-14/+14
| | | | | | | | BUG=155413 Review URL: https://codereview.chromium.org/11189043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163052 0039d316-1c4b-4281-b951-d872f2087c98
* cc: Switch to Chromium DCHECKs LOGsdanakj@chromium.org2012-10-181-3/+3
| | | | | | | | | | | | | | | We can't compile-guard code and use DCHECK since it can be enabled at runtime. So we guard the DCHECKs that we want to rely on conditionally-compiled code in !NDEBUG compile guards. This also replaces use of LOG_ERROR("Foo") with LOG(ERROR)<<"Foo"; This was previously discussed and committed as https://codereview.chromium.org/11048044/ using a guard based on LOGGING_IS_OFFICIAL_BUILD, however this was not sufficient since there are build configurations that are official builds but have dchecks compiled. R=enne Review URL: https://codereview.chromium.org/11192030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162739 0039d316-1c4b-4281-b951-d872f2087c98
* Revert "cc: Switch to Chromium DCHECKs LOGs"mattm@chromium.org2012-10-171-3/+3
| | | | | | | | | | This reverts commit 162296. (https://chromiumcodereview.appspot.com/11048044) TBR=danakj@chromium.org Review URL: https://codereview.chromium.org/11196014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162297 0039d316-1c4b-4281-b951-d872f2087c98
* cc: Switch to Chromium DCHECKs LOGsdanakj@chromium.org2012-10-171-3/+3
| | | | | | | | | | | | | | We can't compile-guard code and use DCHECK since it can be enabled at runtime. This removes all compile-time guards, and makes use of DCHECK instead of ASSERT. We use DCHECK_IS_ON() to early out and avoid extra work just for DCHECK where possible as well. This also replaces use of LOG_ERROR("Foo") with LOG(ERROR)<<"Foo"; R=enne,jamesr Review URL: https://chromiumcodereview.appspot.com/11048044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162296 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 162284 - cc: Get rid of CC*.h temporary header files.mattm@chromium.org2012-10-171-1/+1
| | | | | | | | | | | | BUG=155413 TEST=cc_unittests R=enne@chromium.org,jamesr@chromium.org Review URL: https://codereview.chromium.org/11145033 TBR=tfarina@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162286 0039d316-1c4b-4281-b951-d872f2087c98
* cc: Get rid of CC*.h temporary header files.tfarina@chromium.org2012-10-161-1/+1
| | | | | | | | | | BUG=155413 TEST=cc_unittests R=enne@chromium.org,jamesr@chromium.org Review URL: https://codereview.chromium.org/11145033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162284 0039d316-1c4b-4281-b951-d872f2087c98
* [cc] Rename all cc/ filenames to Chromium styleenne@chromium.org2012-10-121-0/+379
BUG=155413 Review URL: https://codereview.chromium.org/11122003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161671 0039d316-1c4b-4281-b951-d872f2087c98