OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
10 #include "SkForceLinking.h" | 10 #include "SkForceLinking.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 blueBorder.setTextSize(SkDoubleToScalar(20)); | 258 blueBorder.setTextSize(SkDoubleToScalar(20)); |
259 | 259 |
260 SkString str; | 260 SkString str; |
261 | 261 |
262 const SkClipStack* clipStack = gDumpCanvas->getClipStack(); | 262 const SkClipStack* clipStack = gDumpCanvas->getClipStack(); |
263 if (clipStack) { | 263 if (clipStack) { |
264 SkClipStack::Iter iter(*clipStack, SkClipStack::Iter::kBottom_IterSt
art); | 264 SkClipStack::Iter iter(*clipStack, SkClipStack::Iter::kBottom_IterSt
art); |
265 const SkClipStack::Element* elem; | 265 const SkClipStack::Element* elem; |
266 double y = 0; | 266 double y = 0; |
267 int total = 0; | 267 int total = 0; |
268 while (elem = iter.next()) { | 268 while ((elem = iter.next()) != NULL) { |
269 total++; | 269 total++; |
270 y += 30; | 270 y += 30; |
271 | 271 |
272 switch (elem->getType()) { | 272 switch (elem->getType()) { |
273 case SkClipStack::Element::kRect_Type: | 273 case SkClipStack::Element::kRect_Type: |
274 canvas.drawRect(elem->getRect(), blueBorder); | 274 canvas.drawRect(elem->getRect(), blueBorder); |
275 canvas.drawText("Rect Clip", strlen("Rect Clip"), SkDoub
leToScalar(10), SkDoubleToScalar(y), blueBorder); | 275 canvas.drawText("Rect Clip", strlen("Rect Clip"), SkDoub
leToScalar(10), SkDoubleToScalar(y), blueBorder); |
276 break; | 276 break; |
277 case SkClipStack::Element::kPath_Type: | 277 case SkClipStack::Element::kPath_Type: |
278 canvas.drawPath(elem->getPath(), blueBorder); | 278 canvas.drawPath(elem->getPath(), blueBorder); |
(...skipping 2347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2626 | 2626 |
2627 rect = SkRect::MakeWH(width, height); | 2627 rect = SkRect::MakeWH(width, height); |
2628 | 2628 |
2629 setup_bitmap(output, (int)SkScalarToDouble(width), (int)SkScalarToDouble(hei
ght)); | 2629 setup_bitmap(output, (int)SkScalarToDouble(width), (int)SkScalarToDouble(hei
ght)); |
2630 | 2630 |
2631 SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (*output))); | 2631 SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (*output))); |
2632 SkCanvas canvas(device); | 2632 SkCanvas canvas(device); |
2633 | 2633 |
2634 return renderer.renderPage(page, &canvas, rect); | 2634 return renderer.renderPage(page, &canvas, rect); |
2635 } | 2635 } |
OLD | NEW |