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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 /////////////////////////////////////////////////////////////////////////////// | 64 /////////////////////////////////////////////////////////////////////////////// |
65 #include "SkMallocPixelRef.h" | 65 #include "SkMallocPixelRef.h" |
66 | 66 |
67 class SkSpecialSurface_Raster : public SkSpecialSurface_Base { | 67 class SkSpecialSurface_Raster : public SkSpecialSurface_Base { |
68 public: | 68 public: |
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)); |
80 } | 80 } |
81 | 81 |
82 ~SkSpecialSurface_Raster() override { } | 82 ~SkSpecialSurface_Raster() override { } |
83 | 83 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 return SkSpecialImage::MakeFromGpu(this->proxy(), this->subset(), | 141 return SkSpecialImage::MakeFromGpu(this->proxy(), this->subset(), |
142 kNeedNewImageUniqueID_SpecialImage, f
Texture); | 142 kNeedNewImageUniqueID_SpecialImage, f
Texture); |
143 } | 143 } |
144 | 144 |
145 private: | 145 private: |
146 SkAutoTUnref<GrTexture> fTexture; | 146 SkAutoTUnref<GrTexture> fTexture; |
147 | 147 |
148 typedef SkSpecialSurface_Base INHERITED; | 148 typedef SkSpecialSurface_Base INHERITED; |
149 }; | 149 }; |
150 | 150 |
151 sk_sp<SkSpecialSurface> SkSpecialSurface::MakeFromTexture(SkImageFilter::Proxy*
proxy, | 151 sk_sp<SkSpecialSurface> SkSpecialSurface::MakeFromTexture(SkImageFilter::Proxy*
proxy, |
152 const SkIRect& subset, | 152 const SkIRect& subset, |
153 GrTexture* texture, | 153 GrTexture* texture, |
154 const SkSurfaceProps*
props) { | 154 const SkSurfaceProps*
props) { |
155 if (!texture->asRenderTarget()) { | 155 if (!texture->asRenderTarget()) { |
156 return nullptr; | 156 return nullptr; |
157 } | 157 } |
158 | 158 |
159 return sk_make_sp<SkSpecialSurface_Gpu>(proxy, texture, subset, props); | 159 return sk_make_sp<SkSpecialSurface_Gpu>(proxy, texture, subset, props); |
160 } | 160 } |
161 | 161 |
(...skipping 25 matching lines...) Expand all Loading... |
187 } | 187 } |
188 | 188 |
189 sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRenderTarget(SkImageFilter::Proxy*
proxy, | 189 sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRenderTarget(SkImageFilter::Proxy*
proxy, |
190 GrContext* context, | 190 GrContext* context, |
191 const GrSurfaceDesc&
desc, | 191 const GrSurfaceDesc&
desc, |
192 const SkSurfaceProps*
props) { | 192 const SkSurfaceProps*
props) { |
193 return nullptr; | 193 return nullptr; |
194 } | 194 } |
195 | 195 |
196 #endif | 196 #endif |
OLD | NEW |