gfx/skia/trunk/src/core/SkTileGridPicture.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/core/SkTileGridPicture.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,28 @@
     1.4 +/*
     1.5 + * Copyright 2012 Google Inc.
     1.6 + *
     1.7 + * Use of this source code is governed by a BSD-style license that can be
     1.8 + * found in the LICENSE file.
     1.9 + */
    1.10 +
    1.11 +#include "SkTileGridPicture.h"
    1.12 +
    1.13 +#include "SkPictureStateTree.h"
    1.14 +#include "SkTileGrid.h"
    1.15 +
    1.16 +SkTileGridPicture::SkTileGridPicture(int width, int height, const TileGridInfo& info) {
    1.17 +    SkASSERT(info.fMargin.width() >= 0);
    1.18 +    SkASSERT(info.fMargin.height() >= 0);
    1.19 +    fInfo = info;
    1.20 +    // Note: SkIRects are non-inclusive of the right() column and bottom() row.
    1.21 +    // For example, an SkIRect at 0,0 with a size of (1,1) will only have
    1.22 +    // content at pixel (0,0) and will report left=0 and right=1, hence the
    1.23 +    // "-1"s below.
    1.24 +    fXTileCount = (width + info.fTileInterval.width() - 1) / info.fTileInterval.width();
    1.25 +    fYTileCount = (height + info.fTileInterval.height() - 1) / info.fTileInterval.height();
    1.26 +}
    1.27 +
    1.28 +SkBBoxHierarchy* SkTileGridPicture::createBBoxHierarchy() const {
    1.29 +    return SkNEW_ARGS(SkTileGrid, (fXTileCount, fYTileCount, fInfo,
    1.30 +         SkTileGridNextDatum<SkPictureStateTree::Draw>));
    1.31 +}

mercurial