OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkBigPicture.h" | 8 #include "SkBigPicture.h" |
9 #include "SkCanvasPriv.h" | 9 #include "SkCanvasPriv.h" |
10 #include "SkPatchUtils.h" | 10 #include "SkPatchUtils.h" |
11 #include "SkPicture.h" | 11 #include "SkPicture.h" |
12 #include "SkPictureUtils.h" | 12 #include "SkPictureUtils.h" |
13 #include "SkRecorder.h" | 13 #include "SkRecorder.h" |
14 | 14 |
15 //#define WRAP_BITMAP_AS_IMAGE | 15 //#define WRAP_BITMAP_AS_IMAGE |
16 | 16 |
17 SkDrawableList::~SkDrawableList() { | 17 SkDrawableList::~SkDrawableList() { |
18 fArray.unrefAll(); | 18 fArray.unrefAll(); |
19 } | 19 } |
20 | 20 |
21 SkBigPicture::SnapshotArray* SkDrawableList::newDrawableSnapshot() { | 21 SkBigPicture::SnapshotArray* SkDrawableList::newDrawableSnapshot() { |
22 const int count = fArray.count(); | 22 const int count = fArray.count(); |
23 if (0 == count) { | 23 if (0 == count) { |
24 return nullptr; | 24 return nullptr; |
25 } | 25 } |
26 SkAutoTMalloc<const SkPicture*> pics(count); | 26 SkAutoTMalloc<const SkPicture*> pics(count); |
27 for (int i = 0; i < count; ++i) { | 27 for (int i = 0; i < count; ++i) { |
28 pics[i] = fArray[i]->newPictureSnapshot(); | 28 pics[i] = fArray[i]->newPictureSnapshot(); |
29 } | 29 } |
30 return new SkBigPicture::SnapshotArray(pics.detach(), count); | 30 return new SkBigPicture::SnapshotArray(pics.release(), count); |
31 } | 31 } |
32 | 32 |
33 void SkDrawableList::append(SkDrawable* drawable) { | 33 void SkDrawableList::append(SkDrawable* drawable) { |
34 *fArray.append() = SkRef(drawable); | 34 *fArray.append() = SkRef(drawable); |
35 } | 35 } |
36 | 36 |
37 ////////////////////////////////////////////////////////////////////////////////
/////////////// | 37 ////////////////////////////////////////////////////////////////////////////////
/////////////// |
38 | 38 |
39 SkRecorder::SkRecorder(SkRecord* record, int width, int height, SkMiniRecorder*
mr) | 39 SkRecorder::SkRecorder(SkRecord* record, int width, int height, SkMiniRecorder*
mr) |
40 : SkCanvas(SkIRect::MakeWH(width, height), SkCanvas::kConservativeRasterClip
_InitFlag) | 40 : SkCanvas(SkIRect::MakeWH(width, height), SkCanvas::kConservativeRasterClip
_InitFlag) |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 INHERITED(onClipPath, path, op, edgeStyle); | 374 INHERITED(onClipPath, path, op, edgeStyle); |
375 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle); | 375 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle); |
376 APPEND(ClipPath, this->devBounds(), path, opAA); | 376 APPEND(ClipPath, this->devBounds(), path, opAA); |
377 } | 377 } |
378 | 378 |
379 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { | 379 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { |
380 INHERITED(onClipRegion, deviceRgn, op); | 380 INHERITED(onClipRegion, deviceRgn, op); |
381 APPEND(ClipRegion, this->devBounds(), deviceRgn, op); | 381 APPEND(ClipRegion, this->devBounds(), deviceRgn, op); |
382 } | 382 } |
383 | 383 |
OLD | NEW |