OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 The Android Open Source Project | 2 * Copyright 2013 The Android Open Source Project |
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 "SkPictureImageFilter.h" | 8 #include "SkPictureImageFilter.h" |
9 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 sk_sp<SkSpecialSurface> surf(source->makeSurface(info)); | 101 sk_sp<SkSpecialSurface> surf(source->makeSurface(info)); |
102 if (!surf) { | 102 if (!surf) { |
103 return nullptr; | 103 return nullptr; |
104 } | 104 } |
105 | 105 |
106 SkCanvas* canvas = surf->getCanvas(); | 106 SkCanvas* canvas = surf->getCanvas(); |
107 SkASSERT(canvas); | 107 SkASSERT(canvas); |
108 | 108 |
109 canvas->clear(0x0); | 109 canvas->clear(0x0); |
110 | 110 |
111 if (kDeviceSpace_PictureResolution == fPictureResolution || | 111 if (kDeviceSpace_PictureResolution == fPictureResolution || |
112 0 == (ctx.ctm().getType() & ~SkMatrix::kTranslate_Mask)) { | 112 0 == (ctx.ctm().getType() & ~SkMatrix::kTranslate_Mask)) { |
113 this->drawPictureAtDeviceResolution(canvas, bounds, ctx); | 113 this->drawPictureAtDeviceResolution(canvas, bounds, ctx); |
114 } else { | 114 } else { |
115 this->drawPictureAtLocalResolution(source, canvas, bounds, ctx); | 115 this->drawPictureAtLocalResolution(source, canvas, bounds, ctx); |
116 } | 116 } |
117 | 117 |
118 offset->fX = bounds.fLeft; | 118 offset->fX = bounds.fLeft; |
119 offset->fY = bounds.fTop; | 119 offset->fY = bounds.fTop; |
120 return surf->makeImageSnapshot(); | 120 return surf->makeImageSnapshot(); |
121 } | 121 } |
122 | 122 |
123 void SkPictureImageFilter::drawPictureAtDeviceResolution(SkCanvas* canvas, | 123 void SkPictureImageFilter::drawPictureAtDeviceResolution(SkCanvas* canvas, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 str->appendf("crop: (%f,%f,%f,%f) ", | 184 str->appendf("crop: (%f,%f,%f,%f) ", |
185 fCropRect.fLeft, fCropRect.fTop, fCropRect.fRight, fCropRect.fB
ottom); | 185 fCropRect.fLeft, fCropRect.fTop, fCropRect.fRight, fCropRect.fB
ottom); |
186 if (fPicture) { | 186 if (fPicture) { |
187 str->appendf("picture: (%f,%f,%f,%f)", | 187 str->appendf("picture: (%f,%f,%f,%f)", |
188 fPicture->cullRect().fLeft, fPicture->cullRect().fTop, | 188 fPicture->cullRect().fLeft, fPicture->cullRect().fTop, |
189 fPicture->cullRect().fRight, fPicture->cullRect().fBottom); | 189 fPicture->cullRect().fRight, fPicture->cullRect().fBottom); |
190 } | 190 } |
191 str->append(")"); | 191 str->append(")"); |
192 } | 192 } |
193 #endif | 193 #endif |
OLD | NEW |