| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkSpecialImage.h" | 9 #include "SkSpecialImage.h" |
| 10 #include "SkSpecialSurface.h" | 10 #include "SkSpecialSurface.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 /////////////////////////////////////////////////////////////////////////////// | 39 /////////////////////////////////////////////////////////////////////////////// |
| 40 static SkSpecialSurface_Base* as_SB(SkSpecialSurface* surface) { | 40 static SkSpecialSurface_Base* as_SB(SkSpecialSurface* surface) { |
| 41 return static_cast<SkSpecialSurface_Base*>(surface); | 41 return static_cast<SkSpecialSurface_Base*>(surface); |
| 42 } | 42 } |
| 43 | 43 |
| 44 SkSpecialSurface::SkSpecialSurface(SkImageFilter::Proxy* proxy, | 44 SkSpecialSurface::SkSpecialSurface(SkImageFilter::Proxy* proxy, |
| 45 const SkIRect& subset, | 45 const SkIRect& subset, |
| 46 const SkSurfaceProps* props) | 46 const SkSurfaceProps* props) |
| 47 : fProps(SkSurfacePropsCopyOrDefault(props)) | 47 : fProps(SkSurfacePropsCopyOrDefault(props).flags(), kUnknown_SkPixelGeometr
y) |
| 48 , fSubset(subset) | 48 , fSubset(subset) |
| 49 , fProxy(proxy) { | 49 , fProxy(proxy) { |
| 50 SkASSERT(fSubset.width() > 0); | 50 SkASSERT(fSubset.width() > 0); |
| 51 SkASSERT(fSubset.height() > 0); | 51 SkASSERT(fSubset.height() > 0); |
| 52 } | 52 } |
| 53 | 53 |
| 54 SkCanvas* SkSpecialSurface::getCanvas() { | 54 SkCanvas* SkSpecialSurface::getCanvas() { |
| 55 return as_SB(this)->onGetCanvas(); | 55 return as_SB(this)->onGetCanvas(); |
| 56 } | 56 } |
| 57 | 57 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 69 SkSpecialSurface_Raster(SkImageFilter::Proxy* proxy, | 69 SkSpecialSurface_Raster(SkImageFilter::Proxy* proxy, |
| 70 SkPixelRef* pr, | 70 SkPixelRef* pr, |
| 71 const SkIRect& subset, | 71 const SkIRect& subset, |
| 72 const SkSurfaceProps* props) | 72 const SkSurfaceProps* props) |
| 73 : INHERITED(proxy, subset, props) { | 73 : INHERITED(proxy, subset, props) { |
| 74 const SkImageInfo& info = pr->info(); | 74 const SkImageInfo& info = pr->info(); |
| 75 | 75 |
| 76 fBitmap.setInfo(info, info.minRowBytes()); | 76 fBitmap.setInfo(info, info.minRowBytes()); |
| 77 fBitmap.setPixelRef(pr); | 77 fBitmap.setPixelRef(pr); |
| 78 | 78 |
| 79 fCanvas.reset(new SkCanvas(fBitmap)); | 79 fCanvas.reset(new SkCanvas(fBitmap, this->props())); |
| 80 } | 80 } |
| 81 | 81 |
| 82 ~SkSpecialSurface_Raster() override { } | 82 ~SkSpecialSurface_Raster() override { } |
| 83 | 83 |
| 84 sk_sp<SkSpecialImage> onMakeImageSnapshot() override { | 84 sk_sp<SkSpecialImage> onMakeImageSnapshot() override { |
| 85 return SkSpecialImage::MakeFromRaster(this->proxy(), this->subset(), fBi
tmap, | 85 return SkSpecialImage::MakeFromRaster(this->proxy(), this->subset(), fBi
tmap, |
| 86 &this->props()); | 86 &this->props()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 private: | 89 private: |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 189 } |
| 190 | 190 |
| 191 sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRenderTarget(SkImageFilter::Proxy*
proxy, | 191 sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRenderTarget(SkImageFilter::Proxy*
proxy, |
| 192 GrContext* context, | 192 GrContext* context, |
| 193 const GrSurfaceDesc&
desc, | 193 const GrSurfaceDesc&
desc, |
| 194 const SkSurfaceProps*
props) { | 194 const SkSurfaceProps*
props) { |
| 195 return nullptr; | 195 return nullptr; |
| 196 } | 196 } |
| 197 | 197 |
| 198 #endif | 198 #endif |
| OLD | NEW |