OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkImageGenerator.h" | 8 #include "SkImageGenerator.h" |
9 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
11 #include "SkMatrix.h" | 11 #include "SkMatrix.h" |
12 #include "SkPaint.h" | 12 #include "SkPaint.h" |
13 #include "SkPicture.h" | 13 #include "SkPicture.h" |
| 14 #include "SkTLazy.h" |
14 | 15 |
15 class SkPictureImageGenerator : SkImageGenerator { | 16 class SkPictureImageGenerator : SkImageGenerator { |
16 public: | 17 public: |
17 static SkImageGenerator* Create(const SkISize&, const SkPicture*, const SkMa
trix*, | 18 static SkImageGenerator* Create(const SkISize&, const SkPicture*, const SkMa
trix*, |
18 const SkPaint*); | 19 const SkPaint*); |
19 | 20 |
20 protected: | 21 protected: |
21 bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkP
MColor ctable[], | 22 bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkP
MColor ctable[], |
22 int* ctableCount) override; | 23 int* ctableCount) override; |
23 | 24 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 SkCanvas canvas(bitmap, SkSurfaceProps(0, kUnknown_SkPixelGeometry)); | 72 SkCanvas canvas(bitmap, SkSurfaceProps(0, kUnknown_SkPixelGeometry)); |
72 canvas.drawPicture(fPicture, &fMatrix, fPaint.getMaybeNull()); | 73 canvas.drawPicture(fPicture, &fMatrix, fPaint.getMaybeNull()); |
73 | 74 |
74 return true; | 75 return true; |
75 } | 76 } |
76 | 77 |
77 SkImageGenerator* SkImageGenerator::NewFromPicture(const SkISize& size, const Sk
Picture* picture, | 78 SkImageGenerator* SkImageGenerator::NewFromPicture(const SkISize& size, const Sk
Picture* picture, |
78 const SkMatrix* matrix, const
SkPaint* paint) { | 79 const SkMatrix* matrix, const
SkPaint* paint) { |
79 return SkPictureImageGenerator::Create(size, picture, matrix, paint); | 80 return SkPictureImageGenerator::Create(size, picture, matrix, paint); |
80 } | 81 } |
OLD | NEW |