| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 } | 148 } |
| 149 | 149 |
| 150 private: | 150 private: |
| 151 sk_sp<GrDrawContext> fDrawContext; | 151 sk_sp<GrDrawContext> fDrawContext; |
| 152 | 152 |
| 153 typedef SkSpecialSurface_Base INHERITED; | 153 typedef SkSpecialSurface_Base INHERITED; |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRenderTarget(GrContext* context, | 156 sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRenderTarget(GrContext* context, |
| 157 int width, int height
, | 157 int width, int height
, |
| 158 GrPixelConfig config)
{ | 158 GrPixelConfig config, |
| 159 sk_sp<SkColorSpace> c
olorSpace) { |
| 159 if (!context) { | 160 if (!context) { |
| 160 return nullptr; | 161 return nullptr; |
| 161 } | 162 } |
| 162 | 163 |
| 163 sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kAppr
ox, | 164 sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kAppr
ox, |
| 164 width, height, conf
ig)); | 165 width, height, conf
ig, |
| 166 std::move(colorSpac
e))); |
| 165 if (!drawContext) { | 167 if (!drawContext) { |
| 166 return nullptr; | 168 return nullptr; |
| 167 } | 169 } |
| 168 | 170 |
| 169 const SkIRect subset = SkIRect::MakeWH(width, height); | 171 const SkIRect subset = SkIRect::MakeWH(width, height); |
| 170 | 172 |
| 171 return sk_make_sp<SkSpecialSurface_Gpu>(std::move(drawContext), width, heigh
t, subset); | 173 return sk_make_sp<SkSpecialSurface_Gpu>(std::move(drawContext), width, heigh
t, subset); |
| 172 } | 174 } |
| 173 | 175 |
| 174 #endif | 176 #endif |
| OLD | NEW |