Adding comments based on review https://codereview.appspot.com/7300072/
authorjunov@chromium.org <junov@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 8 Feb 2013 21:56:16 +0000 (21:56 +0000)
committerjunov@chromium.org <junov@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 8 Feb 2013 21:56:16 +0000 (21:56 +0000)
git-svn-id: http://skia.googlecode.com/svn/trunk@7686 2bbb7eff-a529-9590-31e7-b0007b416f81

include/core/SkTileGridPicture.h
src/core/SkTileGrid.cpp

index 77189bb..28d545a 100644 (file)
@@ -29,7 +29,9 @@ public:
      * @param borderPixels pixels of overlap between adjacent tiles. Set this
      *  value to match the border overlap that is applied to tiles by user
      *  code. Properly setting this value will help improve performance
-     *  when performing tile-aligned playbacks.
+     *  when performing tile-aligned playbacks with query regions that
+     *  match tile bounds outset by borderPixels pixels. Such outsets
+     *  are often used to prevent filtering artifacts at tile boundaries.
      */
     SkTileGridPicture(int tileWidth, int tileHeight, int width, int height, int borderPixels = 0);
     virtual SkBBoxHierarchy* createBBoxHierarchy() const SK_OVERRIDE;
index 51c40cc..25a1fa8 100644 (file)
@@ -56,6 +56,9 @@ void SkTileGrid::insert(void* data, const SkIRect& bounds, bool) {
 }
 
 void SkTileGrid::search(const SkIRect& query, SkTDArray<void*>* results) {
+    // Convert the query rectangle from device coordinates to tile coordinates
+    // by rounding outwards to the nearest tile boundary so that the resulting tile
+    // region includes the query rectangle. (using truncating division to "floor")
     int tileStartX = (query.left() + fBorderPixels) / fTileWidth;
     int tileEndX = (query.right() + fTileWidth - fBorderPixels) / fTileWidth;
     int tileStartY = (query.top() + fBorderPixels) / fTileHeight;