| 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 "SkSpecialImage.h" | 8 #include "SkSpecialImage.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkImage.h" | 10 #include "SkImage.h" |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 283 |
| 284 private: | 284 private: |
| 285 SkBitmap fBitmap; | 285 SkBitmap fBitmap; |
| 286 | 286 |
| 287 typedef SkSpecialImage_Base INHERITED; | 287 typedef SkSpecialImage_Base INHERITED; |
| 288 }; | 288 }; |
| 289 | 289 |
| 290 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromRaster(const SkIRect& subset, | 290 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromRaster(const SkIRect& subset, |
| 291 const SkBitmap& bm, | 291 const SkBitmap& bm, |
| 292 const SkSurfaceProps* props
) { | 292 const SkSurfaceProps* props
) { |
| 293 SkASSERT(nullptr == bm.getTexture()); | |
| 294 SkASSERT(rect_fits(subset, bm.width(), bm.height())); | 293 SkASSERT(rect_fits(subset, bm.width(), bm.height())); |
| 295 | 294 |
| 296 const SkBitmap* srcBM = &bm; | 295 const SkBitmap* srcBM = &bm; |
| 297 SkBitmap tmpStorage; | 296 SkBitmap tmpStorage; |
| 298 // ImageFilters only handle N32 at the moment, so force our src to be that | 297 // ImageFilters only handle N32 at the moment, so force our src to be that |
| 299 if (!valid_for_imagefilters(bm.info())) { | 298 if (!valid_for_imagefilters(bm.info())) { |
| 300 if (!bm.copyTo(&tmpStorage, kN32_SkColorType)) { | 299 if (!bm.copyTo(&tmpStorage, kN32_SkColorType)) { |
| 301 return nullptr; | 300 return nullptr; |
| 302 } | 301 } |
| 303 srcBM = &tmpStorage; | 302 srcBM = &tmpStorage; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 sk_sp<GrTexture> tex, | 445 sk_sp<GrTexture> tex, |
| 447 sk_sp<SkColorSpace> colorSpace
, | 446 sk_sp<SkColorSpace> colorSpace
, |
| 448 const SkSurfaceProps* props, | 447 const SkSurfaceProps* props, |
| 449 SkAlphaType at) { | 448 SkAlphaType at) { |
| 450 SkASSERT(rect_fits(subset, tex->width(), tex->height())); | 449 SkASSERT(rect_fits(subset, tex->width(), tex->height())); |
| 451 return sk_make_sp<SkSpecialImage_Gpu>(subset, uniqueID, std::move(tex), at, | 450 return sk_make_sp<SkSpecialImage_Gpu>(subset, uniqueID, std::move(tex), at, |
| 452 std::move(colorSpace), props); | 451 std::move(colorSpace), props); |
| 453 } | 452 } |
| 454 | 453 |
| 455 #endif | 454 #endif |
| OLD | NEW |