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