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

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

Issue 15896004: Move SkDrawLooper implementation to its own file. (Closed) Base URL: http://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 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 | « gyp/core.gypi ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkDrawLooper.h"
9 #include "SkCanvas.h"
10 #include "SkMatrix.h"
11 #include "SkPaint.h"
12 #include "SkRect.h"
13
14 SK_DEFINE_INST_COUNT(SkDrawLooper)
15
16 bool SkDrawLooper::canComputeFastBounds(const SkPaint& paint) {
17 SkCanvas canvas;
18
19 this->init(&canvas);
20 for (;;) {
21 SkPaint p(paint);
22 if (this->next(&canvas, &p)) {
23 p.setLooper(NULL);
24 if (!p.canComputeFastBounds()) {
25 return false;
26 }
27 } else {
28 break;
29 }
30 }
31 return true;
32 }
33
34 void SkDrawLooper::computeFastBounds(const SkPaint& paint, const SkRect& src,
35 SkRect* dst) {
36 SkCanvas canvas;
37
38 this->init(&canvas);
39 for (bool firstTime = true;; firstTime = false) {
40 SkPaint p(paint);
41 if (this->next(&canvas, &p)) {
42 SkRect r(src);
43
44 p.setLooper(NULL);
45 p.computeFastBounds(r, &r);
46 canvas.getTotalMatrix().mapRect(&r);
47
48 if (firstTime) {
49 *dst = r;
50 } else {
51 dst->join(r);
52 }
53 } else {
54 break;
55 }
56 }
57 }
OLDNEW
« no previous file with comments | « gyp/core.gypi ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698