aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils/SkGatherPixelRefsAndRects.cpp
blob: ee5b1472fcaa196aacbcbb2811039395d753a038 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
 * Copyright 2014 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "SkGatherPixelRefsAndRects.h"
#include "SkNoSaveLayerCanvas.h"
#include "SkPictureUtils.h"

void SkPictureUtils::GatherPixelRefsAndRects(SkPicture* pict,
                                             SkPictureUtils::SkPixelRefContainer* prCont) {
    if (pict->cullRect().isEmpty()) {
        return ;
    }

    SkGatherPixelRefsAndRectsDevice device(SkScalarCeilToInt(pict->cullRect().width()), 
                                           SkScalarCeilToInt(pict->cullRect().height()), 
                                           prCont);
    SkNoSaveLayerCanvas canvas(&device);

    canvas.clipRect(pict->cullRect(), SkRegion::kIntersect_Op, false);
    canvas.drawPicture(pict);
}