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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/core/SkTileGrid.cpp ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkTileGridPicture.h" 8 #include "SkTileGridPicture.h"
9 9
10 #include "SkPictureStateTree.h" 10 #include "SkPictureStateTree.h"
11 #include "SkTileGrid.h" 11 #include "SkTileGrid.h"
12 12
13 SkTileGridPicture::SkTileGridPicture(int width, int height, const TileGridInfo& info) { 13
14 SkBBoxHierarchy* SkTileGridFactory::operator()(int width, int height) const {
15 SkASSERT(fInfo.fMargin.width() >= 0);
16 SkASSERT(fInfo.fMargin.height() >= 0);
17 // Note: SkIRects are non-inclusive of the right() column and bottom() row.
18 // For example, an SkIRect at 0,0 with a size of (1,1) will only have
19 // content at pixel (0,0) and will report left=0 and right=1, hence the
20 // "-1"s below.
21 int xTileCount = (width + fInfo.fTileInterval.width() - 1) / fInfo.fTileInte rval.width();
22 int yTileCount = (height + fInfo.fTileInterval.height() - 1) / fInfo.fTileIn terval.height();
23 return SkNEW_ARGS(SkTileGrid, (xTileCount, yTileCount, fInfo,
24 SkTileGridNextDatum<SkPictureStateTree::Draw >));
25 }
26
27 #ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
28
29 SkTileGridPicture::SkTileGridPicture(int width, int height,
30 const SkTileGridFactory::TileGridInfo& info ) {
14 SkASSERT(info.fMargin.width() >= 0); 31 SkASSERT(info.fMargin.width() >= 0);
15 SkASSERT(info.fMargin.height() >= 0); 32 SkASSERT(info.fMargin.height() >= 0);
16 fInfo = info; 33 fInfo = info;
17 // Note: SkIRects are non-inclusive of the right() column and bottom() row. 34 // Note: SkIRects are non-inclusive of the right() column and bottom() row.
18 // For example, an SkIRect at 0,0 with a size of (1,1) will only have 35 // For example, an SkIRect at 0,0 with a size of (1,1) will only have
19 // content at pixel (0,0) and will report left=0 and right=1, hence the 36 // content at pixel (0,0) and will report left=0 and right=1, hence the
20 // "-1"s below. 37 // "-1"s below.
21 fXTileCount = (width + info.fTileInterval.width() - 1) / info.fTileInterval. width(); 38 fXTileCount = (width + info.fTileInterval.width() - 1) / info.fTileInterval. width();
22 fYTileCount = (height + info.fTileInterval.height() - 1) / info.fTileInterva l.height(); 39 fYTileCount = (height + info.fTileInterval.height() - 1) / info.fTileInterva l.height();
23 } 40 }
24 41
25 SkBBoxHierarchy* SkTileGridPicture::createBBoxHierarchy() const { 42 SkBBoxHierarchy* SkTileGridPicture::createBBoxHierarchy() const {
26 return SkNEW_ARGS(SkTileGrid, (fXTileCount, fYTileCount, fInfo, 43 return SkNEW_ARGS(SkTileGrid, (fXTileCount, fYTileCount, fInfo,
27 SkTileGridNextDatum<SkPictureStateTree::Draw>)); 44 SkTileGridNextDatum<SkPictureStateTree::Draw>));
28 } 45 }
46
47 #endif
OLDNEW
« 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