diff options
author | Baligh Uddin <baligh@google.com> | 2013-11-01 16:01:55 -0700 |
---|---|---|
committer | Baligh Uddin <baligh@google.com> | 2013-11-01 16:01:55 -0700 |
commit | ec502fb532582da0f3141560bc451df3902ce463 (patch) | |
tree | bfd8e692b73dee4749734ca317b4707988dfae3a /core/SkTileGridPicture.cpp | |
parent | 5588ded0ae11d6fa36e1771747b82b7831db906b (diff) | |
parent | 53a521c76400a3e6d64dc96396390b746ec1e48e (diff) | |
download | src-idea133.tar.gz |
Merge remote-tracking branch 'origin/kitkat-dev'chromium_org-pre-replicationidea133
Diffstat (limited to 'core/SkTileGridPicture.cpp')
-rw-r--r-- | core/SkTileGridPicture.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/core/SkTileGridPicture.cpp b/core/SkTileGridPicture.cpp new file mode 100644 index 00000000..7a8d5932 --- /dev/null +++ b/core/SkTileGridPicture.cpp @@ -0,0 +1,28 @@ +/* + * Copyright 2012 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "SkTileGridPicture.h" + +#include "SkPictureStateTree.h" +#include "SkTileGrid.h" + +SkTileGridPicture::SkTileGridPicture(int width, int height, const TileGridInfo& info) { + SkASSERT(info.fMargin.width() >= 0); + SkASSERT(info.fMargin.height() >= 0); + fInfo = info; + // 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. + fXTileCount = (width + info.fTileInterval.width() - 1) / info.fTileInterval.width(); + fYTileCount = (height + info.fTileInterval.height() - 1) / info.fTileInterval.height(); +} + +SkBBoxHierarchy* SkTileGridPicture::createBBoxHierarchy() const { + return SkNEW_ARGS(SkTileGrid, (fXTileCount, fYTileCount, fInfo, + SkTileGridNextDatum<SkPictureStateTree::Draw>)); +} |