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

Unified Diff: src/core/SkTileGridPicture.cpp

Issue 238273012: Staged removal of SkPicture-derived classes (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: have SkPicture only friend SkPictureRecorder once Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkTileGrid.cpp ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkTileGridPicture.cpp
===================================================================
--- src/core/SkTileGridPicture.cpp (revision 14237)
+++ src/core/SkTileGridPicture.cpp (working copy)
@@ -10,7 +10,24 @@
#include "SkPictureStateTree.h"
#include "SkTileGrid.h"
-SkTileGridPicture::SkTileGridPicture(int width, int height, const TileGridInfo& info) {
+
+SkBBoxHierarchy* SkTileGridFactory::operator()(int width, int height) const {
+ SkASSERT(fInfo.fMargin.width() >= 0);
+ SkASSERT(fInfo.fMargin.height() >= 0);
+ // Note: SkIRects are non-inclusive of the right() column and bottom() row.
+ // For example, an SkIRect at 0,0 with a size of (1,1) will only have
+ // content at pixel (0,0) and will report left=0 and right=1, hence the
+ // "-1"s below.
+ int xTileCount = (width + fInfo.fTileInterval.width() - 1) / fInfo.fTileInterval.width();
+ int yTileCount = (height + fInfo.fTileInterval.height() - 1) / fInfo.fTileInterval.height();
+ return SkNEW_ARGS(SkTileGrid, (xTileCount, yTileCount, fInfo,
+ SkTileGridNextDatum<SkPictureStateTree::Draw>));
+}
+
+#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
+
+SkTileGridPicture::SkTileGridPicture(int width, int height,
+ const SkTileGridFactory::TileGridInfo& info) {
SkASSERT(info.fMargin.width() >= 0);
SkASSERT(info.fMargin.height() >= 0);
fInfo = info;
@@ -26,3 +43,5 @@
return SkNEW_ARGS(SkTileGrid, (fXTileCount, fYTileCount, fInfo,
SkTileGridNextDatum<SkPictureStateTree::Draw>));
}
+
+#endif
« no previous file with comments | « src/core/SkTileGrid.cpp ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698