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

Side by Side Diff: src/core/SkTileGridPicture.cpp

Issue 243173002: Staging for cleanup of SkPicture-related headers (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Add crucial newline at end of file 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.h ('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 #ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
9
8 #include "SkTileGridPicture.h" 10 #include "SkTileGridPicture.h"
9 11
10 #include "SkPictureStateTree.h" 12 #include "SkPictureStateTree.h"
11 #include "SkTileGrid.h" 13 #include "SkTileGrid.h"
12 14
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, 15 SkTileGridPicture::SkTileGridPicture(int width, int height,
30 const SkTileGridFactory::TileGridInfo& info ) { 16 const SkTileGridFactory::TileGridInfo& info ) {
31 SkASSERT(info.fMargin.width() >= 0); 17 SkASSERT(info.fMargin.width() >= 0);
32 SkASSERT(info.fMargin.height() >= 0); 18 SkASSERT(info.fMargin.height() >= 0);
33 fInfo = info; 19 fInfo = info;
34 // Note: SkIRects are non-inclusive of the right() column and bottom() row. 20 // Note: SkIRects are non-inclusive of the right() column and bottom() row.
35 // For example, an SkIRect at 0,0 with a size of (1,1) will only have 21 // For example, an SkIRect at 0,0 with a size of (1,1) will only have
36 // content at pixel (0,0) and will report left=0 and right=1, hence the 22 // content at pixel (0,0) and will report left=0 and right=1, hence the
37 // "-1"s below. 23 // "-1"s below.
38 fXTileCount = (width + info.fTileInterval.width() - 1) / info.fTileInterval. width(); 24 fXTileCount = (width + info.fTileInterval.width() - 1) / info.fTileInterval. width();
39 fYTileCount = (height + info.fTileInterval.height() - 1) / info.fTileInterva l.height(); 25 fYTileCount = (height + info.fTileInterval.height() - 1) / info.fTileInterva l.height();
40 } 26 }
41 27
42 SkBBoxHierarchy* SkTileGridPicture::createBBoxHierarchy() const { 28 SkBBoxHierarchy* SkTileGridPicture::createBBoxHierarchy() const {
43 return SkNEW_ARGS(SkTileGrid, (fXTileCount, fYTileCount, fInfo, 29 return SkNEW_ARGS(SkTileGrid, (fXTileCount, fYTileCount, fInfo,
44 SkTileGridNextDatum<SkPictureStateTree::Draw>)); 30 SkTileGridNextDatum<SkPictureStateTree::Draw>));
45 } 31 }
46 32
47 #endif 33 #endif
OLDNEW
« no previous file with comments | « src/core/SkTileGrid.h ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698